Totemi1324
Posts: 2
Joined: Wed Aug 14, 2019 10:20 am

Longer cable for GPIO-sensor?

Thu Sep 05, 2019 5:02 pm

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!

pcmanbob
Posts: 6906
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Longer cable for GPIO-sensor?

Thu Sep 05, 2019 5:45 pm

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.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

LTolledo
Posts: 1942
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Longer cable for GPIO-sensor?

Thu Sep 05, 2019 9:23 pm

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...
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

ProDigit
Posts: 374
Joined: Tue Aug 30, 2011 1:24 am

Re: Longer cable for GPIO-sensor?

Thu Sep 05, 2019 10:35 pm

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

User avatar
rpdom
Posts: 15173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Longer cable for GPIO-sensor?

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!)
[/quote]

ProDigit
Posts: 374
Joined: Tue Aug 30, 2011 1:24 am

Re: Longer cable for GPIO-sensor?

Fri Sep 06, 2019 12:03 am

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.

User avatar
rpdom
Posts: 15173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Longer cable for GPIO-sensor?

Fri Sep 06, 2019 4:54 am

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.

LTolledo
Posts: 1942
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Longer cable for GPIO-sensor?

Fri Sep 06, 2019 3:20 pm

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....
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

ProDigit
Posts: 374
Joined: Tue Aug 30, 2011 1:24 am

Re: Longer cable for GPIO-sensor?

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.

User avatar
rpdom
Posts: 15173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Longer cable for GPIO-sensor?

Sat Sep 07, 2019 5:53 am

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.

User avatar
Burngate
Posts: 6002
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Longer cable for GPIO-sensor?

Sat Sep 07, 2019 9:38 am

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.

Return to “Automation, sensing and robotics”