[Solved]Blynk goes offline after a day running

m in trouble, my blynk disconnects after a day on and I do not know what happened, I’m not using any code, just using the pushbuttons.

ps1: I tested with 4 different boards being: esp01s, nodemcu, wemos d1 mini and wemos retired.
ps2: In the 24 hour period, if I disconnect my internet router and reconnect the blynk automatically connects.

ps3: After 24 when the blynk is already offline if I press the reset button on the board it goes back to working for another 24h.

Paste your full formatted code here.

```cpp
CODE
```

I am using the standard blynk code:

#define BLYNK_PRINT Serial


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

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

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

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

  Blynk.begin(auth, ssid, pass);
}

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

Where is your button code?

What does your serial output display?

Sounds like you have internal networking issues (DHCP, router failures, interference, etc.), not Blynk issues. My router seems to hate running too many DHCP devices, but runs tme stability if I set their IP’s to static… go figure.

2 Likes

I’ve had a similar issue with my network. I think it’s when a device disconnects and reconnects and grabs a new dhcp address. The router eventually looses it’s mind. For a while I had to reset my router every day. I found the offending device and never had that problem again. Maybe there is some setting in the router that might account for issues like that.

Try setting a fixed IP for your MCU.

3 Likes

I have the same problem with both esp-01 and enc82j60 as a Ethernet shield for Arduino, although i have set static IP address for esp-01 or enc82j60 in router setting, it went offline after 1 or some days. And after reset Arduino it worked but went offline after that. I don’t know why.

I not use any code, i select the pushbutton on blynk app, choose the digital pin and blynk makes all magic for me.

People, i set ip to static and the board is online for more than 24 hours, I will leave 24 more and I will put the topic as resolved if it works.
Thanks for your help, thank you Blynk community.

Are you setting static ip in blynk code or your router?

Maybe that’s where I’m going wrong.
I should forget all this code malarkey and let the Blynk magic take over! :grinning:

1 Like

i set static ip in my router by mac address, my project are control some rf 315mhz devices through arduino - esp-01 (or enc82j60) - blynk. i think it go offline when i didn’t use in some days

What channel width is your router operating on?
I think I had some issues with network connectivity on some of my cheap China devices when I was on the 40 MHz width.

channel 6, 20/40mhz. it work after reset arduino board

Well yeah my devices also worked after a reset only to randomly stop working. Could never figure out if it was the band width or simply my router dropping the connection.

I’d suggest you try forcing it to 20

Post you code here.

//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>

// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);

#define led13 13

#include <IRremote.h> 
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

#include <RemoteSwitch.h> 

#define RF1ON 531361   
#define RF2ON 531363
#define RF3ON 531364
#define RF4ON 531369
#define RF5ON 531370
#define RF6ON 531372
#define RF7ON 531373
#define RF8ON 531387
#define RF9ON 531388
#define RF10ON 531390
#define RF11ON 531391
#define RF12ON 531396

#define PERIOD 357;


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

void setup()
{
  // Set console baud rate
  Serial.begin(9600);
  delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(115200);
  delay(10);
  pinMode(led13,OUTPUT);
  
  irrecv.enableIRIn(); 

  Blynk.begin(auth, wifi, "xxxxxx", "xxxxxx");
}

void loop()
{
  Blynk.run();
  
    if (irrecv.decode(&results)) 
    {
         if (results.value > 0)
      {
        if (results.value == 0x10 || results.value == 0xe0e020df || results.value == 0x2fd807f){transmit(RF1ON);}
        if (results.value == 0x810 || results.value == 0xe0e0a05f || results.value == 0x2fd40bf){transmit(RF2ON);}    
        if (results.value == 0x410 || results.value == 0xe0e0609f || results.value == 0x2fdc03f){transmit(RF3ON);}
        if (results.value == 0xc10 || results.value == 0xe0e010ef || results.value == 0x2fd20df){transmit(RF4ON);}
        if (results.value == 0x210 || results.value == 0xe0e0906f || results.value == 0x2fda05f){transmit(RF5ON);}
        if (results.value == 0xa10 || results.value == 0xe0e050af || results.value == 0x2fd609f){transmit(RF6ON);}
        if (results.value == 0x610 || results.value == 0xe0e030cf || results.value == 0x2fde01f){transmit(RF7ON);}
        if (results.value == 0xe10 || results.value == 0xe0e0b04f || results.value == 0x2fd10ef){transmit(RF8ON);}  
        delay(500); 
        irrecv.resume();
      }
    } 
}

BLYNK_WRITE(1){
    if (param.asInt()){       
        transmit(RF1ON);
    } 
}

BLYNK_WRITE(2){
    if (param.asInt()){       
        transmit(RF2ON);
    } 
}

BLYNK_WRITE(3){
    if (param.asInt()){       
        transmit(RF3ON);
    } 
}

BLYNK_WRITE(4){
    if (param.asInt()){       
        transmit(RF4ON);
    } 
}

BLYNK_WRITE(5){
    if (param.asInt()){       
        transmit(RF5ON);
    } 
}

BLYNK_WRITE(6){
    if (param.asInt()){       
        transmit(RF6ON);
    } 
}

BLYNK_WRITE(7){
    if (param.asInt()){       
        transmit(RF7ON);
    } 
}

BLYNK_WRITE(8){
    if (param.asInt()){       
        transmit(RF8ON);
    } 
}

BLYNK_WRITE(0){
    if (param.asInt()){       
        digitalWrite(led13, HIGH);
    } else {
        digitalWrite(led13, LOW);
    }
}

//------------------------------------------------------------------------

void transmit(unsigned long rcode){

unsigned long code = rcode;

unsigned long period = PERIOD;

code |= (unsigned long)period << 23;

code |= 3L << 20; 

RemoteSwitch::sendTelegram(code, 12); 
    
 }  
//*******************************************************

i use blynk 0.3.4 version

Recommend you upgrade to a 21st Century version.

2 Likes