Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Projects
  3. ›Modbus RS485 reader

IoT & wireless projects

Read RS485 Modbus industrial sensors with an ESP32

Wire a MAX3485 transceiver, poll an RS485 temperature and humidity sensor over Modbus RTU and print the readings.

By Geekobot Learning Team

Intermediate
Difficulty
3 hours
Build time
₹34,202
Parts cost
9
Parts
ESP32
Platform
Add all parts · ₹34,202Start building
  • Workshop & industry
  • Measurement & tools
C3
Tap a part to see what it does
OverviewPartsWiringBuildCodeTroubleshootFAQIdeas

What you'll build

Factories, farms and buildings use RS485 sensors because the bus runs hundreds of metres and carries many devices on two wires. Modbus RTU is the usual protocol. An ESP32 with a 3.3 V RS485 transceiver can poll these sensors, and a serial server or 4G router can bring the same bus onto Ethernet or the internet.

What you'll learn

  • RS485 A/B wiring, termination and grounds
  • Modbus RTU function codes and registers
  • Moving a serial bus onto Ethernet
Safety

Keep 12 to 24 V sensor power away from the ESP32's 3.3 V pins.

  1. SenseRS485 Modbus sensors
  2. ThinkESP32 polls with ModbusMaster
  3. ActValues on serial or Wi-Fi

Parts list

Tick anything you already have and the total updates.

PartQtyPrice
  • ESP32-WROOM-32 38-Pin Development Board
    GB-IOWC-1403Guide

    Polls the bus

    × 1₹389₹389
  • MAX3485 TTL to RS485 Converter Module – 3.3V Logic
    GB-SENS-2888

    3.3 V RS485 transceiver

    × 1₹197₹197
  • Seeed Studio Industrial RS485 Modbus Temperature and Humidity Sensor
    GB-SENS-4439Guide

    RS485 Modbus temperature and humidity sensor

    × 1₹4,342₹4,342
  • XKC-Y25-V Intelligent Non-Contact Liquid Water Level Sensor – RS485, IP67
    GB-SENS-1405Guide

    Another device on the same bus: non-contact water level sensor

    × 1₹649₹649
  • SN-3001-DIP-N01 Dual-Axis Tilt Sensor – RS485 Output, Metal Housing
    GB-SENS-4294

    Another device on the same bus: dual-axis tilt sensor

    × 1₹2,519₹2,519
  • Waveshare 24962 Dual-Channel RS485 to Ethernet Serial Server
    GB-IOWC-1775Guide

    Puts the whole bus on your network (Modbus TCP)

    × 1₹3,749₹3,749
  • Teltonika RUT200 Industrial Cellular Router w/ 4G LTE, Wi-Fi & Dual ETH
    GB-IOWC-1955Guide

    Industrial 4G router for remote sites

    × 1₹10,689₹10,689
  • Waveshare CAN FD to RS232/RS485 Bidirectional Protocol Converter – DIN-Rail Mount
    GB-SENS-2880Guide

    For machines that speak CAN instead of RS485

    × 1₹3,869₹3,869
  • SN-300WQC-DC-PH/ORP-N01-201T Industrial pH/ORP Controller – RS485 Modbus, 4-20mA Output
    GB-SENS-0323Guide

    Industrial pH/ORP controller with RS485 Modbus for water treatment

    × 1₹7,799₹7,799

Complete kit

9 of 9 parts in one tap

₹34,202

GST included

3% off these parts while the whole kit stays in your cart

Parts you still need

₹34,202

9 of 9 parts. Tick anything you already have.

About ₹10,26,060 before bulk pricing for 30 kits.

Request bulk quote

Learn the parts

  • ESP32 DevKit Board (WROOM-32, 30 and 38 Pin)
  • RS485 Modbus Temperature and Humidity Sensors
  • XKC-Y25 and XKC-Y26 Non-Contact Liquid Level Sensor
  • Waveshare RS485 to Ethernet and Wi-Fi Serial Servers
  • Teltonika Industrial Cellular Routers
  • CAN Bus Basics
  • 4-20 mA and 0-10 V Signals

Wiring

Follow the colours: red is power, dark grey is ground, blue is a signal.

Most industrial sensors need 10 to 30 V DC; power them from a 12 V supply and share its ground with the ESP32.

PartPinConnect toNote
MAX3485RO / DIESP32 GPIO16 / GPIO17
MAX3485DE + RE (joined)ESP32 GPIO4High to send, low to receive
MAX3485VCC / GND3.3V / GND
SensorA+ / B-MAX3485 A / BTwisted pair; 120 Ω across A and B at both bus ends on long runs
SensorPower + / -12 V supply + / -Join the supply - to the ESP32 GND
  • MAX3485RO / DI → ESP32 GPIO16 / GPIO17
  • MAX3485DE + RE (joined) → ESP32 GPIO4High to send, low to receive
  • MAX3485VCC / GND → 3.3V / GND
  • SensorA+ / B- → MAX3485 A / BTwisted pair; 120 Ω across A and B at both bus ends on long runs
  • SensorPower + / - → 12 V supply + / -Join the supply - to the ESP32 GND
Built it? Check your wiring before you power up.Pick the pin each wire went to and we'll point out swapped pins, power mistakes and pins that clash.

Step-by-step build

0 of 6 done

Code

modbus_reader.inoVerify & upload in Electrolark
#include <ModbusMaster.h>
const int DE_RE = 4;
ModbusMaster node;

void preTx()  { digitalWrite(DE_RE, HIGH); }
void postTx() { digitalWrite(DE_RE, LOW); }

void setup() {
  Serial.begin(115200);
  Serial2.begin(9600, SERIAL_8N1, 16, 17);   // match the sensor's baud rate
  pinMode(DE_RE, OUTPUT); postTx();
  node.begin(1, Serial2);                    // sensor address 1
  node.preTransmission(preTx);
  node.postTransmission(postTx);
}

void loop() {
  // Many SHT20-based RS485 sensors keep temperature x10 in input register 1 and humidity x10 in register 2.
  // Check your sensor's datasheet and change the function and registers if they differ.
  uint8_t r = node.readInputRegisters(1, 2);
  if (r == node.ku8MBSuccess) {
    float t = (int16_t) node.getResponseBuffer(0) / 10.0;
    float h = node.getResponseBuffer(1) / 10.0;
    Serial.printf("%.1f C  %.1f %%RH\n", t, h);
  } else {
    Serial.printf("Modbus error 0x%02X\n", r);
  }
  delay(2000);
}

Run it: what this code does

The sketch above runs here on a simulated ESP32. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.

Troubleshooting

Error 0xE2 (timeout)+

Swap A and B, check the baud rate and address, and that DE/RE switches.

Error 0x02 (illegal address)+

The register number is wrong; some datasheets count from 1, the library from 0.

Random errors on long cables+

Add 120 Ω termination at both ends and use shielded twisted pair.

FAQ

How many sensors can share the bus?+

Up to 32 standard loads, each with its own address.

Modbus RTU vs TCP?+

RTU runs over serial lines; TCP carries the same registers over Ethernet.

Can a PC read the sensor directly?+

Yes, with a USB to RS485 adapter and a Modbus tool.

What parts do I need to build the read RS485 Modbus industrial sensors with an ESP32?+

9 parts: ESP32-WROOM-32 38-Pin Development Board, MAX3485 TTL to RS485 Converter Module – 3.3V Logic, Seeed Studio Industrial RS485 Modbus Temperature and Humidity Sensor, XKC-Y25-V Intelligent Non-Contact Liquid Water Level Sensor – RS485, IP67, SN-3001-DIP-N01 Dual-Axis Tilt Sensor – RS485 Output, Metal Housing, Waveshare 24962 Dual-Channel RS485 to Ethernet Serial Server, Teltonika RUT200 Industrial Cellular Router w/ 4G LTE, Wi-Fi & Dual ETH, Waveshare CAN FD to RS232/RS485 Bidirectional Protocol Converter – DIN-Rail Mount and SN-300WQC-DC-PH/ORP-N01-201T Industrial pH/ORP Controller – RS485 Modbus, 4-20mA Output. On this page you can tick the parts you already have and add only the rest to your cart.

How hard is it and how long does it take?+

It is a intermediate project and takes about 3 hours. The build on this page has 6 steps.

Do I need to write the code myself?+

No. This page has the complete, tested code (modbus_reader.ino).

Can I see what the code does before I build it?+

Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.

How much does the read RS485 Modbus industrial sensors with an ESP32 cost to build?+

About ₹34,202 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.

What will I learn from this project?+

RS485 A/B wiring, termination and grounds; Modbus RTU function codes and registers; Moving a serial bus onto Ethernet.

Is it safe to build?+

Keep 12 to 24 V sensor power away from the ESP32's 3.3 V pins.

What can I build next with these parts?+

Ideas that reuse this build: Water pipe pressure and tank level monitor. They are listed under Take it further on this page.

Take it further

  • Water pipe pressure and tank level monitor

Related projects

  • NANO
    IoT & wireless
    Intermediate· 2 hours

    GPS speedometer and clock

    A bike or car speedometer that needs no wheel sensor: satellites do the measuring.

    ₹768 · 5 partsArduino
  • UNO1865018650
    IoT & wireless
    Intermediate· 2–3 hours

    GPS route logger

    Records where you went every five seconds, ready to open on a map.

    ₹1,795 · 10 partsArduino
  • UNO
    IoT & wireless
    Intermediate· 2–3 hours

    Wireless doorbell with nRF24L01

    Two boards, two radios: press the button at the gate and it rings indoors.

    ₹426 · 8 partsArduino
  • C3
    IoT & wireless
    Beginner· 1–2 hours

    Wi-Fi weather station dashboard

    Check temperature, humidity and pressure from any phone on your Wi-Fi.

    ₹552 · 5 partsESP32

Learning project. Check every circuit and the datasheet of each part before you power it up.

Run itChange the inputs and watch the output
GPIO4 OFF
Serial monitor115200 baud
Modbus error 0x00
Modbus error 0x00

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question Share your build