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

Arduino D1 wifi: rst cause:4, boot mode:(1,6),wdt reset

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

  ****/
```cpp
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
#define DHTTYPE DHT11   // DHT 11
#include <DHTesp.h>
//#include <DHT.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxx";

#define TempHumPin D4

DHTesp dht;
//DHT dht(TempHumPin, DHTTYPE);
BlynkTimer timer;

float AnlogVal;
boolean debug=false;
int HomePos = 93,dlay= 10000, Speed=10; // homepos was 92
int startHr=5,stopHr=0,startMin=0, stopMin=0,SpdModifier=0, EndDelay=0,i;
String StartTime="5:00",EndTime="",LightCycle="24-0";

//*********************************************************************************************

void setup() {
    Serial.begin(115200);
    pinMode(TempHumPin, INPUT );
   
    // dht.setup(12, DHTesp::DHT11); // Connect DHT sensor to GPIO 12   - D6  
    //  dht.setup(16, DHTesp::DHT11); // Connect DHT sensor to GPIO 16   - D2
    //dht.setup(0, DHTesp::DHT11); // Connect DHT sensor to GPIO 0   - D8
    dht.setup(4, DHTesp::DHT11); // Connect DHT sensor to GPIO 4   - D4
    //dht.begin();
    Blynk.begin(auth, ssid, pass);
    delay(1000);
    timer.setInterval(2000L, GetTempHumidity);
} // end setup

//********************************************************************************

void loop() {
   // put your main code here, to run repeatedly:
   // only need 1 pin, leave 2 for future
   Blynk.run();
   timer.run();
   //GetTempHumidity();
   //delay(1000);
}  // end loop

//***************************************************************************************

void GetTempHumidity()
{
    delay(dht.getMinimumSamplingPeriod());
  
    float humidity = dht.getHumidity();
    float temperature = dht.getTemperature();
  
    Serial.print(dht.getStatusString());
    Serial.print("\t");
    Serial.print(humidity, 1);
    Serial.print("\t\t");
    Serial.print(temperature, 1);
    Serial.print("\t\t");
    Serial.print(dht.toFahrenheit(temperature), 1);
    Serial.print("\t\t");
    Serial.print(dht.computeHeatIndex(temperature, humidity, false), 1);
    Serial.print("\t\t");
    Serial.println(dht.computeHeatIndex(dht.toFahrenheit(temperature), humidity, true), 1);
    Blynk.virtualWrite(V5, humidity);
    Blynk.virtualWrite(V6, temperature);
} // end GetTempHumidity

Not sure, do I describe the problem here, after the code?

Board: Arduino D1 wifi with esp8266 0nboard.
Selected board in Arduino IDE: Wemos D1 R1.
Arduino IDE version: 1.8.5
When I comment Blynk.begin and Blynk.run out, it works fine, even with relay connected to D11.

Blynk feedback and version:

[8479] Connected to WiFi
[8479] IP: 192.168.0.102
[8479] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[8485] Connecting to blynk-cloud.com:80
[8727] <[1D|00|01|00] 3d170bc1986143a69a5bd844b005810b
[8956] >[00|00|01|00|C8]
[8956] Ready (ping: 228ms).
[8957] Free RAM: 48536
[8957] >[14|00|01|00|08]
[8957] >pm[00]6[00]out

 ets Jan  8 2013,rst cause:4, boot mode:(1,6)
wdt reset

Blynk server.
Android 8 phone.

Have searched and read up on the watchdog timer, seems delays in the code can cause it, although some say no, delay() incorporates yield() so it should’nt cause a problem.
Do not know if this is true.
Could’nt find what the (1,6) means.
I have tried it without the humidity as well, thought maybe the delay incorporated by the humidity library caused it, but it did not matter.
Should’nt as this library for humidity is for the esp8266
Would appreciate any help.
Thanks.
Peet

https://examples.blynk.cc/?board=WeMos%20D1&shield=ESP8266%20WiFi&example=More%2FDHT11

Thanks Toro, same error but cannot read last part of error message with baud at 9600:

[9355] Connected to WiFi
[9355] IP: 192.168.0.102
[9355] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[9432] Connecting to blynk-cloud.com:80
[9923] Ready (ping: 219ms).
H!⸮⸮

Here is message at 115200 baud:

[8586] Connected to WiFi
[8586] IP: 192.168.0.102
[8586] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[8592] Connecting to blynk-cloud.com:80
[9065] Ready (ping: 230ms).

 ets Jan  8 2013,rst cause:4, boot mode:(1,6)
wdt reset

Thanks
Peet

Are you using the code exactly as shown in the link? With those libraries?

what about your wiring?

Are you using the correct pins? There are a few on the ESP that will change the mode it boots in.

I believe the boot mode 1 means it is booting in program mode. Thus why I mention the pins and wiring.

https://www.forward.com.au/pfod/ESP8266/GPIOpins/index.html

Hi Toro,
Thanks, will read through the stuff that you sent.
I have a red face, bit embarrassed!!!
I must apologize, did not realize the pins I choose on the D1 board can have such an effect on the performance!!
I did not explain the whole story, my mistake.
When everything worked and only stopped working when I added Blynk to the sketch,
I assumed it must be Blynk.
What I noticed, was, when uploading the sketch, a relay that is on D11, name is Mosi on the board, driving a servo motor, started oscillating, but after uploading everything worked fine, until I started with Blynk.

This is the pin assignments in my sketch:

//#define DHTTYPE DHT11 
#define AnLogPin A0
#define DirPin D2  // direction pin of stepper
#define StepPin D3  // stepper step pin
#define TempHumPin D4  // humidity and temperature
#define MicroSwitchPins D5 // Mux Pin for Fwd and BW to stop motor when microswitch closed
//#define BWMicroSwitchPin D6  // Pin to stop motor when microswitch closed
#define ServoMotorPin D7  // Pin to control light servo motor movement
#define FanRelayPin D8  // O/P
#define MuxPinA D9   // multiplex address A
#define MuxPinB D10  // multiplex address B
#define LightRelayPin D11  // O/P  For light and motor 

I am multiplexing the pins to get more i/o pins, it works fine:

Ic Cd 4052 to multiplex the analog inputs(two channel):
EC address : 00
pH address : 01
Light sensor address: 10
open (no connection): 11
Also mux the digital inputs for Fwd and BW microswitches:
Fwd microswitch address: 00 // switch to stop servo and then reverse direction
BW microswitch address : 01 // switch to stop servo and then reverse direction
open (no connection) : 10
open (no connection) : 11

When I started adding Blynk I left the H/w connected and first just tried to get
the humidity to work, on D4 (Gpio 4), but then got the problem.
Looks like I am trying to get too much out of this board!!!
I tried your example code, only changed the humidity connection to D4, as wired on my system.
And with the second test, changed the baud to 115200.

I can use the open multiplexed outputs (2) see above instead of D11.

If I could please just ask one thing: Can I use pins up to D10(Gpio 15) on this board??
Do not bother if it is in the documents you suggested, will go and read it now.
Again, apologies, will not make the same mistake again!
Learned a lesson, my logic is also sometimes wrong!!!
Thanks again,
Peet Raats

Hi Toro,
Now I am completely lost!!!
I really thought we have the problem sorted.
I removed EVERYTHING from the breadboard, just wired the humidity sensor and uploaded the example you sent with the sensor on D4:

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

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

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Tenda_536670";
char pass[] = "xxxxxxxxx";

#define DHTPIN D4          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
   
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
   float h = dht.readHumidity();
   float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

   if (isnan(h) || isnan(t)) {
     Serial.println("Failed to read from DHT sensor!");
     return;
  }
   // You can send any value at any time.
   // Please don't send more that 10 values per second.
   Blynk.virtualWrite(V5, h);
   Blynk.virtualWrite(V6, t);
}

void setup()
{
   // Debug console
   Serial.begin(115200);

   Blynk.begin(auth, ssid, pass);
   // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

   dht.begin();

   // Setup a function to be called every second
   timer.setInterval(1000L, sendSensor);
}

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

Sorry, code is formatted, but when posted, not anymore!
Get the same error.
I then pressed the reset button on the D1 board and got more output from Blynk:

[2554] Connected to WiFi
[2554] IP: 192.168.0.102
[2554] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[2560] Connecting to blynk-cloud.com:80
[3716] Ready (ping: 219ms).

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

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v951aeffa
~ld
[49] Connecting to Tenda_536670
[2554] Connected to WiFi
[2554] IP: 192.168.0.102
[2555] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[2561] Connecting to blynk-cloud.com:80
[3238] Ready (ping: 219ms).

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

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8

Have also tried it on pins D2 and D3
It repeats continuously!!
There is an extra line which for some reason will not copy and paste, some control characters I assume!
Please,no idea what to try!!!
Thanks for your help!
Peet Raats

Just something else:
Have other people used this board??
Is it compatible with Blynk??
I commented out AGAIN, everything to do with Blynk, then it WORKS!!!
See here:

OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8
OK 70.0 19.0 66.2 18.8 65.8

Can you please edit your previous posts and format your code using 3 backticks as per forums rules.

Others including myself will be able to read your code better and may be able to help.

1 Like

can you post a link to the exact board you are using?

You format your code after pasting it in your post… as per the Welcome Topic and this diagram…

Blynk%20-%20FTFC

I fixed your above posts…

Please follow these directions or further posted code will just get removed.

On many ESP8266 based development boards, this pin is also connected to the build in LED… try using a safer pin like D1 or D2 (GPIO 4, 5) and I would also highly recommend switching to using the GPIO numbering in your code as the IDE may not be interpreting your silkscreened Dpin numbering correctly.

Hi Gunner,
Thanks for your reply.
Tried it, same error.
Question still remains:Why does it run 100% if no blynk code?
I have tried to switch on an LED, same error, no blynk then it works!
I have also tried just the board, NO pins connected, nothing, just the board.
Same error!!!
I am really pretty sure it is Blynk not working with this board!
Here is a link to the board:


Have bought an Arduino Mega 2560 this afternoon, so far looks like it is working, just losing connection now and again, but will sort it out tomorrow.
Thanks very much!
Peet

Because Blynk is a full IoT library and offers a whole new range of communication options to mere Arduinos (and ESPs, etc). Thus there are requirements to how one needs to write their code and time function actions, in order to not interfere with Blynk’s (or any other full IoT type library) background communications.

Is that the exact board you have purchased?

It looks like a D1 clone, except the silk screening looks off. Maybe the one you have is mislabeled?

Take a look at this (Note the Dpin Numbers). The boards are slightly different, but maybe? Just putting it out there.

image

I think there were two versions of that old board… each with slightly differing pinouts.

@Peetr Either way, best to use the GPIO numbering and not the Silk Screened ones, as they require using the exactly correct board in the IDE, else it doesn’t know how to translate them either :slight_smile:

Thanks very much guys!
The Mega 2560 working fine, will keep the D1 board for some project in future!
Peet