2
\$\begingroup\$

I have an application where two different microcontrollers need to communicate. I was thinking that for simplicity, just use 5V instead of converting to RS232 levels. What in good practice would the max distance be for single ended communications? (0-5V). At what distance / conditions should I consider a differential driver / receiver?

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Speed/Bandwidth? \$\endgroup\$
    – Passerby
    Commented May 25, 2014 at 0:54
  • \$\begingroup\$ probably 9600 or 19200 baud. I don't need to send that much data. \$\endgroup\$
    – BrianK
    Commented May 25, 2014 at 3:00
  • \$\begingroup\$ For long distance communications, you're really going to want to go with something balanced, like two-pair RS485 on twisted pair. The transceivers are just like RS232 transceivers, but can handle the balanced I/O. For example, linear.com/product/LTC1334 I know it's not what you're looking for, but it's likely the right solution if you're looking at tens of meters and up. \$\endgroup\$
    – rjp
    Commented May 30, 2014 at 16:52
  • \$\begingroup\$ I am considering differential driver like the SN75179B ti.com/product/sn75179b \$\endgroup\$
    – BrianK
    Commented May 31, 2014 at 0:18
  • \$\begingroup\$ At 20 kHz, RS422/485 is good for miles. You can get a feel for distance-versus-speed by going through catalogs from L-Com, Black Box, etc. \$\endgroup\$
    – AnalogKid
    Commented May 29, 2021 at 16:56

2 Answers 2

4
\$\begingroup\$

RS232 is a (well, two) single-ended transmission standard, with a typically large voltage swing (-12V to 12V, 24V high to low (with a -3V to 3V dead Spot)). It's easy to get information on distance for RS232:

The RS-232 standard 9600bps port will drive 15 metres of shielded cable. More precisely, an RS-232 line driver will operate against a capacitance of up to 2500 picofarad with low enough skew to allow a 9600bps signal to be recovered.

If you select a cable with lower capacitance you can drive further distances. For example, ANSI/TIA/EIA-568-A unshielded twisted pair category 5 cable has a maximum capacitiance of 55pF per metre, so this popular "UTP cat 5" cable can be safely driven up to 45m. Beyond that you should check the cable manufacturers specifications for the actual "shunt capacitance" (a common figure is 47.5 pF/m, giving a maximum cable length of about 50m). However long runs of unshielded cable will pick up noise easily, as the RS-232 signals are not balanced. Some cable manufacturers offer shielded low capacitance cables which can be driven up to 100m.

With RS232, shielding and twisted pair both offer some noise filtering, allowing for higher speeds or longer distance.

TTL level serial/UART for your setup only has 5V swing. Combining The low voltage swing, you have to figure three things. One is cable resistance. All cables have resistance that adds up. While negligible at small distances, the longer the cable and higher the current, the more the voltage at one end changes compared to the other end.

Two is cable capacitance. The higher the capacitance, the more it resists changing from one voltage Level to the other. The higher the capacitance, the slower it changes and more rounded off the signal gets. So with higher speed and greater distance or capacitance, the signal will start to look less like a square wave and more like a sine wave.

Three is noise. Due to the lower voltage swing, lack of differential signaling, or error correction, the more it affects the communication. Shielding and twisted pair will help.

Based on that, I guess, not having found any good information online, that 5v 9600 bps, could do 50 feet/15 meters on generic UTP Cat 5 just fine.

In general, the faster the speed + the higher the capacitance + the smaller the voltage swing = the shorter the distance, before you even get into noise. There is no flat rule of thumb.

\$\endgroup\$
0
\$\begingroup\$

ESP32 between UART 1, speed 19200 at 20 metres of CAT5E - worked first time.

This is actually 3.3V

MicroPython 1.15:

from machine import UART
cuart = UART(1,19200)
cuart.write("ABC")

other end

from machine import UART
cuart = UART(1,19200)
cuart.read()
b'ABC'

I was pleasantly surprised!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.