---
title: RS-232 vs RS-485
description: Understanding the differences between RS-232 and RS-485 serial communication
---

import { Aside } from '@astrojs/starlight/components';

RS-232 and RS-485 are two serial communication standards that solve different problems. RS-232 connects one device to another over short distances. RS-485 connects many devices on a shared bus over long distances. Understanding when to use each one determines which mcserial tools your MCP assistant will reach for.

## Physical layer

The fundamental difference is how voltage signals are represented on the wire.

**RS-232** uses single-ended signaling: each signal is measured as a voltage relative to ground. A logic HIGH is -3V to -15V, and a logic LOW is +3V to +15V (inverted from what you might expect). This means every signal needs its own wire plus a shared ground, and the voltage swings are large.

**RS-485** uses differential signaling: each signal is carried on a pair of wires (typically labeled A and B). The receiver reads the voltage *difference* between the two wires, ignoring any common-mode noise that affects both wires equally. This is what gives RS-485 its noise immunity.

| Property | RS-232 | RS-485 |
|----------|--------|--------|
| Signaling | Single-ended (voltage to ground) | Differential (voltage between A and B) |
| Voltage levels | +/-3V to +/-15V | +/-1.5V to +/-6V differential |
| Max cable length | ~15 meters (50 feet) | ~1200 meters (4000 feet) |
| Max devices | 2 (point-to-point) | 32 standard, 256 with high-impedance receivers |
| Duplex | Full-duplex (separate TX and RX lines) | Half-duplex on 2 wires, full-duplex on 4 wires |
| Noise immunity | Low (susceptible to ground loops) | High (differential rejection of common-mode noise) |
| Typical connectors | DB-9, DB-25 | Screw terminals, RJ-45, DB-9 (repurposed) |

## Communication models

### RS-232: point-to-point

RS-232 is always a conversation between two devices. One device (the DTE, Data Terminal Equipment -- originally a terminal or computer) talks to another device (the DCE, Data Communications Equipment -- originally a modem). They have separate transmit and receive lines, so both can send data simultaneously (full-duplex).

RS-232 also defines modem control lines -- dedicated signals for hardware flow control, device presence, and status:

- **DTR / DSR**: "I'm here and ready" handshake
- **RTS / CTS**: "I want to send" / "Go ahead" flow control
- **RI**: "There's an incoming call" (modems)
- **CD**: "I have a connection" (modems)

These extra lines are what make RS-232 useful for tasks beyond raw data transfer: you can detect whether a device is connected, pause data flow when a buffer fills up, or pulse DTR to reset a microcontroller.

### RS-485: multi-drop bus

RS-485 is a shared bus. Multiple devices connect to the same pair of wires. Only one device transmits at a time while all others listen. This requires a protocol layer on top of the electrical standard to manage who talks when -- Modbus RTU being the most common example.

Because the bus is shared, RS-485 devices need a way to switch between transmitting and receiving. The transceiver chip has a Driver Enable (DE) and Receiver Enable (RE) pin. When a device wants to transmit, it asserts DE to drive the bus, sends its data, then deasserts DE to go back to listening. Some adapters handle this toggling in hardware; others require software control via the RTS line.

## When to use RS-232

RS-232 is the right choice when:

- **You are connecting directly to a single device** -- a sensor, a microcontroller, a modem, or a piece of lab equipment.
- **You need modem control lines** -- DTR for resetting an Arduino, CTS for hardware flow control, DSR for detecting device presence.
- **Cable runs are short** -- within the same desk, rack, or room (under 15 meters).
- **You are using a USB-serial adapter** -- the vast majority default to RS-232 behavior.

<Aside type="note">
Most USB-serial adapters (FTDI, CP210x, CH340, PL2303) present as RS-232 ports by default. Even adapters marketed as "RS-485" typically include an RS-485 transceiver chip on the board but still appear as a standard serial port to the operating system. The difference is in the electrical output, not the software interface.
</Aside>

## When to use RS-485

RS-485 is the right choice when:

- **Multiple devices share one bus** -- sensor networks, building automation, industrial control. RS-485 supports up to 32 devices (standard) or 256 (with high-impedance receivers) on a single pair of wires.
- **Long cable runs** -- RS-485's differential signaling works reliably over 1200 meters. RS-232 becomes unreliable beyond 15 meters.
- **Industrial environments** -- factories, power plants, and outdoor installations where electrical noise from motors, inverters, and power supplies would corrupt RS-232 signals. Differential signaling rejects common-mode noise.
- **Industrial protocols** -- Modbus RTU, PROFIBUS, and DMX-512 all run over RS-485.
- **Noisy environments** -- even in non-industrial settings, long cable runs near power wiring benefit from differential signaling.

## How mcserial handles the difference

mcserial tracks which mode each port is in and restricts tools accordingly. This prevents accidentally sending RS-232 modem control commands on an RS-485 bus (which would disrupt communication by toggling the direction control line). Your MCP assistant uses the `set_port_mode` tool to switch between modes on an open port.

### Default: RS-232 mode

Every port opens in RS-232 mode. The following tools are available:

- `get_modem_lines` -- read CTS, DSR, RI, CD, RTS, DTR
- `set_modem_lines` -- set RTS and DTR
- `pulse_line` -- pulse RTS or DTR for reset sequences
- `send_break` -- send a timed break signal
- `set_break_condition` -- hold or release sustained break

### After switching: RS-485 mode

Ask the assistant to call `set_port_mode` with `mode="rs485"` to switch. The RS-232 tools become unavailable and these tools become available:

- `set_rs485_mode` -- configure hardware DE/RE direction control
- `rs485_transact` -- send data and receive response with automatic turnaround
- `rs485_scan_addresses` -- discover devices on the bus
- `check_rs485_support` -- determine hardware capabilities

### Shared tools

These tools work in both modes:

- `open_serial_port` / `close_serial_port`
- `read_serial` / `write_serial` / `write_serial_bytes`
- `read_serial_line` / `read_serial_lines` / `read_until`
- `configure_serial` / `flush_serial`
- `detect_baud_rate`
- `set_flow_control` / `set_low_latency_mode`
- `file_transfer_send` / `file_transfer_receive` / `file_transfer_send_batch`

You can switch modes on an open port at any time with `set_port_mode`. No reconnection is needed.
