0

Blind controller

I'm trying to build the software side of an Automatic Blind Controller on Thingiverse, but having am trouble with what I think is repetitive rebooting, based on the serial monitor output:

17:53:28.964 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
17:53:28.964 -> 
17:53:28.964 -> load 0x4010f000, len 3456, room 16 
17:53:28.998 -> tail 0
17:53:28.998 -> chksum 0x84
17:53:28.998 -> csum 0x84
17:53:28.998 -> va5432625
17:53:28.998 -> ~ld
17:53:30.728 -> 
17:53:30.728 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
17:53:30.728 -> 
17:53:30.728 -> load 0x4010f000, len 3456, room 16 
17:53:30.728 -> tail 0
17:53:30.728 -> chksum 0x84
17:53:30.728 -> csum 0x84
17:53:30.728 -> va5432625
17:53:30.728 -> ~ld

It looks like this is just the bootloader restarting, it doesn't get far enough into the Arduino setup() function to produce any serial output.

How should I debug this?

  1. Arduino Blink sketch works fine - blinks LED at a sensible rate
  2. Arduino DigitalReadSerial works fine - outputs button status on serial port
  3. Even ESP8266WiFi/WiFiScan worked which I thought might be the problem.
  4. I'm suspecting a power issue (despite using an external power supply), so I've started commenting out much of void setup() to limit what else starts up to no avail:

Extract from BCV2_02_Blank.ino:

void setup()
{
  // Debug console
  Serial.begin(9600); // I've also tried 115200 to match the bootloader, but ultimately nothing comes out

  //NeoPixel library
  pixels.begin(); // This initializes the NeoPixel library.
  pixels.setBrightness(200);
  
  if (digitalRead(downButtonPin) == HIGH) {
    Serial.println("Resetting...");
    flash_LED(8,String("Green")); 
    delay(3000);
    resetAll();
  }

  Serial.println("Initiallising...");
  //Turn on led as boot status
  pixels.setPixelColor(0,255,165,0); 
  pixels.show();
  delay(2000);

  ...
  1. Continuing with my suspicion of power issues, I've begun to comment out anything that may be initialised before setup() runs:

Extract from BCV2_02_Blank.ino:

//Automatic Blind Controller v2.02
//Copyright CABUU.COM
//Arduino Sketch Version 2.02
//29 May 2019

//v2.02 Include safety cut off feature and LED (requires udate to Blynk app)

//This is a beta, and works for CCW (UP) and CW (Down) motion only
//Replicates a WemoSwitch in Alexa
//Replace the relevant variables below

//------- Substitute your own variables below ------
char ssid[] = "...";         // your network SSID (name)
char password[] = "...";  // your network key
char DeviceName[] = "Blind Controller";       //Name of the device as seen by Alexa etc.

boolean useBlynk = false;                    //Use Blynk
char auth[] = "..."; //Blynk authentication token
//End of user defined variables

#include "WemoSwitch.h"
//#include "WemoManager.h"
#include "CallbackFunction.h"

//#include <Adafruit_NeoPixel.h>
#define PIN            D3
//Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);

// prototypes
boolean connectWifi();

//WemoManager wemoManager;
//WemoSwitch *light = NULL;

...

This still doesn't seem to do the trick. How does Arduino IDE choose what to libraries to link? What's the equivalent of a Makefile in Arduino-land.

What else should I try:

  1. Code the whole thing up from scratch, and adding libraries as I go until it breaks?
  2. Throw the D1 mini away as it feels like a poor quality knock-off and get another one (but not guarantee that'll be any better)?
Mat
  • 82,161
  • 34
  • 89
  • 109
  • 2
    if you suspect power issue, how does comment out setup() would help to solve the power issue? First step is to detach the switch board and power the D1 mini alone to see if it is still causing reboot. – hcheung Jun 29 '20 at 00:36
  • @hcheung I suspect something like the NeoPixel or WiFi part is coming up and the causing problems. I get exactly the same behaviour (constant resetting) with just the D1 mini alone, or the D1 plus external power supply board. My suspicion is based on suggestions that there's a problem with clone voltage regulators not being up to the job - e.g. https://www.letscontrolit.com/forum/viewtopic.php?t=6603 – Mat Jun 29 '20 at 16:56

2 Answers2

1

This is a problem with the old Encoder.h library, there is a new version of this or you can use the older ESP8266 2.4.2 Library as that also stops it. it's something to do with the ESP interrupts.

0

My suspicion remains that this is due to it being a clone Wemos board from Banggood with an insufficient current regulator. Hopefully the replacement I've ordered from ebay will be a genuine one with a sensible specification and work as expected.

The Reddit thread Warning: Clone WeMos D1 Minis with only 150mA 3.3V regualtors [sic] - Buyer Beware shows the problem:

Folks, if the 3.3V regualtor on your brand new Wemos D1 Mini is marked 4Ax or 4Bx where x is some random number/letter, and the middle letter does not have an underline, then congratulations, you have purchased a guaranteed to be flaky WeMos D1 Mini clone. To confirm this, please review the marking codes on this data sheet. This a 150mA 3.3V regulator!

Indeed, my board has a regulator marked 4A2D:

Clone board

From the data sheet:

Datasheet extract 1

Datasheet extract 2 Datasheet extract 3


My suspicion may not be correct. The (what appears to be genuine) LOLIN marked board arrived:

New 'genuine' LOLIN board

It similarly works well with some noddy code, but boots up with the same rebooting issue with more complicated code:

17:16:12.452 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
17:16:12.452 -> 
17:16:12.487 -> load 0x4010f000, len 3456, room 16 
17:16:12.487 -> tail 0
17:16:12.487 -> chksum 0x84
17:16:12.487 -> csum 0x84
17:16:12.487 -> va5432625
17:16:12.487 -> ~ld

The regulator is marked differently 'S2SK', but I've not yet found a datasheet. I'm not even sure what manufacturer that logo is.

LOLIN board and regulator

Mat
  • 82,161
  • 34
  • 89
  • 109