Arduino MEGA 2560 With WiFi Built-in - ESP8266



Posted in TechnologyArduino

Introduction: Arduino MEGA 2560 With WiFi Built-in - ESP8266

About: Do you like technology? Follow my channel on Youtube and my Blog. In them I put videos every week of microcontrollers, arduinos, networks, among other subjects. New tutorials on Tuesdays and Fridays.

In today's text, we discuss an Arduino that I consider extremely special, as it has an ESP8266 embedded in its board. It doesn’t have the ESP12 soldered onto the board. Instead, it has the Espressif chip. So, on the board you have the built-in Tensilica chip with 4MB of memory, along with the ATmega2560, which is the traditional Arduino Mega.

Let’s move onto how this Arduino works, and let's do an assembly that shows when you should select ESP or Mega to perform a home automation. With this, we can turn lamps on and off, which is a mechanism that can be very useful for you to make improvements in your house.

Step 1: Physical Characteristics of the Board

I really like that this Arduino has a Pigtail connector for an antenna. Why is this good? If you connect an antenna on this device, you will have a huge benefit, as it will increase your reach, straight from 90 meters to 240 meters away. I came to this conclusion after a test I did, so I did not have to rely solely on the datasheet manual.

This board also has a selector switch that allows the ESP to interleave the connection between TX0 and TX3, remembering that the ATmega has four serials. A second selector switch is the DIP Switch, and we also have a key recording mode of the ESP8266. All the pinning is completely compatible with the ATmega pinout.

Step 2: Access to ESP8266 Pins

Here, I show the back of the board, where there is a table that displays access to the ESP pins.

Step 3: Comparing the Two Arduinos

Here, we have a comparison between the Mega Arduino with the integrated ESP (Arduino Mega RobotDyn) and the traditional Mega Arduino (Arduino Mega 2560). We can see that they are similar, but in the 2560, we have the USB printer, which is a large connector. However, in the RobotDyn, we have the mini-USB. I particularly like the more compact option, but the power is the same in both.

We can see, then, that the intention of the RobotDyn creaters was to maintain the architecture of the ATmega.

As we see in the table above, the ATmega has 32MB of memory, not counting the ESP memory. This is wonderful, since the traditional Mega Arduino has only 256kb of memory. The power in the RobotDyn is 7 to 12 volts, and the ESP8266 is already powered, and already has a voltage reducer. So, feeding the Arduino is already feeding the ESP, which is already down to 3v3, and internally that microcontroller is already 3v3.

The processors are the same, 16MHz, and one great advantage of these models is the high amount of IOs.

Step 4: Switch Status and Mode Selection

We have here the DIP Switch and a table with several positions. These help in the connections, depending on your objective. One essential detail is that if you are writing Flash in ESP, you have to be aware of addresses that are even slightly different.

In the image below, we zoomed in on the key that changes the serial port of the Arduino Mega. This connects to the ESP, and also in the key Mode, requiring that we must press the ESP8266 to record.

Step 5: AT Firmware Installation

If you want to use ESP8266 in AT mode, download the PDF file. You should now configure the card so that the ESP8266 is connected to the USB and in recording mode. To do this, set switches 5, 6, and 7 to ON (left) and all other switches to OFF (right).

If you want to use ESP8266 in AT mode, you should configure the Flash Download Tool as follows:

SPI Speed = 80MHz

SPI Mode = DIO

Flash Size = 32Mbit 4mb bytes x 8 bits = 32m bits

Crystal Freq = 26M





Step 6: Verifying AT Firmware

In this part, I used esptool.exe, which is a command tool that accesses the ESP8266 Flash and checks for some settings, such as the chip type and memory size.

Step 7: Example

In this example we show the hexadecimal addresses we use to write with the Flash Download Tool.

Also, for those who do not have much experience with the ESP8266, I suggest two of my previous videos: Recording in ESP01 and Introduction to ESP8266.

Step 8: Configure Arduino IDE Environment

To record the Arduino, there is no mystery at all. You only need to set up the Mega Arduino 2560 board as if it were a traditional Arduino.

Step 9: Arduino Mega With Relays Using Esp8266 Separate Board

We have here the assembly scheme that I perform in the video. We connected the Arduino Mega to the ESP01 and controlled two relays for one application.

Step 10: Arduino Mega With Built-in Esp8266

Here, we do the same thing mentioned above, but while using the Arduino Mega with integrated ESP. One tip is that you watch the video entitled Residential Automation with Arduino Mega and ESP8266 for more details about this subject.



    • Woodworking Contest

      Woodworking Contest
    • Make it Move Contest

      Make it Move Contest
    • Microcontroller Contest

      Microcontroller Contest

    We have a be nice policy.
    Please be positive and constructive.