Part

RS-485 module, MAX485

A MAX485 RS-485 transceiver board: DE and RE pick send or listen, and two or more on one A/B pair carry any UART half duplex over a real terminated bus.

or see every part
  • 8 pins
  • 1 setting
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The RS-485 module, MAX485 in brief

What it is, and every setting the properties panel gives it.

The MAX485 module is the small blue board that turns a microcontroller’s UART into RS-485, the two-wire differential bus used for long cable runs, Modbus sensors and industrial controllers. Instead of a voltage against ground, each bit is the difference between the A and B wires, which is why it survives hundreds of meters of noisy cable. The bus is half duplex: every module listens, and one at a time may talk, chosen by its DE and RE pins. Mokxi solves the pair as a real circuit: each module’s 120 ohm terminator, bias resistors, receiver input and, while it is talking, its driver all go into one network, and each receiver reads the voltage that results. So two or ten modules on one pair genuinely talk, a crossed pair really garbles the bytes, and two drivers on at once show up as a bus fight on the board.

Family
Clocks and links
Pins
8
termination
true
the module's 120 ohm resistor across A and B (on by default). On a real bus only the two modules at the far ends keep theirs; untick it on the ones in between.
Pins

8 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
RO
Receiver output: the bus as a logic level, to the board's RX.
RE
Receiver enable, active low (/RE). High lets RO go (the pull-up holds it high).
DE
Driver enable, active high. High puts DI on the bus.
DI
Driver input: from the board's TX.
VCC
5 V (the chip is rated 4.75 to 5.25 V).
B
The bus pair, also on the screw terminal. A goes to A, B to B.
A
The bus pair, also on the screw terminal. A goes to A, B to B.
GND
Ground, shared with the board.
How to use it

How to use a MAX485 RS-485 module with an Arduino

The built-in project uses one Uno for both ends so the whole link fits on one screen. The sender module’s DI takes the Uno’s TX on pin 1, and its DE and RE, tied together, go to pin 4. The receiver module’s RO goes to pin 8, read with SoftwareSerial, and its DE and RE are tied to GND so it only listens. A goes to A and B to B between the two, and both modules get 5 V and ground.

Every second the sketch raises pin 4, prints "ping" and a count, waits for Serial.flush() and drops pin 4 again. The receiver hears the line on pin 8 and the sketch echoes it to the serial monitor. The flush matters: print() returns while the UART is still sending from its buffer, and letting go of the bus too early cuts off the end of each message.

Try the two faults the sketch’s comments suggest. Swap A and B on one module and every bit arrives inverted. Take out Serial.flush() and the last characters go missing.

Part pin
Board pin
DI (sender)
Pin 1 (TX)
DE and RE (sender)
Pin 4
RO (receiver)
Pin 8
DE and RE (receiver)
GND
A and B
A to A, B to B between the modules
VCC, GND
5 V and GND on both

On a board with a spare hardware UART, such as a Mega’s Serial1 or an ESP32’s Serial2, use that for the bus and keep Serial for the monitor; the DE and RE switching is the same.

Arduino Uno: RS-485 link between two moduleslive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Talk, wait, listen, from the RS-485 link sketch
digitalWrite(DIR, HIGH);   // talk
Serial.print("ping ");
Serial.println(count);
Serial.flush();            // wait for the last bit
digitalWrite(DIR, LOW);    // listen
Common errors

Common RS-485 module, MAX485 errors and fixes

What goes wrong
The fix
The end of every message is missing.
DE dropped while the UART was still sending. Call Serial.flush() before switching back to listen. ModbusMaster does this between its preTransmission and postTransmission callbacks.
The board shows "bus fight" and the receivers read nonsense.
Two modules have DE high at once. Only one may drive the pair; every other module keeps DE low.
Bytes arrive, but as garbage.
A and B are crossed on one module, so every bit is inverted. Wire A to A and B to B everywhere.
A module you only meant to listen with is talking over the others.
The module has 10 k pull-ups on DE and RE, so left unwired it is transmitting. Tie them to a pin you hold low, or to GND.
Questions

Questions and answers

Is RS-485 with the MAX485 full duplex?

No, a single MAX485 pair is half duplex: one module talks while the rest listen, and the sketch switches direction with DE and RE.

Which modules should keep the 120 ohm terminator?

Only the two at the physical ends of the cable. On the ones in between, untick the part’s termination property, as you would remove the resistor on a real board.

Do I need a library for the MAX485?

Not for plain serial: Serial or SoftwareSerial carries the bytes and one pin switches direction. For Modbus RTU devices, ModbusMaster runs on top of it.

Will a MAX485 module work at 3.3 V?

The chip is rated for 4.75 to 5.25 V. The model still runs below that, down to 3 V, with a smaller swing on the pair; for a 3.3 V design the MAX3485 is the part made for it.

How it is modeled

What is true about the RS-485 module, MAX485, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

The bus is solved as a circuit. Every module on the pair puts its terminator, its bias resistors, its receiver's 12 kohm input and, while DE is high, its driver into one network, and each receiver reads the voltages that come out. So two, three or ten modules on one pair really talk, half duplex.

The driver. DI high puts A above B; low puts B above A. Into the 60 ohm of two terminators the difference is about 1.8 V on 5 V, inside the data sheet's 1.5 V minimum for 54 ohm. DE low takes the outputs off the bus.

The receiver. RO is 1 when A is 200 mV or more above B and 0 when it is 200 mV or more below. Undriven, open or shorted inputs read 1 (the MAX485's fail-safe), so an idle bus does not look like a start bit. RE high lets RO go to the module's 10 kohm pull-up.

The module's resistors. 10 kohm pull-ups on RO, RE, DE and DI (so a module with DE and RE left open is transmitting), 20 kohm biasing A up and B down, and the 120 ohm terminator, as on the common module's schematic. Clones vary.

Mistakes show. Two modules with DE high at once fight: the pair sits near 0 V, receivers read nonsense, and the board says bus fight. A module with no ground is unpowered and sends nothing. On the canvas, the board shows TX, RX or both, and the voltage between A and B.

Any baud rate passes: the module never looks at bytes, only levels, so hardware Serial, SoftwareSerial and Modbus all work through it.

Not modeled

The propagation delays (tens of nanoseconds, about 1% of a bit at 115200 baud), the 2.5 Mbit/s limit, the driver's current limit and thermal shutdown (a fight passes about 80 mA for as long as it lasts), the -7 to 12 V common-mode range, and the supply current (nothing is drawn from VCC). The simulator has one ground, so two boards on separate supplies still share a reference even when their grounds are not wired together. Cable length and reflections are not modeled. Below 4.75 V the chip runs anyway, down to 3 V, with a smaller swing.

From MAX485 RS-485 module, in full.

Projects

See the RS-485 module, MAX485 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the RS-485 module, MAX485 in it.

Libraries

Arduino libraries for the RS-485 module, MAX485

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the RS-485 module, MAX485

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.