As the brain of this project, I have selected an integrated board with ATmega2560 and ESP8266 chips. I chose the ESP8266 for its custom firmware support of ESP-link and the Arduino Mega 2560 due to its abundance of digital and analog pins, ram, and flash storage. I’ll cover the basic setup and installation process, but you can find a more detailed guide on Instructables as well. Using separate Arduino and ESP boards is also an option, just be sure to use a logic level converter as the ESP chip uses 3.3V signals while the ATMega is on 5V logic level. For more details check out the Newbie's Guide on Instructables on how to connect ESP8266 with Arduino. The particular choice of the board runs as many different brands, hosting the same physical layout with the ATmega 2560 and ESP8266 chips interconnected by an adjustable CH340G USB to serial adapter. The board can be powered straight from a Micro USB connector or from a 7-16V DC input.
The board has a Serial port selector toggle switch that changes the Serial port number the ESP8266 and Mega2560 chips are communicating on, RXD3/TXD3 setting uses Serial3 port and RXD0/TXD0 uses Serial.
I recommend using RXD3/TXD3 setting to separate the ESP-Arduino communication from the Arduino’s Serial output. Make sure the Arduino's physical output pins of Serial3 on 15 (RX3) and 14 (TX3) are not connected to anything when using the RXD3/TXD3 option, else the Arduino, and ESP will have trouble getting into sync.
To communicate with the Arduino or ESP chips you need the CH340G USB driver.
There are 8 DIP switches for the that control how the USB, Arduino and ESP components are interconnected:
1. USB to ESP8266 (upload firmware): This mode is used initially to flash the ESP-link firmware to the ESP chip. You need to press the Mode button on the board once before uploading new firmware. Future updates can be uploaded over the ESP-link web interface.
4.USB to Mega2560 over Serial, Mega2560 to ESP8266 over Serial 0or3: This is the state the board is usually in. It allows sketches to be uploaded to the ATmega2560 over USB and also interconnects the Mega2560 with the ESP chip over Serial or Serial3 port depending on the Serial port selector toggle switch position.
This step requires the USB selector DIP switches to be in position 1. USB to ESP8266 (upload firmware) and Mode button needs to be pressed once after the board is powered on.
You also need to download three things:
ESP-link firmware: Get the later release ( esp-link-v3.2.47-g9c6530d.tgz).
Flash Download Tools (ESP8266 & ESP32 & ESP32-S2): V3.8.8 or later.
Once you download the ESP-link firmware in a tgz file, extract it using 7-Zip. You should get a tar file after the extraction that needs to be further extracted. Finally, you should end up with some BIN files, we only need the user1.bin:
The rest of the BINs will be taken from the last NonOS based AT firmware for the ESP8266: V1.7.4
Extract the zip file and grab the following files:
Boot_v1.7.bin
Esp_init_data_default_v08.bin
blank.bin
Time to get the latest Flash Download Tools (ESP8266 & ESP32 & ESP32-S2): (V3.8.8 or later), extract it to the same location where the other bin files are.
Now that we have all the files needed in one folder it should look something like this:
Under flash_download_tools_v3.8.8 folder open flash_download_tools_v3.8.8.exe (Right-click - Run as administrator) and select the Developer Mode, then the ESP8266 DownloadTool option. The following window should greet you:
On the SPIDownload tab load the following 5 files using the … buttons, then specify the memory block number after the @ sign. Make sure the checkboxes are ticked in front of the filenames you loaded. If you are updating the ESP-link firmware you only needed to re-flash the User1.bin file. Similarly, if you are updating the AT firmware of the ESP chip, you only need to flash the Boot_vX.X and Esp_init_dat_default.bin files. If you need to clear the WiFi settings flash the blank.bin file as well.
Memory addresses for each file:
Boot_v1.7.bin @ 0x00000
User1.bin @ 0x01000
Esp_init_data_default_v08.bin @ 0x3fc000
Blank.bin @ 0x3fe000
Blank.bin @ 0x7e000
Make sure to select the correct CrystalFreq (26M), SPI speed (40Mhz), SPI Mode (QIO), flash size (32Mbit with the board shown above), Baud (115200), and SpiAutoSet checked and DoNotChgBin unchecked. COM port depends on the USB port used for connecting the board. In Windows you can check this under Control Panel - Device Manager - Ports(COM & LPT) - USB-SERIAL CH340 (COM X). In this case, the board was connected to the COM4 port:
When moving to a new firmware it's best to first fully erase the flash content using the ERASE button. Once the erase is ready use the START button and wait for the flashing to finish:
If all goes well the tool should display green FINISH in the download panel. Flick the CH340 mode selecting DIP switches to mode 4.USB to Mega2560 on Serial, Mega to ESP8266 on Serial 0or3, and reset/power cycle the board.
Congratulations, you are now on the latest ESP bootloader running the ESP-link firmware! Got stuck? Check the official ESP-link guide’s Initial serial flashing chapter for more details.
If after all this the ESP link’s initial WiFi hotspot does not show up, or at any later point the board becomes inaccessible, try erasing the ESP-link configuration and the WiFi setting by flashing the following files:
esp_init_data_default_v08.bin @ 0x3fc000
blank.bin @ 0x3fe000
blank.bin @ 0x7e000
Make sure the DIP switches are in 1.USB to ESP8266 (upload firmware) mode:
Once finished, flip the DIP switches back to:
Reset the board and wait for the ESP_XXXXXX hotspot to appear.
To be able to restart the Arduino using the Microcontroller Console`s Reset μC button you need to interconnect the GPIO12 pin of the ESP chip with the ATMega`s Reset pin. For this, you only need a single male to female jumper wire (also called Dupont Cable). As we are going to need a bunch of these cables in different lengths (10/20cm - 4/8 inch) it is best to buy them in bulk at once, I keep finding myself ordering more.
Jumper wires
10/20cm - 4/8 inch1 set / size (120cables/set):Male to maleMale to femaleFemale to femaleProceed to the ESP-link setup section to configure the ESP-link features required for the Gbox420 sketch.
NodeMCU flasher is a firmware programmer alternative to ESP8266 Download tool that you could use to upload the ESP-link firmware.
Advanced config :
Baudrate 115200
Flash size: 4MByte
Flash speed: 40MHz
SPI Mode: QIO
Memory addresses for each file:
Boot_v1.7.bin @ 0x00000
User1.bin @ 0x01000
Esp_init_data_default_v08.bin @ 0x3fc000
Blank.bin @ 0x3fe000
Blank.bin @ 0x7e000