BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

AZ-Delivery D1 Mini, crash within Blynk.begin

Hello folks!
I received the gratifying order from my wife to implement monitoring for her ‘ollas’ in the raised bed. During my research I came across blynk and got myself an “AZ-Delivery D1 Mini” (WiFi, see https://www.az-delivery.de/products/d1-mini). Unfortunately, there is a problem which I can’t solve even after hours of research.

Code:

#define BLYNK_TEMPLATE_ID "XXX"
#define BLYNK_DEVICE_NAME "XXX"
#define BLYNK_AUTH_TOKEN "XXX"
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "XXX";
char pass[] = "XXX";

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
}

void loop() {
  //Blynk.run();
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000); 
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000); 
}

Behavior according to Searial log:

...
00:35:45.805 -> [71] Connecting to soumas-motog6  **NOTE:CONNECT**
00:35:53.554 -> [7801] Connected to WiFi
00:35:53.554 -> [7802] IP: 192.168.43.11
00:35:53.554 -> [7802] 
00:35:53.554 ->     ___  __          __
00:35:53.554 ->    / _ )/ /_ _____  / /__
00:35:53.554 ->   / _  / / // / _ \/  '_/
00:35:53.554 ->  /____/_/\_, /_//_/_/\_\
00:35:53.554 ->         /___/ v1.0.1 on ESP8266
00:35:53.554 -> 
00:35:53.554 -> [7808] Connecting to blynk.cloud:80
00:35:53.695 -> [7966] Re⸮    **NOTE:CRASH** 
00:36:00.593 ->  ets Jan  8 2013,rst cause:4, boot mode:(3,6)  **NOTE:REBOOT**
00:36:00.593 -> 
00:36:00.593 -> wdt reset
00:36:00.593 -> load 0x4010f000, len 3460, room 16 
00:36:00.593 -> tail 4
00:36:00.593 -> chksum 0xcc
00:36:00.593 -> load 0x3fff20b8, len 40, room 4 
00:36:00.593 -> tail 4
00:36:00.593 -> chksum 0xc9
00:36:00.593 -> csum 0xc9
00:36:00.593 -> v000461d0
00:36:00.642 -> ~ld
00:36:00.688 -> [72] Connecting to soumas-motog6  **NOTE:CONNECT** 
00:36:08.428 -> [7803] Connected to WiFi
00:36:08.428 -> [7803] IP: 192.168.43.11
00:36:08.428 -> [7803] 
00:36:08.428 ->     ___  __          __
00:36:08.428 ->    / _ )/ /_ _____  / /__
00:36:08.428 ->   / _  / / // / _ \/  '_/
00:36:08.428 ->  /____/_/\_, /_//_/_/\_\
00:36:08.428 ->         /___/ v1.0.1 on ESP8266
00:36:08.428 -> 
00:36:08.428 -> [7810] Connecting to blynk.cloud:80
00:36:08.568 -> [7938] Re⸮      **NOTE:CRASH**
00:36:15.464 ->  ets Jan  8 2013,rst cause:4, boot mode:(3,6)   **NOTE:REBOOT** 
00:36:15.464 -> 
00:36:15.464 -> wdt reset
00:36:15.464 -> load 0x4010f000, len 3460, room 16 
00:36:15.464 -> tail 4
00:36:15.464 -> chksum 0xcc
00:36:15.464 -> load 0x3fff20b8, len 40, room 4 
00:36:15.464 -> tail 4
00:36:15.464 -> chksum 0xc9
00:36:15.464 -> csum 0xc9
00:36:15.464 -> v000461d0
00:36:15.464 -> ~ld
00:36:15.558 -> [71] Connecting to soumas-motog6 **NOTE:CONNECT** 
...

So when Blynk.begin(…) is called, a connection to the router is successfully established. The status of the device in blynk.cloud also switches to “ON” briefly. Shortly thereafter, the D1 crashed and the connection setup starts from the beginning (status in blynk.cloud switches to “OFF”).

I have already tried:

  • Different USB cables
  • Different D1 boards (of the same type/series)
  • Power supply via laboratory power supply (5V & 3.3V)
  • current and older versions of the ESP-Lib
  • current and older versions of the Blynk Lib
  • lots of board-settings in Arduino IDE
  • try to connect to another TCP Server with the D1 board (works without problem)

Notable observation: When I use a Blynk lib with version < 1.0.0 the D1 tries to connect to blynk-cloud.com by default. As expected, I get the error “Invalid auth token” and there is no crash. If I force the same version “blynk.cloud” to be used, the D1 crashes like described above.

I am at the end of my options and would be grateful if I could get some hints for a solution from you.

Thank you, Tom

What board type are you choosing on the IDE?
What pin are you selecting in the IDE for LED_BUILTIN?

Your sketch is missing Blynk.run(); from the void loop, and you shouldn’t be using blocking delays in your void loop with Blynk.

Pete.

Hello Pete - thanks for your feedback!

I tried with:

  • Generic ESP8266 Module
  • LOLIN (WEMOS) D1 R2 & mini
  • LOLIN (WEMOS) D1 mini (clone)
  • LOLIN (WEMOS) D1 mini Lite
  • LOLIN (WEMOS) D1 mini Pro
  • LOLIN (WEMOS) D1 R1
    Same behavior for all of them

I think this is defined in the Arduino IDE via the board type…? I can’t find any configuration options für this constant. Serial.print(LED_BUILTIN); returns the value “2”. A simple blink sketch using this constant (without blynk) lights up the onboard LED. So that seems correct.

This is just the latest status of my debug attempts. Same behavior with

void loop() {
  Blynk.run();
}

I’m pretty sure the loop method will never be called if Blynk.init() is in setup() . Neither a Serial.println() nor driving an LED in the loop() has any effect.

Thank you, Tom

Okay, make sure that you are running ESP8266 core version 3.0.2, Blynl Libraty 1.0.1 and have Blynk.run(); in your void loop.

Add this line immediately before #define BLYNK_PRINT Serial

#define BLYNK_DEBUG

Compile with board type “LOLIN (WEMOS) D1 R2 & mini” and upload then code. Clear the serial monitor and press the RST button then post the serial output that you see. It should look like this:

ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3460, room 16 
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4 
tail 4
chksum 0xc9
csum 0xc9
v000464d0
~ld
[79] Connecting to [SSID READCTED]
[4310] Connected to WiFi
[4310] IP: 192.168.1.198
[4310] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP8266

[4320] Connecting to blynk.cloud:80
[4369] <[1D|00|01|00] [AUTH TOKEN REDACTED]
[4384] >[00|00|01|00|C8]
[4385] Ready (ping: 15ms).
[4385] Free RAM: 49136
[4452] <[11|00|02|00]over[00]1.0.1[00]h-beat[00]45[00]buff-in[00]1024[00]dev[00]ESP8266[00]fw-type[00][TEMPLATE_ID READCTED][00]build[00]Jan 14 2022 08:25:19[00]tmpl[00][TEMPLATE_ID REDACTED][00]
[6459] >[00|00|02|00|C8]
[50468] <[06|00|03|00|00]
[52473] >[00|00|03|00|C8]

Pete.

@soumas - I have worked with the ESP8266 and one of the issues is that it inherently tries to setup as an Access Point, which causes a “bricked” type symptom, try erase the device and reload the latest firmware. Use a serial terminal program and see if you can communicate with it via the UART, if you can then try again.

Also try changing this to V1 (or which ever Virtual pin you have setup on the web portal.

@PeteKnight
okay … I followed your instructions and here is the serial output:

13:02:09.852 -> (**SOME UNPASTABLE CHARACTERS** like 'rll%&/&/ZH...') Connecting to soumas-motog6
13:02:14.138 -> [4298] Connected to WiFi
13:02:14.138 -> [4298] IP: 192.168.43.11
13:02:14.138 -> [4298] 
13:02:14.138 ->     ___  __          __
13:02:14.138 ->    / _ )/ /_ _____  / /__
13:02:14.185 ->   / _  / / // / _ \/  '_/
13:02:14.185 ->  /____/_/\_, /_//_/_/\_\
13:02:14.185 ->         /___/ v1.0.1 on ESP8266
13:02:14.185 -> 
13:02:14.185 -> [4304] Connecting to blynk.cloud:80
13:02:14.232 -> [4396] <[1D|00|01|00] **AUTH-TOKEN-HERE**
13:02:14.323 -> [4452] >[00|00|01|00|C8]
13:02:14.323 -> [4453] Ready (ping: 56ms).
13:02:14.323 -> [4453] Free RAM: 49008⸮
13:02:22.065 ->  ets Jan  8 2013,rst cause:4, boot mode:(3,6)
13:02:22.065 -> 
13:02:22.065 -> wdt reset
13:02:22.065 -> load 0x4010f000, len 3460, room 16 
13:02:22.065 -> tail 4
13:02:22.065 -> chksum 0xcc
13:02:22.065 -> load 0x3fff20b8, len 40, room 4 
13:02:22.065 -> tail 4
13:02:22.065 -> chksum 0xc9
13:02:22.065 -> csum 0xc9
13:02:22.065 -> v000464a0
13:02:22.065 -> ~ld
13:02:22.110 -> [70] Connecting to soumas-motog6
13:02:30.365 -> [8300] Connected to WiFi
13:02:30.365 -> [8300] IP: 192.168.43.11
13:02:30.365 -> [8300] 
13:02:30.365 ->     ___  __          __
13:02:30.365 ->    / _ )/ /_ _____  / /__
13:02:30.365 ->   / _  / / // / _ \/  '_/
13:02:30.365 ->  /____/_/\_, /_//_/_/\_\
13:02:30.365 ->         /___/ v1.0.1 on ESP8266
13:02:30.365 -> 
13:02:30.365 -> [8306] Connecting to blynk.cloud:80
13:02:30.460 -> [8397] <[1D|00|01|00] **AUTH-TOKEN-HERE**
13:02:30.507 -> [8447] >[00|00|01|00|C8]
13:02:30.507 -> [8447] Ready (ping: 49ms).
13:02:30.507 -> [8447] Free RAM: 49008⸮
...

What happens if you remove the pinMode command from your void setup, and everything except Blynk.run from your void loop?

Using a baud rate of 74880 may give you a more intelligible serial output too.

Pete.

@PeteKnight
Please excuse the late info, but I already minimized the code before. My last post was already based on the following code:

void setup() {  
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
}

void loop() {
  Blynk.run();
}

Unfortunately, changing the baud rate to 74880 hardly changes the output (only the “hieroglyphs” look different)

That’s what I was aiming to solve with that change.

Pete

… already knew that. But I can read neither the one nor the other hieroglyphs :slight_smile:

I will now try to flash the ESP to the latest firmware as suggested by @SmsAlert (thanks for your input by the way). Haven’t done this before… will probably take a while.

Many thanks for your help!

Where have you obtained this firmware from?
The firmware will be over-written anyway when you re-upload your sketch, assuming that it doesn’t brick your device in the process.

Pete.

In that case change your baud rate again until you find the native baud rate for your device.

Pete

Huh - I finally found the problem!

Since I couldn’t find a suitable baud rate in the Arduino IDE, I read out the “hieroglyphs” with the logic analyzer. Unfortunately, this brought no news (see screenshot)

Shortly before I gave up (too much effort for the mini-project) I followed my feeling that it wasn’t the hardware at all but the blynk.cloud project. New project created, auth code & co. replaced in the sketch … everything works without problems.

Thank you very much for your support!

Thomas