Maker Pro
Maker Pro

How far can a gpio from a mc can be used

dashy1981

Jun 19, 2013
83
Joined
Jun 19, 2013
Messages
83
HiI always wondered how far a microcontroller's gpio output signal can be used without loss.

Question comes from the fact that I have always used them to switch on /off relays or interface with sensors very near to the micro. But in case the sensor lies much far away say 50 mtrs... How will this configuration work ?

Cheers
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,727
Joined
Nov 17, 2011
Messages
13,727
There's no hard limit. Reliably 1 m or so, maybe 3 m - the longer the distance, the less reliable the signal. Plus the sensitivity of the line for electromagnetic noise rises with every cm of length. Therefore long lines shall be shielded.
A better technique is to place the relay driver transistors near the mcu and feed the comparatively insensitive power lines to the relay across the long distance. The driver transistors will decouple the long line from the mcu pins and therefore add protection against electromagnetic noise to the mcu.

In general one would not use logic level signals for long distances. There exist communication protocols like e.g. RS-232 or RS-485 for these purposes. These protocols use dedicated drivers and receivers and optimized voltage levels to provide stable communication over long distances.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,727
Joined
Nov 17, 2011
Messages
13,727
The ubiqutous 4 - 20 ma current loop, has been around for eons.
Right, but that's no longer simply a long wire on an mcu's gpio. With the right kind of interface a GPIO can go around the world, but the interface complexity increases with distance.
 

danadak

Feb 19, 2021
768
Joined
Feb 19, 2021
Messages
768
Of course there is always UTP and STP (Unshielded Twisted Pair and Shielded TP) to make longer
un signal conditioned runs. common mode noise, IR drop, C load considerations.... some of the
limitations. You have a unidirectional control signal, so reflections not an issue other than protecting
output with external diode clamps. One can think of really low data rates and use of TP. TP noise
rejection, from noise environment, would be issue. I cannot seem to find any study on this, so far....

There is a lot of C involved in TP....

Does the application involve safety ? If it does I would reach for physical layer parts, transceivers,
and use a protocol.

https://en.wikipedia.org/wiki/Twisted_pair#:~:text=Common-mode rejection starts to,be unable to eliminate it.

Possibly experiment with spice simulation for starters, maybe contact a cable tech
department (like Belden) to see if they have any background on unconditioned transmission.

https://www.pspice.com/sites/default/files/Transmission_line_Applications_in_PSpice.pdf


Regards, Dana.
 
Last edited:
Top