Serial Standards

RS‑232 vs RS‑432 vs RS‑422 vs RS‑485

I wrote an answer to an Arduino Stack Exchange question about the different common standards for serial communications, and their inter-compatibility:

https://electronics.stackexchange.com/questions/405825/connect-rs422-interface-with-arduino-uno/405861#405861

I repeat it here for edification.

Voltages

There are a number of different serial hardware solutions, to solve different problems.

  • TTL:
    All microcontroller’s serial connection (TX and RX) are at “TTL levels”, which means 0V to “Hi” (where “Hi” is 5V, or 3.3V, or whatever the microcontroller uses). RX needs to be within this range to be detected, and TX will only be 0V or “Hi” volts – 0V for “off”, and “Hi” for “on”. Each of the alternatives below use dedicated chips to convert TTL to their own voltages – but the same “off” and “on” concepts exist, so the microcontroller can fully communicate using TTL with them through these chips.
  • RS-232:
    The problem with TTL is that it won’t travel far on a cable – and it is easily affected by noise produced by motors and other electrical appliances in the vicinity. Therefore, the TTL levels are often converted to RS-232 levels, which are as high as 25V(!) But even weirder, the other side isn’t 0V, but actually as much as negative 25V (yes, -25V). “Off” is anywhere from +3V to +25V, while “on” is -3V to -25V. That means that if you connect to a true RS-232 appliance, you need to deliver at least ±3V, but need to accept at least ±25V. Needless to say, that’s a problem for microcontrollers, without support circuitry. Also, RS-232 is specified to allow only one receiver per TX – although I’ve put two on a short cable at 9,600 baud with no problem.
  • RS-423:
    RS-423 is a compromise between RS-232 and RS-422. Like RS-232, it only uses one wire each for RX and TX – although maxing out at ±6V. But unlike RS-232, the TX specification is strong enough, and the RX specification is sensitive enough (±0.2V), to allow up to 10 receivers on one TX line. Because RS-423 is so similar to RS-232, I’ll refer to RS-232/RS-423 from now on, unless they’re different.
  • RS-422:
    The problem with RS-232/RS-423 is that they’re not great in (electrically) noisy environments either. To help this, RS-422 has a two-wire pair for each of RX and TX. RS-232/RS-423 reference RX and TX from a third wire, GND. RS-422 references the sense of the signal between the two-wire pair – if one wire has a higher voltage than the other, it’s “on”, while if it’s the other way around it’s “off”. This is known as a “differential” system, and the two halves of the signal pair are labelled + and -. Electrically, if an interfering signal alters the voltage on the cable, it will affect both wires in the pair the same way – but not change the relative voltage difference between them. This increases the cable’s resistance to external noise. For this reason, the voltages don’t need to be as high – in fact, they’re only ±6V. Note that for TX, the two RS-422 signals could be created by powering one wire of the pair with 0V&”Hi”, the other with “Hi”&0V – and always making sure they were opposite each other. This would create a ±”Hi” differential, which would be detected by the receiver perfectly. But this is not the way it is usually done; it’s usually done with a true differential (isolated) transmitter.
  • RS-485:
    This variant came about when two things were realised:
    • Most serial communications were half-duplex: one side would transmit, then the opposite side would answer – both sides wouldn’t be transmitting at the same time.
    • With one master and multiple slaves, you’d need lots of separate wires between them. Was there a way of “bussing” them all together so that they could all share the same wires? This is called “multi-drop”. Stringing multiple wires between them all was a waste, since the same pair of wires could hold the traffic in either direction (and yes, RS-485 uses the same differential standard as RS-422). Of course, this meant that all sides couldn’t be “powering” the wires at the same time – but that’s OK, each side would “know” when to power their side:
    • The master would power its side while it was transmitting the request to a particular slave, then de-power its side to listen for the answer;
    • The slave wouldn’t power its side until it had heard a request for itself and was ready to transmit the answer, so it would power its side, reply, then de-power again.

Compatibility

The different voltages above indicate, superficially, that they are not electrically compatible – for example, you can’t plug any directly into TTL (unless you want smoke!). However, there are some circumstances where they can work together – but you have to be lucky!

  • RS-232/RS-423 and RS-422:
    Because RS-422 is differential, and RS-232/RS-423 work as low as ±3V, you might be able to fool the two into working together – as long as the RS-232 TX signal is no more than ±6V! RS-423 is already limited to that.
    • RS-232/RS-423 TX is easy: it is already a differential voltage relative to GND, and so can be directly wired to the RS-422 RX+ and RX- – as long as you realise that due to the different specifications, you wire GND to RX+ and TX to RX- (no, that’s not a typo: just the way it is!)
    • RS-422 TX+ and TX- is usually a differential transmitter, and if you tie one wire of the pair to actual ground, then the other will “swing” above and below that one with the required ±3V differential – perfect for RS-232/RS-423. If you connect TX+ to GND, and TX- to RS-232/RS-423 RX (again, no typo!), and the RS-422 transmitter is truly differential, you can get the two sides to inter-operate.
  • RS-422 and RS-485:
    Because these both use the same voltages and direction, then you could have the two work by wiring the RS-422’s TX and RX pairs together, with the RS-485’s TX/RX pair. But, this can only work if all of the below is true:
    • There is only one master and only one slave;
    • The master controls when it powers its TX side;
    • The slave can ‘handle’ hearing its own output without interpreting it as a command;
    • You can wire the connections between them as follows:
      • Master TX/RX+ to Slave’s TX+ and RX+;
      • Master TX/RX- to Slave’s TX- and RX-.
      Frankly, that third requirement is the most difficult since you have no control over the slave’s protocol – but I have lucked into this in the past.
  • RS-232/RS-423 and RS-485:
    Sorry, no can do.
    • RS-232/RS-423 has no mechanism to turn off TX for half of the conversation;
    • Since RS-485 has both TX and RX on the same pins, it implies that you’d have to tie RS-232/RS-423’s RX and TX together – which means that the signals are no longer differential.