You can try this very simple code to see if the problem is still there.
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "***";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "***";
char pass[] = "***";
// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1
// Change to Serial3 (RX3/TX3 or 15/14 og Mega) if Serial1 is currently used for debugging
//#define EspSerial Serial3
// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
bool connectBlynk()
{
if (Blynk.connectWiFi(ssid, pass))
Serial.println("\nWiFi connected. Try Blynk");
int i = 0;
while ((i++ < 20) && !Blynk.connect())
{
BlynkDelay(500);
}
return Blynk.connected();
}
void setup()
{
// Debug console
Serial.begin(9600);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(100);
Blynk.config(wifi, auth);
// You can also specify server:
//Blynk.config(wifi, auth, "blynk-cloud.com");
//Blynk.config(wifi, auth, "192.168.1.100", 8080);
if (connectBlynk())
{
Serial.println("\nBlynk connected");
}
else
{
Serial.println("\nBlynk not connected");
}
}
void loop()
{
Blynk.run();
if (!Blynk.connected())
{
Serial.println("No Blynk connection. Trying to connect");
connectBlynk();
}
}
- If it’s OK, then there is some issue with your remaining code, such as auto reset something every 900s, bad pointers, etc…
// connected to something ???
int reset_pin=29;
void espreset() //TIMELY ESP RESET
{
digitalWrite (reset_pin,LOW) ;
delay(1000);
digitalWrite (reset_pin,HIGH) ;
//Blynk.begin(auth, wifi, ssid, pass);
connectBlynk();
}
...
void setup()
{
....
timer.setInterval(900000L, espreset);
...
}
- If the issue still persists, change to real WiFi router, mobile provider, or SIM, etc.
-
You can also change to
#define EspSerial Serial3
, certainly with moving the ESP-01 wires to new TX3/RX3 (14/15) pins as normally TX1/RX1 (18/19) might be used for Serial debugging. -
Putting more debugging messages to Serial port will help you to find out where to issue is.
-
Also find out and try different AT firmwares for ESP-01. Some might have bugs. But this is not an issue to discuss in this forum. You can do the research yourself.
Good luck.