I have found this interesting board selling on Aliexpress website. It is an Arduino Mega 2650 with a built-in ESP8266 which allows the Mega to connect to wifi. This board has cut down a lot of wiring and bring out interesting possibilities. One of this is to connect up both the microcontrollers using ESP-link firmware. I have an earlier blog post that described how to wire up an ESP-01 and Arduino Pro Mini.
One of the tricky parts in this setup is the sequence of flashing the ESP firmware. Flashing the onboard ESP8266 requires some setting changes to the dip switches. The following are the sequences which I get both the microcontrollers to talk to each other.
Update: Thanks to Petr Sourek who found out how to connect this board to an external antenna. The schematic is as shown on the right. I need to remove "L2" from the board for the external antenna to be effective. With the external antenna, I have observed a 3-4 dB gained in the signal strength and connection to the router is quicker.
Update: I have created a touch control panel to control my smart home using this board and ESP-Link.
One of the tricky parts in this setup is the sequence of flashing the ESP firmware. Flashing the onboard ESP8266 requires some setting changes to the dip switches. The following are the sequences which I get both the microcontrollers to talk to each other.
- Set the jumper 5,6,7 to ON and the rest OFF. This will set the ESP to update mode.
- I am using version 3.0.14 and flashed the ESP using the following parameters:
- After flashing the ESP8266 set the jumper 1,2,3 & 4 to ON position and the rest OFF position. This is the bridge mode whereby ESP and Mega 2650 is communicating using Serial3 (RX3/TX3). Serial(RX0/TX0) is to be connected to the computer for sketch upload to Mega 2560 using USB.
- During the first setup, the ESP will be in AP mode and the IP is 192.168.4.1. Join into this network and go to the home page to setup the ESP WIFI to Station Mode to join your intended network.
esptool --port com26 --baud 230400 write_flash -fm dio -fs 4MB -ff 80m
0x0 boot_v1.6.bin 0x1000 user1.bin 0x3fc000 esp_init_data_default.bin 0x3fe000 blank.bin
Step 3 is an important step. If the dip switch is still set to "firmware update mode", the ESP-link firmware will not boot up. After step 3 and 4, the USB port now is connected to Mega 2560, the sketches at Mega can be uploaded using the Arduino IDE.
In the ESP-Link home page, the pin assignment is not used. Only the ESP TX0/RX0 is connected to Mega 2560. If you want to use the reset pin, you have to connect the ESP GPIO to Mega 2560 Reset pin manually.
I have created a simple sketch to read data from the APDS 9960 sensor and send the ambience and RGB light readings to MQTT. Please note that Serial3 is for communication between ESP and Mega2560. If the log is to appear at the ESP-link Web "Microcontroller Console", the code has to change to Serial3 for debugging. As of this writing, the Mega2560 is not able to update via OTA using the avr-link tool.
Update: I have created a touch control panel to control my smart home using this board and ESP-Link.
I have downloaded the Atmel flip but i dont know which device to select
ReplyDeleteMy apology as I have not used Atmel flip before to upload the sketches. The ESP-Link portion is uploaded using the instructions stated in blog post and the Mega2560 is using Arduino IDE.
Delete