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.

ESP32Major projectEIE, EEE, ECE
ESP32NANORS485ONFeatured
Parts
₹2,430
Build
14 weeks
Board
ESP32
Objectives
5

Block diagram

Inputs
  • NANO
    Two field nodes (Nano)Read temperature and a 4 to 20 mA style signal
  • RS485
    RS-485 transceiversCarry Modbus over twisted pair
Controller
  • ESP32
    ESP32 masterPolls each node
Outputs
  • SCADA
    SCADA dashboardShows, trends and alarms
  • ON
    Relay outputRemote control of a pump or fan
  • CLOUD
    Cloud dashboardStores readings, plots trends and sends alerts+

Objectives

  1. To build two Modbus-RTU slave nodes with holding and input registers.
  2. To poll them from an ESP32 master at 9600 baud and handle timeouts and CRC errors.
  3. To show live values, trends and alarms on a dashboard and write set points back.
  4. To measure error rate over 20 m of cable with and without termination.
  5. To publish readings over MQTT and show them on a live dashboard with threshold alerts.

Parts and specifications

Total about ₹2,430 at typical online prices. Tap a part for its pinout and datasheet notes.

Design calculations

Frame time

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.

Poll cycle

Two slaves × (24 + 8 + 50 ms reply delay) ≈ 165 ms, so a 1 s scan rate is easy.

CRC-16

Modbus uses CRC-16 with polynomial 0xA001 (reflected 0x8005), sent low byte first; any bit error is caught.

Scaling

Store temperature as an integer × 10 in a 16-bit register: 27.3 °C → 273.

Pin map

SignalPin or connection
ESP32 UART2 TX / RXGPIO 17 / 16 → MAX485 DI / RO
ESP32 DE+REGPIO 4
Each Nano: TX / RX / DE+RED1 / D0 via SoftwareSerial D10 / D11, D2
Nano DHT22 / pot / relayD4 / A0 / D7
BusA and B twisted pair, 120 Ω at both ends, common ground

Firmware outline

  1. Slaves: map input registers 30001 = temperature × 10, 30002 = humidity × 10, 30003 = pot (0 to 1000); coil 00001 = relay.
  2. Master: every second read input registers 30001 to 30003 from slave 1, then slave 2 (function 04).
  3. Handle timeouts (300 ms) and CRC errors; count them per slave.
  4. Write coil (function 05) when the dashboard toggles a relay.
  5. Publish values to MQTT; Node-RED dashboard shows gauges, a trend and alarms.

Test plan

TestExpected result
Both slaves on 20 m cableValues update every second
Termination removedError count compared
One slave unpluggedTimeout alarm, other slave still read
Relay toggled from dashboardRelay 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.

1. Why RS-485 in factories?
2. What is the difference between coils and registers?
3. Why termination resistors?
4. What does SCADA add?
5. How is Modbus different from MQTT?

Make it yours

One or two upgrades for a mini project, two to four for a major one.

Build these first

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.