
ESP32 Modbus RTU Communication Using RS-485
Implement industrial Modbus RTU communication using ESP32 and RS-485 for reliable data exchange between sensors, PLCs, and controllers.
Inclusive of all taxes
- Secure payments via Razorpay
- 7-day returns on defective items
- GST invoice on every order
Free delivery on orders above ₹2,000
Delivers in 4-7 business days
Check delivery at your pincode
₹1757.00
Inclusive of all taxes
Components
6 items
Difficulty
Advanced
Build Time
4-6 hours
Project Details
How It Works
The project uses ESP32 as a Modbus Master (or Slave) communicating over RS-485. The ESP32's UART2 (pins 16 and 17) connects to a MAX485 RS-485 transceiver. GPIO 4 controls the DE/RE pins for half-duplex communication. The ModbusMaster library handles protocol implementation, allowing reading/writing of Modbus registers. The system sends requests to slave devices (like energy meters or PLCs) and processes responses. RS-485's differential signaling provides noise immunity for industrial environments.
Prerequisites
Basic knowledge of ESP32 programming, understanding of serial communication protocols, familiarity with Arduino IDE, and basic electronics concepts. Experience with industrial automation concepts is helpful but not required.
What You'll Learn
Understanding the Modbus RTU industrial communication protocol
Learning RS-485 half-duplex transmission and data exchange
Connecting ESP32 to RS-485 transceivers and bus wiring
Reading and writing Modbus registers for sensor/PLC data
Integrating ESP32 into SCADA and industrial automation systems
Key Features
Robust Modbus RTU protocol for reliable data exchange in harsh environments
RS-485 supports up to 1200 meters with noise immunity
Can communicate with up to 32 devices on a single bus
Compatible with PLCs, HMIs, and SCADA systems for industrial automation
ESP32 can act as Modbus Master or Slave for flexible deployment
What's Included in the Kit

| Component | Qty | Price |
|---|---|---|
![]() | 1 | ₹0.00 |
![]() | 1 | ₹295.00 |
![]() | 1 | ₹171.00 |
![]() | 1 | ₹1.00 |
![]() | 1 | ₹0.00 |
![]() | 1 | ₹110.00 |
Operating Instructions
Pin Connections
| MCU Pin | Connected To | Purpose | Notes |
|---|---|---|---|
| GPIO 16 (RX2) | RS-485 Module RO | Receive data from RS-485 bus | Half-duplex communication |
| GPIO 17 (TX2) | RS-485 Module DI | Transmit data to RS-485 bus | Half-duplex communication |
| GPIO 4 | RS-485 Module DE/RE | Driver Enable/Receiver Enable control | Mandatory for half-duplex RS-485 |
| 5V | RS-485 Module VCC | Power supply for RS-485 module | Ensure stable 5V supply |
| GND | RS-485 Module GND | Common ground reference | Essential for proper communication |
| RS-485 Bus A | RS-485 Bus A | Positive differential signal line | Connect all devices in parallel |
| RS-485 Bus B | RS-485 Bus B | Negative differential signal line | Connect all devices in parallel |
| 120Ω Resistor | Between A and B at both ends | Termination resistor for signal integrity | Recommended for long cables or high speeds |
Tools Required
Safety Precautions
Electrical
- ⚠Power OFF while wiring to avoid short circuits
- ⚠Use proper grounding to prevent noise and interference
- ⚠Ensure stable power supply to avoid ESP32 damage
Handling
- ⚠Avoid long unshielded cables in industrial environments
- ⚠Use twisted pair cables for RS-485 to reduce noise
- ⚠Follow industrial wiring standards for safety
Operating
- ⚠Use termination resistors (120Ω) for long cable runs
- ⚠Match baud rates between master and slave devices
- ⚠Ensure correct DE/RE control for half-duplex operation
Frequently Asked Questions
Q:Can ESP32 act as Modbus Slave?
Q:What is the maximum cable length for RS-485?
Q:Can multiple devices connect to the same RS-485 bus?
Q:Is Modbus TCP also possible with ESP32?
Product images are for illustration purposes only. Actual products may differ in appearance, packaging, or specifications. See our Terms of Service.







