Page 1 of 1

Longer cable for GPIO-sensor?

Posted: Thu Sep 05, 2019 5:02 pm
by Totemi1324
Hello there,

I am using The HC-SR04 ultrasonic sensor with the Raspberry Pi to measure distances. I connect the two with simple jumper-cables and use a logical voltage shifter in between.
Here's my question: I read on the internet that the optimal cable length for GPIO-communication with standard jumper-wires are 20cm-30cm. But for my project I need a ca. 60cm cable. Is there a big imperement of the signal lengths/GPIO-communication at this length? And if, are there any stronger cables out there which I can use to connect the two on a 60cm distance?

Thanks for the help in advance!

Re: Longer cable for GPIO-sensor?

Posted: Thu Sep 05, 2019 5:45 pm
by pcmanbob
I don't know where you are in the world as you have not added your location to you profile.

But a quick search of eBay UK I was able to find Dupont cables up to 100cm in length, so if you don't fancy making your own cables you can order Dupont cables as long as you need for your project.

Re: Longer cable for GPIO-sensor?

Posted: Thu Sep 05, 2019 9:23 pm
by LTolledo
how about making your own set of signal cables, using VCTF 0.5mmsq 4C (0.5mmsq x 4) cable, you could probably get longer distance than 60cm (600mm/0.6m/23.63in/1.968ft)

there is even a shielded version if you are concerned about "noise" entering thru the cable...

Re: Longer cable for GPIO-sensor?

Posted: Thu Sep 05, 2019 10:35 pm
by ProDigit
A 34 pin floppy cable like this one below would most likely fit. (24" ~ 60cm)
Although you'll still need to modify some of the wires, as they're twisted on one end.
I don't know how easy it'll be to twist the wires back.

I wished the Pi foundation was able to re-rout the pins via software, to allow compatibility with floppy cables (since they're still mass produced and cheap).

https://www.amazon.com/dp/B07KDJTMGP


Source: https://raspberrypi.stackexchange.com/q ... s-for-gpio

Re: Longer cable for GPIO-sensor?

Posted: Thu Sep 05, 2019 10:41 pm
by rpdom
ProDigit wrote:
Thu Sep 05, 2019 10:35 pm
A 34 pin floppy cable like this one below would most likely fit. (24" ~ 60cm)
Why would that be any better than using ordinary jumper wires? The wires would be thinner if anything.
I wished the Pi foundation was able to re-rout the pins via software, to allow compatibility with floppy cables (since they're still mass produced and cheap).
I haven't seen a floppy cable for sale anywhere for ages.

Also, it would be preferable to use a common 40 pin IDE/ATA cable instead (just be careful not to use a PATA cable with 80 conductors instead of 40 as that will short out your Pi!)
[/quote]

Re: Longer cable for GPIO-sensor?

Posted: Fri Sep 06, 2019 12:03 am
by ProDigit
rpdom wrote:
Thu Sep 05, 2019 10:41 pm
ProDigit wrote:
Thu Sep 05, 2019 10:35 pm
A 34 pin floppy cable like this one below would most likely fit. (24" ~ 60cm)
Why would that be any better than using ordinary jumper wires? The wires would be thinner if anything.
I wished the Pi foundation was able to re-rout the pins via software, to allow compatibility with floppy cables (since they're still mass produced and cheap).
I haven't seen a floppy cable for sale anywhere for ages.

Also, it would be preferable to use a common 40 pin IDE/ATA cable instead (just be careful not to use a PATA cable with 80 conductors instead of 40 as that will short out your Pi!)
You haven't read the link I sent, and haven't pressed the amazon link either.
They're still commonly sold on Amazon and Ebay for just $10.

Re: Longer cable for GPIO-sensor?

Posted: Fri Sep 06, 2019 4:54 am
by rpdom
ProDigit wrote:
Fri Sep 06, 2019 12:03 am
You haven't read the link I sent, and haven't pressed the amazon link either.
You're making assumptions.
They're still commonly sold on Amazon and Ebay for just $10.
Ouch! That's a lot for an old junk cable. I've got a stack of them I havn't used for years.

Re: Longer cable for GPIO-sensor?

Posted: Fri Sep 06, 2019 3:20 pm
by LTolledo
I wouldn't use/trust very thin un-shielded cables for signal transmission over long distance.....even if the signal is digital......

...but that's just me....

you like to use thin cables... fine... its your decision....

Re: Longer cable for GPIO-sensor?

Posted: Sat Sep 07, 2019 12:36 am
by ProDigit
Floppy/Pata cables are used to transmit signals at 133Mhz or less. The GPIO pins mainly just transmit voltages (on-off at slow speeds), with very few pins actually used for data.

Re: Longer cable for GPIO-sensor?

Posted: Sat Sep 07, 2019 5:53 am
by rpdom
ProDigit wrote:
Sat Sep 07, 2019 12:36 am
Floppy/Pata cables are used to transmit signals at 133Mhz or less. The GPIO pins mainly just transmit voltages (on-off at slow speeds), with very few pins actually used for data.
Well, 33MHz for the 40 pin cables and the floppy cables were much slower and very few of the pins were actually used for data. Maximum recommended length for the 40 pin cables was 18 inches.

I don't understand your differentiating between "signals" and "voltages". Surely all a signal consists of is a changing voltage. I think you'll find that some of the GPIO signals are quite a bit faster than the signals on a floppy cable. SPI and i2c come to mind, and don't forget the DPI mode which uses almost all of the pins for data.

Re: Longer cable for GPIO-sensor?

Posted: Sat Sep 07, 2019 9:38 am
by Burngate
Back to the original question:
Totemi1324 wrote:
Thu Sep 05, 2019 5:02 pm
I read on the internet that the optimal cable length for GPIO-communication with standard jumper-wires are 20cm-30cm.
Where did you read that?

There're a couple of reasons for limiting the lengths of wires.
One is the voltage drop over a longer wire if if it's carrying a significant current - probably not applicable in your case, but the cause of much grief when someone is using cheap USB cables to supply a Pi

The second is electromagnetic interference (EMI) pick-up.
The longer a wire is, the more energy it can pick up from the environment, and the higher the impedance of the circuit, the less energy required to cause problems.

Depending on quite what you mean by "a logical voltage shifter", its output may be quite high impedance, but unless you have used your own pull-up or -down resistors, the input to the Pi is certainly high impedance, meaning that only small induced currents can cause high voltages to be seen by the Pi.

There are three ways to reduce the problem.
One - use shorter wires, not helpful in your case.

Two - reduce the impedance of the circuit, by putting a 1k or less pull-up or -down resistor close to the Pi

Three - use two-core shielded cable.