Communication between ESP8266 and Arduino

I have to say that you’ve chosen an awful board to use!

I don’t have any personal experience of them (thankfully!) but they are really the worst of both worlds when it comes to using them with Blynk.

The board is primary an AT Mega with an ESP866 connected to hardware serial port COM3 and is the equivalent f these two separate components - a Mega and an ESP-01.
The obvious advantage is that the board overcomes all the messy wiring needed to connect these two boards together.
The problem is that when you’re using a regular Mega + ESP-01 setup with Blynk, the ESP-01 needs to act as a WiFi Modem, and to do this needs to be running the factory “AT” firmware. The sketch is then uploaded to the Mega, not the ESP-01.

The not so obvious disadvantage of your board is that it is very easy to do what you’ve done and put the device into “CH340 connect to ESP8266 (upload sketch)” mode and upload a sketch to the ESP-01. This immediately overwrites the factory AT firmware and prevents the regular Mega + ESP-01 approach from being used.

You can restore the AT firmware, but it’s a tricky process, as you can’t do it via the Arduino IDE.

If you want to run the device in the configuration you’ve adopted then you’ll need two sketches, one running on the ESP-01 to talk to Blynk (and to the Mega) and one on the Mega to control your peripheral devices and talk to the ESP-01.
The advantage of that is the ESP-01 is the more powerful and faster device and because it has native WiFi capabilities you can use some commands that aren’t available when using the Mega + ESP-01 using AT commands for the WiFi connection.

The bottom line is that, unless you need the Mega form-factor to interface with other hardware shields, you’d be far better ditching this board and using either a NodeMCU or ESP32 - depending on how many, and what type of GPIOs you need.

More info on the use of an ESP-01 as a WiFi modem for an Uno/Mega here…

More info on why a NodeMCU type board is preferable, and what its restrictions are here…

Pete.

2 Likes