[SOLVED] ESP8266 as a shield of Arduino MEGA not connecting to Blynk server. Please help!

I have an ESP8266 Sp-01 module (Original firmware version 1.1.1 , AT v0.25) connected to
Arduino MEGA to its Serial3 port. I have connected RX to TX and TX to RX pins of Mega and ESP. I used a bi-directional level shifter and 3.3 V power suplly for the ESP module. CH_PD is connected to 3.3 V with a 1k resistor and GPIO0 is connected to 3.3 V too with a 10 kOhm resistor. I am running the ESP8266 HardSerial example sketch. I get this when power up the arduino -

[19] Blynk v0.3.1
[520] Connecting to VDSNetwork
[1541] Failed to disable Echo

and the sketch is -

//#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 Serial3

ESP8266 wifi(EspSerial);

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

void setup()
{
  // Set console baud rate
   Serial.begin(9600);
   delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(115200);
  delay(10);

  Blynk.begin(auth, wifi, "VDSNetwork", "xxxxxxx");
}

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

The ESP module is working when I connect it with an USB to UART converter to the PC. It connects to my router. But connected to arduino it is not working. Please help !


Have you tried looking at tutorials online?

For example this one:

I’ve read this tutorial but it uses the ITEADLIB_Arduino_WeeESP8266-master library. Is it supported by Blynk v0.31 ? Also I’ll have to downgrade the firmware of my ESP to AT v0.22.

I think there is a 0.3.2 Blynk library out there, but I’m not sure where to find it, I seem to have misplaced my favorites…

I looked for it, but couldn’t find it. I’ll continue to search.

@Dmytro can probably tell you :slight_smile:

I found the Blynk 0.3.2 Beta library. I’ve unziped it into libraries folder, and I’ve uploaded the sketch again. The result is the same. Not connected to Blynk.

0.3.2 is not yet released. It has few things to be done before release. 0.3.2-beta should be ok.

What ESP8266 AT firmware version are you using?

I am using firmware AT version 0.25
And main firmware is 1.1.1

You should probably use a different version as noted in the example sketch…

Today I just powered up the arduino and it connected to blynk server. Now everything works fine.

where i can download the library for the header file ESP8266_HardSerial

@saichandu from https://github.com/blynkkk/blynk-library/releases/download/v0.3.1/Blynk_v0.3.1.zip in the BlynkESP8266_HardSer folder.

@Costas Thanks I download the new library and now no compile errors :slight_smile:
I tried to on and off the led on arduino mega(pin13) but no response from the arduino
nothing displayed on serial monitor.
How can i check whether my arduino & esp8266 is connected to the blynk server.
Is there any specific firmware version that to be used for esp8266 to connect with blynk ?.

@saichandu provide your sketch and format the sketch with the </> and I will see if I spot anything.

//#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 Serial3

ESP8266 wifi(EspSerial);

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

void setup()
{
  // Set console baud rate
   Serial.begin(9600);
   delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(115200);
  delay(10);

  Blynk.begin(auth, wifi, "MYWIFISSID", "PASSWORD");
}

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

I made connections as said above.
And in blynk app i have selected hardware model as Arduino Mega , added a button widget as following


That should just be fine and dandy. Does it give a message when you press the play button? E.g. something like Hardware Offline?

@saichandu sketch looks ok. I notice you show Serial3. Is the ESP wired to Serial3 on the Mega and is it wired up correctly?

Presumably you have your actual router SSID and password in the sketch rather than MYWIFISSID", “PASSWORD”? It’s just that you are showing your actual token in the sketch which should be more private than your router SSID and pwd i.e. we could control your Mega from here (not with the app but in other ways) whereas we don’t know where you live so knowing your SSID and pwd doesn’t really compromise your security.

I prefer to see XXXXX in real sketches for token, SSID and pwd and then I know the user has set them to something specific rather than MYWIFISSID", “PASSWORD” which will not work, unless of course they are the actual credentials you have on your router :smile:

Thanks for the advice I edited the post @Costas . In app it is showing your hardware is offline.
after changing the baudrate in serial monitor i got the following message
[19] Blynk v0.3.1
[520] Connecting to CHANDWiFi
[1530] Failed to disable Echo
@Lichtsignaal