Skip to content
Graham Ross edited this page Oct 18, 2022 · 6 revisions

The ESP32 ModbusAdapter will access data from your classic over the serial Modbus RTU interface and make it available to a Modbus TCP master over WIFI.

Flashing the ESP32 ModbusAdapter from a Windows 10 PC

Connect your ESP32 device to a USB port on your PC.

Download firmware.zip from https://github.com/ClassicDIY/ModbusAdapter/releases and extract the content.

go to the extracted folder in your download folder and run flasher.exe.

Press the !Flash button to start the flashing process.

You may have to press the 'Boot' button on your ESP32 device to initiate the flashing process (this may not be required on some dev boards).

Press Setup WIFI and enter your wifi SSID and password

The flasher tool will launch your default browser with the ModbusAdapter home page.

Click on 'configure page' and sign in using Username: admin and Password: ModbusAdapter

Set the AP password (can re-use ModbusAdapter)

Enter your classic's TCP port, Modbus address and Baud Rate (usually 502, 10, 19200)

Hit Apply and reset your device.

Programming the ESP32 ModbusAdapter

Once you download extract the ZIP file for this project the code for the ESP32 implementation is available in the ModbusAdapter-master\Code\ESP32 folder.

This project uses Visual Studio CODE with the PlatformIO extension. Here is a video tutorial for the VSCode & PlatformIO setup; PlatformIO for ESP32 Tutorial

Once setup with the PlatformIO extension, use File->Open Folder to open the project selecting the ModbusAdapter-master\Code\ESP32 folder.

The Log level can be set in the platform.ini file by setting APP_LOG_LEVEL to one of the following;

  • #define ARDUHAL_LOG_LEVEL_NONE (0)
  • #define ARDUHAL_LOG_LEVEL_ERROR (1)
  • #define ARDUHAL_LOG_LEVEL_WARN (2)
  • #define ARDUHAL_LOG_LEVEL_INFO (3)
  • #define ARDUHAL_LOG_LEVEL_DEBUG (4)
  • #define ARDUHAL_LOG_LEVEL_VERBOSE (5)