Table of contents
Table of contents
RS485 is how devices talk over long wires. It carries the same serial data your Arduino already sends, but over hundreds of metres and through electrical noise that would scramble a normal connection. This guide covers how it works, how to wire it, and when to use it.
What is RS485?
RS485 is a wired serial communication standard. It defines how data travels over a pair of wires, so devices can talk reliably over long cables.
You will find it in factories, energy meters, HVAC systems, building controllers and industrial sensors. It is the usual answer when devices are too far apart for I2C or SPI, and when Wi-Fi or Bluetooth is not reliable enough. Most RS485 devices speak a protocol called Modbus on top of it.
A microcontroller cannot drive an RS485 bus directly. It needs a transceiver chip between its UART pins and the cable. Soldered's RS-485 transceiver breakout uses the SN65176B and has screw terminals for the bus wires.
Why use RS485 instead of regular serial communication?
A normal UART connection works for a few metres at most. RS485 fixes the three things that break first on a long cable:
- Distance. Up to 1200 m at lower data rates.
- Noise. Motors, relays and mains wiring next to the cable do not corrupt the data.
- Device count. Up to 32 standard devices share one pair of wires.
| Communication | Best for |
|---|---|
| UART | Short device-to-device serial communication |
| I2C | Sensors and modules inside one device |
| SPI | Fast short-distance communication |
| Wi-Fi | Wireless networked projects |
| RS485 | Long wired sensor and control networks |
Our I2C protocol guide and SPI guide cover the short-distance side.
How does RS485 work?
RS485 uses differential signalling. Two wires, labelled A and B, always carry opposite signals. The receiver ignores the voltage on each wire and reads only the difference between them.
Noise from a nearby motor hits both wires equally, so the difference stays the same and the data gets through. That is why RS485 cables are twisted pairs: twisting keeps the two wires exposed to the same noise.
- The microcontroller sends UART data.
- The RS485 transceiver turns it into a differential signal on A and B.
- The signal travels over the cable.
- The receiving transceiver turns it back into UART data.
- The second device reads it.
Most RS485 setups are half-duplex: only one device talks at a time. The transceiver has a driver enable pin (DE) that your code sets high to transmit and low to listen.
RS485 wiring basics

- A to A, B to B. Every device connects to the same two lines.
- Share a ground. Run a ground wire alongside the pair so every device has the same reference.
- Use a bus, not a star. Run one cable from device to device. Do not branch long cables out from a central point.
- Terminate both ends. On long runs, put a 120 Ω resistor across A and B at the first and last device. Soldered's breakout has one on board, switched by jumper JP2.
- Swap A and B if nothing works. Manufacturers label them inconsistently.
Some networks also need bias resistors to hold the lines in a known state when nobody is talking. Short bench setups usually work without them.
RS485, Modbus and protocols
RS485 only defines the electrical signal. It says nothing about what the bytes mean. Modbus RTU is the most common protocol that runs over it: it defines the message format, device addresses and how to read a register.
Think of RS485 as the road and Modbus as the traffic rules. An RS485 energy meter almost always speaks Modbus, so to read it you need both: a transceiver for the road, and a Modbus library for the rules.
RS485 vs RS232 vs UART
| Feature | UART | RS232 | RS485 |
|---|---|---|---|
| Best for | Short microcontroller links | Legacy serial devices | Long-distance wired networks |
| Devices | Usually 2 | Usually 2 | Up to 32 standard loads |
| Distance | Short | Medium | Up to 1200 m |
| Noise resistance | Low | Medium | High |
| Common use | Modules and debugging | Older serial equipment | Sensors, meters, automation |
UART is the data format. RS232 and RS485 are two ways to carry it further. RS232 uses one wire per direction referenced to ground, which limits distance. RS485 uses a differential pair, which is why it goes further and connects more devices.
Can you use RS485 with Arduino, ESP32 and Raspberry Pi?
Yes, all three. Each one connects its UART pins to a transceiver, and the transceiver connects to the bus.
RS485 with Arduino-compatible boards
Connect the board's TX to the transceiver's D pin, RX to R, and one digital pin to DE and NRE tied together. Two boards and two transceivers are enough to learn the basics and try simple Modbus experiments.
Soldered's breakout runs on 5 V, so it pairs directly with a 5 V board. The Make your own NULA kit has you solder one from parts.
RS485 with ESP32
An ESP32 can read an RS485 bus and send the data over Wi-Fi to MQTT, a log or Home Assistant. That makes it a bridge between wired industrial devices and a wireless system.
The ESP32 has spare hardware UARTs, so the bus does not block the USB serial port. The only extra step is switching DE around each message:
// Send one line over RS485 from an ESP32
HardwareSerial rs485(1); // a spare hardware UART
const int RX_PIN = 14; // to the transceiver's R pin
const int TX_PIN = 13; // to the transceiver's D pin
const int DE_PIN = 12; // to DE and NRE, tied together
void setup() {
rs485.begin(9600, SERIAL_8N1, RX_PIN, TX_PIN);
pinMode(DE_PIN, OUTPUT);
digitalWrite(DE_PIN, LOW); // listen by default
}
void loop() {
digitalWrite(DE_PIN, HIGH); // take the bus
rs485.println("Hello");
rs485.flush(); // wait until the last byte has left
digitalWrite(DE_PIN, LOW); // release the bus
delay(1000);
}
Without flush(), the code releases the bus while the last bytes are still being sent, and they are lost.
Check the voltage. The ESP32 runs at 3.3 V. Soldered's breakout runs at 5 V, and its R output can rise close to 5 V. Put a voltage divider or level shifter between R and the ESP32's RX pin.
NULA Mini ESP32-C6 has Wi-Fi 6 and Bluetooth, which makes it a good RS485-to-wireless bridge.
RS485 with Raspberry Pi
The simplest way is a USB-to-RS485 adapter, which shows up as a serial port. You can also use an RS485 HAT, or a transceiver on the Pi's UART pins with the same 3.3 V level shifting as the ESP32. The Pi then runs the dashboard, the database or Node-RED and Home Assistant.
Practical RS485 project ideas
ESP32 RS485 to MQTT bridge
Poll RS485 devices from an ESP32 and publish each reading to MQTT. Home Assistant picks them up like any other sensor. Our ESPHome MQTT guide covers the wireless side.
Energy meter dashboard
Most DIN-rail energy meters have an RS485 Modbus port. Read voltage, current and total energy from it and show them on an e-paper screen by the fuse box. Inkplate 10 has a 9.7-inch panel and an ESP32, so it reads the meter and draws the dashboard itself.
Long-distance sensor network
Put a small node at each far end of a building, each with its own sensor, and connect them all on one RS485 cable. A waterproof DS18B20 suits pipes, tanks and outdoor readings.
NULA DeepSleep ESP32-S3 draws very little current between readings, which suits nodes that wake, report and sleep.
Industrial data logger
A Raspberry Pi polls every meter and controller on the bus and stores the readings in a database. Add Grafana and you can see a month of data at a glance. Our Raspberry Pi project ideas have more builds for the Pi.
Greenhouse or workshop monitoring display
Wire temperature and humidity sensors across a greenhouse or workshop over RS485, where Wi-Fi does not reach. Show the values on a colour e-paper display that stays readable all day.
Common RS485 mistakes
- A and B swapped. Nothing gets through. Swap them and try again.
- Star wiring. Reflections from each branch corrupt the data. Use one continuous bus.
- No termination on long runs. Put 120 Ω at both ends, and only at the ends.
- Confusing RS485 with Modbus. A working bus still needs the right protocol to read a meter.
- No transceiver. UART pins cannot drive an RS485 bus directly.
- Voltage mismatch. A 5 V transceiver's output can damage a 3.3 V pin.
- Duplicate Modbus addresses. Two devices answer at once and both replies are garbled.
- Assuming wireless is easier. Through concrete walls or next to machinery, a cable is often less work.
When should you use RS485?
- devices are tens or hundreds of metres apart
- the cable runs near motors, relays or mains wiring
- several devices need to share one wired network
- the link has to work every time
- the project reads industrial sensors, meters or controllers
- Wi-Fi or Bluetooth does not reach or drops out
When should you not use RS485?
- all devices sit in one enclosure
- I2C, SPI or UART already does the job
- the project is a simple bench build
- you need very fast local communication
- the project has to be wireless
Why Soldered is a great place to start building wired communication projects
A project can start with two boards and two transceivers on a desk, then grow into an ESP32 bridge, a Raspberry Pi logger or an Inkplate dashboard. Soldered makes the boards, sensors, displays and debugging tools for each step.
When the UART side misbehaves, USB-Cereal gives you a serial console on a USB-C device through its sideband pins, with no headers or disassembly.
Frequently asked questions
What is RS485?
A wired serial communication standard for reliable communication over long cables. It is common in industrial automation, sensors, meters, controllers and building systems.
Is RS485 a protocol?
Not a full one. It defines only the electrical signal. Protocols such as Modbus RTU run on top of it.
How does RS485 work?
It sends data as a differential signal on two wires, A and B. The receiver reads the difference between them, which cancels out most electrical noise.
What is RS485 used for?
Industrial automation, Modbus networks, energy meters, HVAC, long-distance sensors, access control, environmental monitoring and machine control.
What is the difference between RS485 and RS232?
RS232 connects two devices over a short to medium distance. RS485 connects many devices on one bus, over longer distances and in noisier places.
What is the difference between RS485 and UART?
UART is the serial data format a microcontroller produces. RS485 carries that data over long cables, using a transceiver at each end.
Can Arduino use RS485?
Yes, with an RS485 transceiver module. The Arduino talks to the transceiver over UART, and the transceiver drives the bus.
Can ESP32 use RS485?
Yes, through a hardware UART and a transceiver. Level-shift the receive line if the transceiver runs at 5 V. The ESP32 is useful when the data also needs to reach Wi-Fi, MQTT or Home Assistant.
Can Raspberry Pi use RS485?
Yes, through a USB-to-RS485 adapter, an RS485 HAT or a transceiver on its UART pins. It suits logging, dashboards and Modbus automation.
Is RS485 better than I2C?
For long cables and noisy places, yes. I2C is better for short connections between parts inside one device.