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

Problem with unknow reboot in 24 hours


#1

NodeMCU v1.0
Hi, friends! I have something strange with working of my device.
It works 24 hours and then reboots every 5 seconds
My code:

void UpTime() {
  Blynk.virtualWrite(V0, millis() / 60000);  // Send UpTime seconds to App
  Serial.print("UpTime: ");
  Serial.println(millis() / 60000);  // Send UpTime seconds to Serial
  //digitalWrite(DeviceLED, !digitalRead(DeviceLED));  // Blink onboard LED
}
 
void loop()
{

   timer.run();
 
   if (Blynk.connected()) {  // If connected run as normal
    Blynk.run();
  } else if (ReCnctFlag == 0) {  // If NOT connected and not already trying to reconnect, set timer to try to reconnect in 30 seconds
    ReCnctFlag = 1;  // Set reconnection Flag
    Serial.println("Connection is lost. Reconnect 30 secconds ...");
    timer.setTimeout(30000L, []() {  // Lambda Reconnection Timer Function
      ReCnctFlag = 0;  // Reset reconnection Flag
      ReCnctCount++;  // Increment reconnection Counter
      Serial.print("Trying to reconnect #");
      Serial.println(ReCnctCount);
      Blynk.connect();  // Try to reconnect to the server
    });  // END Timer Function
  }

      
    if (millis() - lastmillis > 20000){
      lastmillis = millis ();

      sendSensor_hum();
    }
    
  if ( digitalRead(TRIGGER_PIN) == 0 ) {
    wifi_configer ();
  }    
}

Has anyone had such an incident?


#2

Of strange things happening… Yes.

Of your precise issue… Unlikely :stuck_out_tongue_winking_eye:

Start with looking at what your ESP might be saying happened to cause the reboot… look at the Serial monitor message on reboot.

BTW, if you are using BlynkTimer anyhow, probably best to setup proper timed functions to run your sensor scans. Try to keep unnecessary code and logic out of the void loop()

That is not the whole code, and what is missing may or may not offer other potential hints.


#3

Can you tell me how can I reboot the NodeMCU
Can you give me piece of code?


#4

Isn’t the problem that it already reboots??

What good is introducing code to do that on command… it won’t indicate anything about your other issue as you method would be “On command” :stuck_out_tongue_winking_eye:


#5

I take a mistake - the device disconecting and connecting many times after 24 hours.

I think that provider can block traffic.
Because since the device restarts in exactly 24 hours.

I want to restart it on 23 hour


#6

Same time each day or 24 hours after boot?.. big difference there.

You need to find out what the “many times after 24 hours” reboot error is.

You know you can Google for little things like that :stuck_out_tongue_winking_eye:

ESP.restart()


#7

You might want to look at your router setting, in particular DHCP lease times. If that’s set to 24 hours then that may be where the 24 hour thing is coming from.

Also, I’ try to clean-up your void loop, as this can cause Blynk timeouts and disconnections.

Pete.


#8

It “disconnecting - connecting” after 24 hours since successful upload

Thank you. I think that’s the problem.
In 531 minutes I will write


#9

A strange situation did not appear. :open_mouth:This is magic.:open_mouth: 2100 minutes at work. Thank you all.