This project implements a Modbus TCP server for the NORVI ENET AE-06-T, which is a USB Programmable Industrial ESP32 with OLED Display and din-rail mount [1].
Features:
- 4 outputs as Modbus holding registers (register 0 to 3, read/write)
- 8 inputs as Modbus input registers (register 0 to 7, read-only)
- 3 device buttons readable via Modbus input registers (register 8 to 10, read-only)
- Ethernet connectivity via integrated W5500 chipset
- Basic information shown on the OLED display (logs, IP, link status)
The idea behind this project is to use the NORVI ENET as a "dumb" translator of the IOs into the network and implement the control logic in easier to maintain controllers, like IOBroker or Node-RED.
In fact, with stability and maintenance in mind, the original intention was to build on one of the existing IoT projects for the ESP32, such as Tasmota, ESPEasy, and ESPHome. However, it quickly became clear that none of the projects were compatible with the W5500 Ethernet chip used in the NORVI ENET.
I also did some research to add Ethernet functionality using the W5500 chip at ESPHome [2], but without support from the ESPHome community, the implementation was technically and temporally out of scope.
So, in the end, implementing the functionality by hand without using an IoT platform was the best way to go.
61CEA change introduced to Server.h
in the Arduino Core for ESP32 breaks compatibility to certain libraries, including the eModbus used in this project. The current, ugly, workaround is to change line 28 of Server.h
from virtual void begin(uint16_t port=0) =0;
to virtual void begin() =0;
[3].
On my system, Server.h
is located at ~/.platformio/packages/framework-arduinoespressif32/cores/esp32/
.
Currently, only the wired Ethernet connection is used. Adapting src/main.cpp
to use WiFi.h
should be straight forward, though.
MAC address and IP configuration can be set in src/config.h
. Using DHCP should also be feasible, but has not been tested.
The display shows a boot image when starting the ESP32. In src/img/
is described how this can be replaced.
This project was initially based on https://github.com/PuceBaboon/ESP32_W5500_NTP_CLIENT.