D

DIY Electronics

— Building circuits, programming microcontrollers, and making things blink
49 members Created Jun 2026

My ESP32 soil sensor runs 8 months on a single 18650

Modbus RTU with ESP32 over RS-485

Modbus RTU is the industrial standard that never dies. I added Modbus support to an ESP32 project to communicate with a commercial variable-frequency drive.

RS-485 requires a differential transceiver IC. The MAX485 is the classic choice — cheap, widely available, operates at 3.3V. The DE and RE pins control transmit/receive direction and must be driven in sync with the UART TX and RX activity. A small GPIO controls direction switching.

The modding protocol: Modbus RTU uses CRC-16/IBM for frame integrity. The Arduino Modbus library handles framing. For the ESP32, using the hardware UART (not SoftwareSerial) is essential at 38400 baud — the inter-frame gap timing of 3.5 character times is tight and software UART can't guarantee it.

5

Report thread

Why are you reporting this thread?

Restore the redacted content?

This will make it visible to everyone again. The clear action is logged in the mod log.