Any different option/setting to choose between ESP12E and NodeMcu

@PeteKnight yes, apologies I did not read your post about the WiFi mode and you are correct. I only pointed it out because I had the same issue when using just the ESP8622 chip, I never had this issue when using NodeMCU’s. I still have one powered up that shows up, not just my wifi list but all the apartments around me, I know people think its a free unsecured wifi and try to connect, however it doesn’t seem to cause a problem with connection as the unit has run okay for several weeks.

You are also correct about the ESP8266 being fussy, especially with the power supply. @Madhukesh I no longer use the AMS1117 3.3V regulator, in theory it should be sufficient but in practice it’s not “man” enough for the job during WiFi operations and could be causing your connection dropout problem. As you can see from my sketch all my pullup and pulldown resistors are 10k which if I remember correctly is what Espressif recommend in their data sheet. With regards to capacitors, I have both “storage” and “smoothing” capacitors fitted just about everywhere.

I moved over to the ESP32 about 6 weeks ago and it is much less fussy and requires much less peripheral components. Having the WiFi management on a separate core really helps when you have 4 sensors, an RF link, a touch screen display and Blynk to manage. I still have a few heartbeat timeout issues during peek internet usage times here in China but my main 3 projects (2 x ESP32 and 1 x ESP8266) are able to maintain a good reliable connection now.

@Madhukesh
The versions I’m using at the moment are:-

Blynk library 6.1
ESP866 core 2.5.2
Arduino IDE 1.8.9
Blynk Cloud server

My advice would be to check or change your power supply.

Richard

1 Like

If that is the case, then even NODEMCU must not work. Because it uses the same AMS1117 to step down the voltage.That was the only reason i used the same.

@PeteKnight @psoro @Gunner @rha10

Attempting reconnection #1
[139727] Connecting to 192.168.0.103:8080
[142650] Ready (ping: 38ms).
Cconnected
[163353] Heartbeat timeout
Starting reconnection timer in 10 seconds...
Attempting reconnection #1
[173354] Connecting to 192.168.0.103:8080
[173410] Ready (ping: 33ms).
Cconnected

This is the output on the serial monitor. It keeps trying and once in a while it connects and the connection drops and again takes several min to connect. Some times it never connects. Needs to manually rebooted, then too there is no guarantee that it may come online.

And what is the reason for the ESP to drop out every now and then ? Even the wifi signal is really good. Then too it will reconnect every now and then. This is not normal right ?

Please help me to get a stable connection. This happens(Dropouts) even on NODEMCU as well. This is not normal !!

the dog needs feed :rofl:

Bro !!! I am fed up of this !!! Please show me a way out.

I know there is something hidden(watch dog timers) in this, But not understanding. Can you please help ? Lets make fun later :stuck_out_tongue:

post your sketch bro ! :wink:
I’ll take a look

We’d need to see the code that you’re running to be able to do that.

Pete.

1 Like

@Blynk_Coeur @PeteKnight
This is the code i am using

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char auth[] = "xxxxxxxxx";
char ssid[] = "xxxxxxxxx";
char pass[] = "xxxxxxxxxxxxx";
char server[] = "192.168.0.103";  // IP for Local Cloud Server
int port = 8080;


int ReCnctFlag;  // Reconnection Flag
int ReCnctCount = 0;  // Reconnection counter

bool isFirstConnect = true;


const int ledPin = 7;
const int btnPin = 8;

BlynkTimer timer;
void checkPhysicalButton();

int ledState = LOW;
int btnState = HIGH;


BLYNK_CONNECTED() {
  if (isFirstConnect) {
     Blynk.syncAll();
     Blynk.syncVirtual(V1, V2, V3, V4);
     isFirstConnect = false;
  }
  Serial.println("Connected");
  ReCnctCount = 0;
}


BLYNK_WRITE(V2) {
  ledState = param.asInt();
  digitalWrite(ledPin, ledState);
}

void checkPhysicalButton()
{
  if (digitalRead(btnPin) == LOW) {
     if (btnState != LOW) {
       ledState = !ledState;
      digitalWrite(ledPin, ledState);

     Blynk.virtualWrite(V2, ledState);
    }
    btnState = LOW;
  } else {
    btnState = HIGH;
  }
}

void setup()
{

  Serial.begin(115200);

  WiFi.begin(ssid, pass); 
  Blynk.config(auth, server, port);
  Blynk.connect();

  pinMode(ledPin, OUTPUT);
  pinMode(btnPin, INPUT_PULLUP);
  digitalWrite(ledPin, ledState);

  
  timer.setInterval(100L, checkPhysicalButton);
  WiFi.mode(WIFI_STA);
}

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("Starting reconnection timer in 10 seconds...");
    timer.setTimeout(10000L, []() {  // Lambda Reconnection Timer Function
      ReCnctFlag = 0;  // Reset reconnection Flag
      ReCnctCount++;  // Increment reconnection Counter
      Serial.print("Attempting reconnection #");
      Serial.println(ReCnctCount);
      Blynk.connect();  // Try to reconnect to the server
    });  // END Timer Function
  }
}

These are the current Things …

1 Like

1/ if you have V1 to V4 use only Blynk.syncAll() or Blynk.syncVirtual(V1, V2, V3, V4);, but not both together
2/ timer.setInterval(500L, checkPhysicalButton); is better
3/ Serial.println(“Starting reconnection timer in 30 seconds…”);
timer.setTimeout(30000L, {
is better

try and keep me informed.

Corrected Now

Sure.

But my question is the same program was working fine few months back and even now those devices are online. But why now now ? Has Blynk made any changes in the Lib ? or any changes in the ESP core ??

maybe ESP core…
you have an old version
try 2.5.0 beta 3, but don’t use 2.5.0 final version, it’s buggy 99% :smile:
anyway, you don’t need to test button every 100 ms that makes no sens.
and don’t try to reconnect every 10 sec, because of DHCP issues
BTW, it’s just my opinion :wink:

@Blynk_Coeur @PeteKnight
This is the reason i am using 2.4.2

1 Like

I’m using 2.5.0 beta3 with 2 nodeMCU since a few months.
it looks stable.
but @PeteKnight is right too .

ok i will install the same core and update you shortly !

1 Like

GPIO 7 and 8 are special reserved pins that shouldn’t be used.
See this topic:

Pete.

1 Like

@Blynk_Coeur
Tried this out. But no luck. It connects only after like 2 or 3 min . And works way too slow. While the app is showing online the and when i press the virtual button on the app the hardware does not react. I have an LED to check if it works. But it will take 20 sec to react. And goes offline after 1min.

@PeteKnight
Even with GPIO 4 and 5 … The problem still persists !!
I feel something is wrong in the software side…

weird ! :fearful:
do you have a nodemcu v3?

This is what i am using right now.

I’ll try your sketch, but GPIO7 and 8 doesn’t exist on nodemcu!
I’ll use GPIO2 for the onboard led and GPIO5 for the physical button

Okay ! Now let’s forget the GPIO . I just uploaded the basic Blynk Blink sketch ! Even this is not coming online. I tried the core that you said but no luck . So i reverted back to 2.4.2 .

Should i reset the server ? Actually i have a separate set of local server using rpi zero with a dlink router. When i try to connect on this , some how it connects. Now i am confused !! Even the connection seems to be stable.

I strongly feel that the router is throwing off the connection with ESP12E , and this is causing all the problems. But while saying this i also remember there are 2 NODEMCU running on the same router that is giving problems with the ESP12E!!! I am totally confused.

What do you guys suggest me to do now ?

1 Like