arduino-mega-esp8266-en-un-unico-dispositivo

Arduino Mega + ESP8266 in a single device

  • 3 min

Today we are going to look at an interesting device, a Mega R3 ATmega2560 and WiFi ESP8266 with 32Mb memory, on a single development board.

The ESP8266 is one of the most popular processors and the simplest option to get WiFi connectivity in our projects. Since its appearance, both it and its bigger brother the ESP32 have gained great popularity.

The ESP8266 includes an 80Mhz processor and 4MB of Flash. However, its biggest flaw is the scarcity of pins. If we consider those that are not usable because they are committed to other uses, we are left with only 5 pins really available to use.

In contrast, the Mega has a huge number of pins, providing 54 GPIOs, 16 analog inputs, 14 PWM outputs, 4 UARTs, and 256kB of memory.

Having these two MCUs on the same board allows us to have available the large number of pins provided by an Arduino Mega, along with the WiFi connectivity and processing power of the ESP8266.

arduino-mega-esp8266-view

On this board, both processors can work together or separately. They can communicate with each other or with the USB. For this, they have the CH340G USB to serial converter on board.

Configuring the UART communication of both processors is very simple. For this, there are some DIPs and a switch integrated on the board, according to the following table.

Connection1234567
ATmega2560 <-> ESP8266ONONOFFOFFOFFOFFOFF
USB <-> ATmega2560OFFOFFONONOFFOFFOFF
USB <-> ESP8266 (Update firmware)OFFOFFOFFOFFONONON
USB <-> ESP8266 (Communication)OFFOFFOFFOFFONONOFF
All independentOFFOFFOFFOFFOFFOFFOFF

Plus, an additional mode involving a switch on the board.

Connection1234567Switch2
USB <-> ATmega2560 <-> ESP8266ONONONONOFFOFFOFFA RXD3 / TXD3

In conclusion, a very interesting board that allows us to combine the best of both worlds, and which we can find from eBay or AliExpress sellers for about 11€.