RS-485 Modbus sensor network with a mini SCADA
Factories connect sensors and meters on RS-485 Modbus and watch them on SCADA screens, yet most students never wire one. A small network of field nodes polled by a master and shown on a dashboard teaches industrial communication.
- Parts
- ₹2,430
- Build
- 14 weeks
- Board
- ESP32
- Objectives
- 5
Block diagram
- Two field nodes (Nano)Read temperature and a 4 to 20 mA style signal
- RS-485 transceiversCarry Modbus over twisted pair
- ESP32 masterPolls each node
- SCADA dashboardShows, trends and alarms
- Relay outputRemote control of a pump or fan
- Cloud dashboardStores readings, plots trends and sends alerts+
Objectives
- To build two Modbus-RTU slave nodes with holding and input registers.
- To poll them from an ESP32 master at 9600 baud and handle timeouts and CRC errors.
- To show live values, trends and alarms on a dashboard and write set points back.
- To measure error rate over 20 m of cable with and without termination.
- To publish readings over MQTT and show them on a live dashboard with threshold alerts.
Parts and specifications
- ESP32 DevKit V1Dual-core 240 MHz, 520 KB SRAM, Wi-Fi + Bluetooth, 3.3 V logic, 12-bit ADC (use ADC1 pins when Wi-Fi is on)₹450Buy
- Arduino Nano (CH340, Type-C)ATmega328P 16 MHz, 5 V logic, 8 analog inputs, small enough for wearables and helmets₹700Buy
- DHT22 temperature and humidity sensor−40 to 80 °C ±0.5 °C, 0 to 100% RH ±2%, one reading every 2 s, single-wire₹500Buy
- × 210 kΩ potentiometer (simulated process value)₹30
- 5 V relay module (1 channel)10 A 250 V AC contacts, coil 70 to 80 mA, optocoupled input; many trigger at 3.3 V, check yours₹70Buy
- Twisted pair cable 20 m and 120 Ω terminators₹200
- × 25 V adapters₹300
Total about ₹2,430 at typical online prices. Tap a part for its pinout and datasheet notes.
Design calculations
At 9600 baud one byte (11 bits) = 1.15 ms. A read of 4 registers: request 8 bytes + response 13 bytes = 21 × 1.15 ≈ 24 ms, plus the 3.5-character gap (4 ms) each way.
Two slaves × (24 + 8 + 50 ms reply delay) ≈ 165 ms, so a 1 s scan rate is easy.
Modbus uses CRC-16 with polynomial 0xA001 (reflected 0x8005), sent low byte first; any bit error is caught.
Store temperature as an integer × 10 in a 16-bit register: 27.3 °C → 273.
Pin map
| Signal | Pin or connection |
|---|---|
| ESP32 UART2 TX / RX | GPIO 17 / 16 → MAX485 DI / RO |
| ESP32 DE+RE | GPIO 4 |
| Each Nano: TX / RX / DE+RE | D1 / D0 via SoftwareSerial D10 / D11, D2 |
| Nano DHT22 / pot / relay | D4 / A0 / D7 |
| Bus | A and B twisted pair, 120 Ω at both ends, common ground |
Firmware outline
- Slaves: map input registers 30001 = temperature × 10, 30002 = humidity × 10, 30003 = pot (0 to 1000); coil 00001 = relay.
- Master: every second read input registers 30001 to 30003 from slave 1, then slave 2 (function 04).
- Handle timeouts (300 ms) and CRC errors; count them per slave.
- Write coil (function 05) when the dashboard toggles a relay.
- Publish values to MQTT; Node-RED dashboard shows gauges, a trend and alarms.
Test plan
| Test | Expected result |
|---|---|
| Both slaves on 20 m cable | Values update every second |
| Termination removed | Error count compared |
| One slave unplugged | Timeout alarm, other slave still read |
| Relay toggled from dashboard | Relay switches within 1 s |
These rows start your results table when you plan the project.
Viva practice
Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.
Make it yours
One or two upgrades for a mini project, two to four for a major one.
Datasheets and sources to cite
- Modbus over serial line specification v1.02
- TI application report SLLA272: RS-485 design guide
- IEC 61131 overview
About this project
How much does the rs-485 modbus sensor network with a mini scada project cost?
About ₹2,430 for the parts in the base list: ESP32 DevKit V1, Arduino Nano (CH340, Type-C) × 2, RS485 to TTL module (MAX485) × 3, DHT22 temperature and humidity sensor × 2, 10 kΩ potentiometer (simulated process value) × 2, 5 V relay module (1 channel), Twisted pair cable 20 m and 120 Ω terminators, 5 V adapters × 2.
How long does it take?
About 12 weeks for the base project, built on an ESP32. Each upgrade adds time.
Which branches is it suitable for?
Instrumentation, Electrical and Electronics, Electronics and Communication, as a major project.
Which pins and design calculations does it use?
ESP32 UART2 TX / RX on GPIO 17 / 16 → MAX485 DI / RO; ESP32 DE+RE on GPIO 4; Each Nano: TX / RX / DE+RE on D1 / D0 via SoftwareSerial D10 / D11, D2. Worked calculations on this page: frame time, poll cycle, crc-16, scaling.
How do I test it?
Both slaves on 20 m cable: Values update every second. Termination removed: Error count compared. One slave unplugged: Timeout alarm, other slave still read. Relay toggled from dashboard: Relay switches within 1 s.
What are the objectives?
To build two Modbus-RTU slave nodes with holding and input registers. To poll them from an ESP32 master at 9600 baud and handle timeouts and CRC errors. To show live values, trends and alarms on a dashboard and write set points back. To measure error rate over 20 m of cable with and without termination.
