Program Arduino UNO Remotely via WiFi with DT-06 ESP-Link Firmware
In the realm of embedded systems and IoT (Internet of Things), the ability to update and manage devices remotely has become increasingly crucial.
Many of you appreciated our article on the remote connection of an Arduino UNO inside the freezer 😛 (“Arduino Remote/wireless Programming“), which provided a detailed guide on how to transmit a sketch to an Arduino using HC-05 Bluetooth modules, we are going to upgrade and extend that article with the use of WiFi and thanks to DT-06 that is fully compatible with HC-06.
Unfortunately, the DT-06 original firmware does not allow programming Arduino, so we are going to use the ESP-Link firmware, designed for ESP8266 modules, which acts as a bridge between WiFi and serial communication. When combined with devices like the DT-06, this firmware can transform the way we interact with popular boards like the Arduino UNO.
WiFi Module
Before we delve into the nitty-gritty of flashing firmware and setting up remote debugging, let’s take a moment to look at the devices at the heart of this article:
ESP8285 (DT-06)
TTL-WiFi DT-06 is designed and developed based on the ESP-M2 WiFi module from Shenzhen Doctors of Intelligence & Technology Co., Ltd. It can realize transparent transmission of the data to the cloud in real-time, together with low-power control and status indicators.
The real value is the compact size and low power, very adaptable to a lot of situations. It comes with a proprietary firmware that offers a limiting set of features, so first, we look at that (and we upload the last bug-fixed version), but next, we upgrade that module with ESP-LINK, a powerful software solution.
Here the device DT-06
You can find more information in the relative article “DOIT DT-06: high-resolution pinout and specs”.
DT-06 upload ESP-LINK firmware
You can retrieve the latest version of ESP-LINK firmware from here. After the download, uncompress It, and download the Flash Download Tool from Espressif.
Flash with the latest DOIT firmware
Here the USB to TTL converter USB to TTL CH340G - USB to TTL FT232RL
- First of all, download the ESP-LINK firmware and uncompress It.
In the firmware folder, you can find these files
File description
boot_v1.6.bin
Description: This is the bootloader file responsible for initializing the hardware and loading the main firmware. It is the first code that runs when the device starts up. The version number (v1.7 in this case) indicates the bootloader’s version.
user1.bin
Description: This is the main application firmware containing the compiled source code and assets required for the device’s specific functions. It gets loaded by the bootloader and takes over the main operation of the device. The “user1” designation generally indicates that this is the primary application space; in some configurations, a “user2.bin” could also exist for backup or alternate firmware.
esp_init_data_default.bin
Description: This file contains default initialization data for the ESP device. It is typically used to set default system configurations, including settings for the RF module, Wi-Fi parameters, and other hardware-related values.
blank.bin
Description: This file is usually filled with empty (zero) data and is used to clear or reset specific sectors of the flash memory. This is useful when upgrading firmware or when you need to ensure that no residual data remains in these memory areas.
- Download the Flash Download Tool from Espressif.
- Wiring the DT-06 to an FTDI USB like so:
Or with an external power supply like so:
With the Flash download tool, it’s quite simple. When you start Flash Download Tool, you must select esp8266 and then start to configure It.
Addresses of 32mbit Flash Memory (4MB)
Devices like NodeMCU, WeMos D1 mini, and others use these settings.
Address | File Name | Size (MB) |
---|---|---|
0x00000 | boot_v1.6.bin | 0.5 |
0x01000 | user1.bin | 3.5 |
0x3FC000 | esp_init_data_default.bin | 0.1 |
0x3FE000 | blank.bin | 0.1 |
Here is an example of an
upload with esptool.py
:
esptool.py --port /dev/ttyUSB0 --baud 230400 write_flash -fs 32m -ff 80m \
0x00000 boot_v1.6.bin 0x1000 user1.bin \
0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
Addresses of 16mbit Flash Memory (2MB)
Some devices, like the updated DT-06, can use these settings.
Address | File Name | Size (MB) |
---|---|---|
0x00000 | boot_v1.6.bin | 0.5 |
0x01000 | user1.bin | 1.8 |
0x1FC000 | esp_init_data_default.bin | 0.1 |
0x1FE000 | blank.bin | 0.1 |
Addresses of 8mbit Flash Memory (1MB)
ESP-01S and major versions of DT-06 use these settings.
Address | File Name | Size (MB) |
---|---|---|
0x00000 | boot_v1.6.bin | 0.5 |
0x01000 | user1.bin | 0.9 |
0xFC000 | esp_init_data_default.bin | 0.1 |
0xFE000 | blank.bin | 0.1 |
Addresses of 4mbit Flash Memory (512Kb)
Original DT-06, ESP-01, and other little devices need these settings.
Address | File Name | Size (MB) |
---|---|---|
0x00000 | boot_v1.6.bin | 0.5 |
0x01000 | user1.bin | 0.4 |
0x7C000 | esp_init_data_default.bin | 0.1 |
0x7E000 | blank.bin | 0.1 |
FTDI Rx is connected to Tx of DT-06 and Tx to Rx, and I added all the addresses table because I have two devices, and one needs the second configuration and the other the third. So, if you have some trouble after flashing the device, retry with a different address configuration.
- Now start the Flash Download Tool and open the firmware file; the writing start address is
0x0
.
- Put the DT-06 in download mode by following these steps:
- Hold down the Boot button;
- Press and release the Reset button;
- Release the Boot button.
- Click on ERASE.
- Click on the start button.
- Reboot the device.
ESP-LINK configuration
Setting up the ESP-Link firmware on the ESP8266 module is a straightforward process, but for those unfamiliar, it can seem daunting. The firmware provides a user-friendly interface to configure the ESP8266, turning it into a versatile WiFi bridge. The following step-by-step guide, accompanied by screenshots for each phase, aims to simplify this process, ensuring a smooth and error-free setup for users of all levels of expertise.
Connecting to ESP Network
In this screenshot, you can see a list of available WiFi networks on a device. Prominently displayed is the ESP_XXXXXX network. This represents the Access Point (AP) mode of the ESP8266, which becomes active after the installation of the esp-link firmware. The user is advised to select this specific network to initiate the configuration process.
Main ESP-Link Page
Upon accessing the IP 192.168.4.1, the screenshot displays the main interface of the esp-link page. The central portion of the screen shows the current WiFi state. At the top, there’s a noticeable message stating that the device cannot perform scanning while in AP mode. This message serves as a reminder of the device’s current operational mode.
Navigating to WiFi Station Settings
This screenshot showcases the main esp-link page but with an expanded left-side menu. Among the various options, the WiFi station link is highlighted, indicating that the user has clicked or is about to click on it to access the WiFi station settings.
Switching to STA+AP Mode
The focus of this screenshot is the WiFi Station configuration interface. A prominent link labeled Switch to STA+AP mode is displayed. This option allows users to enable both the Station (STA) and Access Point (AP) modes simultaneously. The user is prompted to click this link to proceed.
Selecting a WiFi Network
In this phase, the screenshot reveals a list of available WiFi networks within the WiFi Station configuration screen. Users are guided to select their preferred network from this list. Adjacent to each network name is a field to input the network’s password. After entering the password, there’s a connect button to establish the connection.
Returning to the Main Page with DHCP IP
After connecting to a WiFi network, the screenshot returns the user to the main esp-link page at 192.168.4.1. The AP mode remains active, but now there’s an additional piece of information: the IP address assigned by the DHCP server. This IP is crucial for subsequent steps.
WiFi Station Screen with Connection Guidance
This screenshot of the WiFi Station screen provides users with clear instructions. A message informs users that if their device is on the same network, they should navigate directly to the IP address provided by the DHCP. If not, the first step is to connect to the network with the specified SSID.
Setting a Static IP
The final screenshot guides users on setting a static IP for their device. After connecting via the DHCP-assigned IP and accessing the WiFi station settings, users can scroll down to find an option to set a static IP. This feature ensures the device will always have the same IP address, making it easier to connect in the future.
Pin assignment
Now, the most important config is to put tell to the firmware to manage the fifth pin as the resetting pin needed to remote program the devices. As you can see in the pinout the only pin you can use is GPIO4.
Wiring Arduino for remote programming
As specified, with respect to debugging, we need an additional pin for programming, and It must be connected to the Reset pin of Arduino UNO.
Remember that Arduino has 5v logic and DT-06 3.3v, so for long-running communication, it is preferable to add a logic-level converter. If you remember, in Debug, you need only a voltage divider from Tx to Rx, but here you have Reset also.
Create a virtual COM port
Now, we have an interface that communicates via WiFi to our device, but how do we connect to It? A versatile and beautiful system is to generate a virtual COM port.
One of the most used programs is “HW VSP3 – Virtual Serial Port”, you can download from this page, download the single one because the multi is a payment product.
After downloading, install It.
Click the Login
button and write admin as password.
You need to retrieve all the parameters from the ESP-LINK web interface.
In the Virtual Serial Port tab, choose the COM port number and insert the IP address and port 23. After that, click the button Create COM
.
Wait a moment; if It’s okay in the Device Manager, you can find your new Port.
Debug and upload the code
Now, if we connect our Arduino IDE to the Serial COM port 25, we can transmit and receive the Serial via WiFi.
Now we can try to upload, and finally, here is the result.
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\renzo\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM25
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.21s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\renzo\AppData\Local\Temp\arduino\sketches\B3D8EDADAC2319C86E5C9AEF5B5AB344/sketch_oct2a.ino.hex"
avrdude: writing flash (2052 bytes):
Writing | ################################################## | 100% 7.80s
avrdude: 2052 bytes of flash written
avrdude done. Thank you.
Thanks
- Arduino Remote/wireless Programming
- BMP280, DHT11 and DHT22, DHT12, Dallas Temperature ds18b20, Thermistor
- ATtiny Programmer Board (ArduinoUNO As ISP)
- Send email with esp8266 and Arduino (Library v1.x)
- How to use SD card with esp8266 and Arduino
- Ebyte LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and new Arduino shield
- Manage JSON file with Arduino, esp32 and esp8266
- How to interface Arduino, esp8266 or esp32 to RS-485
- Send emails with attachments (v2.x library): Arduino Ethernet
- WebSocket
- Arduino AVR: compiled binary (.hex) from command line and GUI tool
- Arduino: fast external SPI Flash memory
- GY-291 ADXL345 i2c spi accelerometer with interrupt for esp32, esp8266, stm32 and Arduino
- i2c Arduino: how to create network, parameters and address scanner
- GY-273 QMC5883L clone HMC5883L magnetometer for Arduino, esp8266 and esp32
- WiFi remote debugging of an Arduino with DT-06
- Program Arduino UNO Remotely via WiFi with DT-06 ESP-Link Firmware
- Introduction to Remote Programming of Arduino UNO via WiFi with ESP8266