Esp-01 + arduino uno

I have used esp - 01 to connect the blynk with Arduino UNO. It is getting connected , but it doesn’t work continuously. It lasts for 10 seconds and then the device became offline . Then after few seconds about 5 -10 seconds the device will be online and this process will be repeated.
In serial monitor

Login timeout
Ready( pingtime: 13ms)

This both will be repeated.
Sometimes in serial monitor, when I used the Serial.begin(9600)

Connecting to ***********"
Esp is not responding
If I use Serial.begin( 19200 )
STA mode is failed
MUX is failed

Any one help me to solve this problem. And suggest me your solution for continuous connection between blynk and esp - 01.

Your serial baud rate on the Arduino side has to match the baud rate of your ESP, which it sounds like it’s 9600 since you are having some success connecting to Blynk at that baud rate. It won’t work at all if you have the wrong baud rate.

The Blynk connection should be more reliable than your describing. It may be that you are too far away from your router and your loosing your network connection occasionally. It would also help if you post your code so others could tell if there is anything in there causing issues. Make sure your code is formatted correctly when you post it. There are instructions on this site. Also make sure you’re not using the “delay” Arduino function as it doesn’t play well with Blynk.

I have a similar setup running (Nano with esp-01 shield) and I was losing connections occasionally but it was after days not minutes. And it’s pretty far from my router. I ended up having to implement a watchdog timer to reset the arduino when this happens. I haven’t had to touch it to reset it since and it’s been running continuously for over a year now.

2 Likes

Where this code correct or what changes I have do?

#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[] = "YourAuthToken";

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

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(10,11); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

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

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);

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

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

I formatted your posted code for proper forum viewing, as required in the Welcome Topic… that you have read, correct? :wink:

Blynk - FTFC

Another document to double-check… that might help with troubleshooting your issue… and double check the power supply for the ESP-01… do NOT power it off of the Arduino, not enough current.

http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/arduino/esp8266-with-at-firmware