17

What is the maximum length of serial cable I can use, to connection work properly? Is length of serial cable in connection with baud rate? I am using about 5 meter cable at speed 38400 bauds and RS232 communication, is it too long?

Junior
  • 1,009
  • 4
  • 23
  • 44
  • 1
    Quite a bit also depends on the drivers in the device. I used to work for a company that used 115200 around a large office (say 30 meters) using telephone cable but that was when all devices used +/- 12 V and with fairly high quality equipment. – PeterJ Aug 27 '15 at 11:01
  • As it's not RS232 but an UART I won't post it as answer, but a 3V level UART over 200 meter at 4800 baud is in a product we sell and works fine. 38400 baud over 15 meter as well. Our cable has a quite good quality though. – Arsenal Sep 03 '15 at 20:51

6 Answers6

17

Capacitance in the cable begins to affect serial communications, typically many manufacturers/devices set a limit of approximatly 15m or 50ft on cable lengths for anything up to 9600 baud, and about 4m for 38.4k. That being said, with decent cable it is easily possible to go longer in tested or non-commercial use, but I would stick to the guidelines for a commercial product, if only to leave an out for support calls.

If you really need length, RS232 to RS422/485 converters are very inexpensive, and you can run the differential modes (422/485) over two wires for well over 100m.

In your case, 5m really shouldn't be a problem at 38.4, as long as your cable is of reasonably quality. Almost any shielded multi-conductor cable should work at that distance, and probably three times it.

R Drast
  • 4,145
  • 15
  • 18
  • 1
    RS422/485 are of course also serial. The 15m limit is for RS-232 especially at the low voltage levels commonly used by modern PCs. You probably get further if you could use the entirely-within-RS-232-spec 15 Volt. – MSalters Aug 27 '15 at 13:33
  • 5
    @MSalters Yes, 422/485 are also serial, but they have a much more rigorously defined standard, and being a differential transmission format, they are much more reliable. – R Drast Aug 27 '15 at 14:46
  • Does capacitance given in cable documentation represents parasitic capacitance between two conductors? So the lower the capacitance, less is voltage drop and longer the distance we can pass? @RDrast – Junior Sep 04 '15 at 07:51
10

When I was young I railed against non-spec RS-232 hardware, as it made it difficult to reach the maximum distances RS-232 could reach. After all if your driving voltage is 9 V instead of 12 V you lost about a third of your distance right there. I also griped about other perceived shortcomings in the protocol.

Then I read the spec.

RS-232 is an interface protocol. It is not designed for long lengths; it is designed to connect endpoints to more capable communications equipment. RS-232 allows you to connect to a modem that is not on your desk, but the one next to it, even if you have to run the cable high enough that people can walk under it. You can even cheat and build a passive modem to connect two computers on the same bench out of paperclips (use the plastic coated ones, they don't need bubble gum as insulation).

The rule of thumb is: if you have to measure the distance, don't use RS-232; use RS-422/485 or fiber optic instead. RS-232 is however still a good choice for connecting your endpoint to your RS-422/485 (or fiber optic) repeater.

hildred
  • 852
  • 1
  • 7
  • 17
  • 2
    And then there are the various versions of the RS-232 spec, A, B, C and now D is common which requires a lower drive voltage. I am glad you found peace with the interface specification. Transformer (or optically) isolated line drivers are the way to go for distance, company I worked for made a range and sold them to the banks for ATMs as the imported line drivers were not isolated and failed under harsh African conditions (lightning, dirty mains). They did 2 km with synch comms at 19200 and failed only with significant lightning incidents but protected the end equipment. – KalleMP Aug 27 '15 at 21:48
  • +1 Especially for the "use the plastic coated ones, they don't need buble gum as insulation" Handyman at work here. – rbaleksandar Aug 27 '15 at 22:54
6

Too long is defined by your acceptable error rate.

My experience is that the lower the baudrate, the longer distance it will work. The company I work for installs rs232 runs longer than 100 feet using cat5, then just adjusts the baud until it works properly, which could end as low as 9600.

To figure this out, you could put a loopback on the far end and use the legacy digi xctu tool, which has a range test tab that can do this sort of thing. However, this may not tell the whole story, as the far end device may have different receive characteristics.

Erik Friesen
  • 1,851
  • 1
  • 11
  • 21
4

I would like to point your attention not only on error rate or transition rate. In my practice, rs232 is limited by several meters by problems arising from (bad) grounding. Voltage between local device ground and rs232 cable GND may be up to dozen of Volts, which could lead to system malfunction. So, it is worth to consider using differential pair communications like rs485 or ethernet.

0x2207
  • 141
  • 1
  • 1
    Yes ground differences can be a real problem but this is not inherently a function of distance. Usually it related more to different device grounds (mains circuits) or other large circulating ground currents. RS485 is in many ways more sensitive to bad grounds as it has lower common mode voltage limits and is often implemented without a common ground wire which is not good unless it is galvanicly isolated. UTP Ethernet is nice because it is transformer isolated differential signalling. – KalleMP Aug 27 '15 at 21:41
  • Frankly speaking, all RS485 implementations I've ever seen were galvanically or optically isolated. – 0x2207 Aug 28 '15 at 07:08
4

Four factors determine the length that can be used:

1) Quality and type of the cable, and the speed and protocol used, as described above. Good quality cable with a shield that's grounded behaves differently than using unshielded twisted pairs/UTP/Cat-something (cable covered under EIA/TIA TSB 56x)

2) The chipset used on the two devices connected, and whether they use pull-up resistors to increase their UART/USART (the serial chipset on each host) sensitivity (a design thing)

3) Crosstalk introduced by sharp bends or lack of shield grounding where needed (non-UTP cable)

4) Overall capacitance and time delay; do protocol signals fall out of synch with the control lines being set, or does induced capacitance cause intermodulation/crosstalk/inductive-reactance delays, etc.

This is for asynch cables, not synch or bi-synch cables. You probably have an asynch cable connection (meaning neither side sends a clock signal).

General guidelines says most cables will support 115k baud, using x-on/x-off protocol (stop start is data on tx/rx lines) are limited to 30M, or about 100' with shielded cable. UTP cables using this same protocol setup are limited to about half the speed, so maybe 56k.

You can make realllllly long serial cables-- if at slow speed and shielded. The speed of light gets in your way at some point.

WU9I
  • 41
  • 1
2

In my experience well installed RS232 lines over decent telephone and Cat5e cable can go quite a considerable distance. We have a serial dot matrix printer hooked up to a PC that's nearly 600m away. Other places that have the same requirements have managed to get 1km. Of course the baud rate is critical, we run it at 2400 so no good for high volumes of data but for 20 lines of text on a receipt printer it works just fine, the only issue we have is a poor mains electrical supply to the printer.

David
  • 21
  • 1