Esp8266 won't connect to server anymore

blynk server 0.36.4
lib: 0.5.2
android S8, 2.24.0

strange issue, one of my ESPs (wemos d1) disconnected at one point and never reconnected to the server. Ater several reboots (also router and server) reflash it still does not want to connect to server.

Note that it DOES connect to wifi, I can find it online but it won’t connect to the blynk (local) server.
Server currently has a total of 11 esps connected, they all work and connect, one just ‘gave up’ and won’t connect anymore.

I’ve tried two routines:

  Serial.begin(9600);
  Serial.println("Booting");
  WiFi.setOutputPower(WIFIPOWER);
  Serial.println("Blynk Begin");
  Blynk.begin(auth, ssid, password, server, port);
  Serial.println("Starting Blynk connection");
  Serial.println("Blynk connect");
  while (Blynk.connect() == false) {  }  // Wait until connected

which gives as last terminal output

Blynk begin

and I’ve tried

  Serial.begin(9600);
  Serial.println("Booting");
  WiFi.setOutputPower(WIFIPOWER);
  Serial.println("Blynk Begin");
  WiFi.begin(ssid, password); 
  Serial.println("Blynk config");
  Blynk.config(auth, server, port);
  Serial.println("Blynk connect");
  Blynk.connect();

which actually makes it all through, but again no connection to the blynk server is ever made and I also have these two routines:

in setup

  timer.setInterval(TIME_RECONNECT_CHECK, reconnectBlynk);  // check every minute if still connected to server

with


void reconnectBlynk() {
  if (!Blynk.connected()) {
    Serial.println("Lost connection");
    if(Blynk.connect()) {
      Serial.println("Reconnected");
    }
    else {
      Serial.println("Not reconnected");
    }
  }
}

and after a minute I get the ‘lost connection’ (which in this case means: ‘never connected in the first place’) and ‘not reconnected’.

I’ve also refreshed the auth-token but same issue.

any clues, suggestions?

1 Like

@wolph42

try a basic code to make your esp a wifi AP.

ill give that a shot.

1 Like

today I got the same issue with one of my nodemcu.
I load a WiFi AP code.
now it runs again with blynk.
don’t know what happened.
:joy::joy:

you’re right, did exactly the same thing and…it works again?!?

in case someone else runs into this issue, here’s the code:

#include <ESP8266WiFi.h>

void setup()
{
  Serial.begin(115200);
  Serial.println();

  Serial.print("Setting soft-AP ... ");
  boolean result = WiFi.softAP("ESPsoftAP_01", "pass-to-soft-AP");
  if(result == true)
  {
    Serial.println("Ready");
  }
  else
  {
    Serial.println("Failed!");
  }
}

void loop()
{
  Serial.printf("Stations connected = %d\n", WiFi.softAPgetStationNum());
  delay(3000);
}

and the link: http://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/soft-access-point-examples.html

just upload, connect with phone and then flash it with blynk code.

really weird this.

I use this code and everything goes well !
don’t know why
the only thing I remember is that I was trying to update my code with OTA, I think this corrupted something…

#include <ESP8266WiFi.h>

const char* ssid="SSID";
const char* password = "PHRASE";

int ledPin = 13;

void setup() {
  
  pinMode(ledPin,OUTPUT);
  digitalWrite(ledPin,LOW);

  Serial.begin(115200);
  Serial.println();
  Serial.print("Wifi connecting to ");
  Serial.println( ssid );

  WiFi.begin(ssid,password);

  Serial.println();
  Serial.print("Connecting");

  while( WiFi.status() != WL_CONNECTED ){
      delay(500);
      Serial.print(".");        
  }

  digitalWrite( ledPin , HIGH);
  Serial.println();

  Serial.println("Wifi Connected Success!");
  Serial.print("NodeMCU IP Address : ");
  Serial.println(WiFi.localIP() );

}

void loop() {
  // put your main code here, to run repeatedly:

}

maybe @Gunner know ?

I’m just connecting the nodeMCU I used before, and … I get the same issue !

So,I suspect …
… MAC adress
to be continue …

In the week so I think I recall noticing a few of my bench projects disconnecting/reconnecting… of course I have everything with auto reconnection routines, so only notice it if I see it actually mid process.

It might have been something with all the latest server updates?? Seems stable now with server-0.37.2-java8.jar and Library v0.5.3

And I see there is an even newer server … just updating it now… :stuck_out_tongue:

yes gunner,

I have that release , and nothing change.
I just swapped with the nodeMCU I used this morning, now it can’t connect!

latest everything (just checked) and wemos D1. I can’t check anymore however cause the issue is fixed

I wonder if we have to renew the DHCP lease before the lease time expires.
may be the solution …
I’ll try that !
:wink:

I thought it was automatically renewed when both esp and router were reset? (which I did, but to no avail).

I said that, cause this morning, instead of reload AP code, I reset nodeMCU and unplug VCC for 2 min, and after reboot, all goes fine !!

good to keep in mind, ill give that a shot next time.