bisraelwalter
Posts: 3
Joined: Tue May 05, 2020 5:48 am

Floating Pins

Tue May 05, 2020 6:16 am

Hello,

I have a Raspberry Pi that I'm using to take a picture with a usb webcam. Everything on it works great with one exception, the inputs. I am triggering the webcam to take a picture through a pin input by reading it and running a script when there is a state change. The output to trigger is coming from my pic32. I've tried using both pull-up and pull down on the raspberry pi but the pin still floats. I wrote a simple script to output the pin state every half-second so I can see it floating. I've tried using a physical pull-up and pull-down with 1k, 10k, 20k, and a 50k resistor. When I connect it to my o-scope there is no change in the state, but the pi still reports floating. I thought maybe that when I soldered the pins that I messed up but my work is clean and I've tried multiple GPIO pins with the same result. If nothing is connected to the pin, it doesn't float, but if I connect the same wire going to the pin on the pi to my o-scope, it does not float.

Has anyone seen this behavior before? My only workaround that I can think of is to send a packet over wifi to trigger the camera, but I don't want to rely on the network to trigger the camera. I will if I have to but I'd rather figure this issue out.

drgeoff
Posts: 10676
Joined: Wed Jan 25, 2012 6:39 pm

Re: Floating Pins

Tue May 05, 2020 9:37 am

I'll guess that your software's pin numbering convention is not matched to your interpretation of the GPIO numbers.

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

Re: Floating Pins

Tue May 05, 2020 10:23 am

Hi.

So first check you are actually connecting to the correct gpio pin

check your pin number ( BCM / BOARD ) using this site : https://pinout.xyz/#

secondly what voltage is your pic32 outputting ? pi gpio works at 3.3v and is not 5v tolerant .

If you are still having problems then I suggest you post pictures of your setup showing the connections between the pic32 and the pi clearly and the code you are using .

please use code tags when posting code.

Add [code] at the top

code goes here

and [/code] at the bottom.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Floating Pins

Tue May 05, 2020 4:05 pm

bisraelwalter wrote:
Tue May 05, 2020 6:16 am
The output to trigger is coming from my pic32.
Have you connected your PIC32's 0V to the Pi's 0V ?

emma1997
Posts: 774
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Floating Pins

Tue May 05, 2020 5:40 pm

Odd that anyone would repeatedly refer to ground as 0v. It's true there is 0v on ground but also on many other points that are not ground. Ground is by no means the same as 0v (at least in my country).

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Floating Pins

Tue May 05, 2020 6:18 pm

emma1997 wrote:
Tue May 05, 2020 5:40 pm
Odd that anyone would repeatedly refer to ground as 0v.
:?: I don't see any mention of "ground" in the thread. And I am the only one who referred to "0V". So are you suggesting I should be using "ground" rather than "0V" ?

:confused: - Confused

emma1997
Posts: 774
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Floating Pins

Tue May 05, 2020 7:38 pm

I'm probably the one who is confused. Last few weeks a few other cases of using 0v clearly indicating ground, probably other members not you. It's surprising how many beginners don't know about common ground. I sometimes fail to do it myself but out of forgetfulness, not lack of smarts, because I should know better.

So just to bring me up to speed, what did you mean? PIC output to Pi active low input?

drgeoff
Posts: 10676
Joined: Wed Jan 25, 2012 6:39 pm

Re: Floating Pins

Tue May 05, 2020 8:37 pm

To me "0 volts" or "0 volts rail" is more correct than ground. The first two are the voltage to which other voltages in circuit are referred as a Potential Difference. Often that "0 volts" is not at ground (= earth) potential. Indeed many wall-wart switch mode PSUs have their DC outputs sitting at half AC mains voltage by virtue of the small value capacitor from the "0 volts" side back to the negative output of the input bridge rectifier. If that PSU is, for example, charging a mobile phone there is no grounding.

bisraelwalter
Posts: 3
Joined: Tue May 05, 2020 5:48 am

Re: Floating Pins

Tue May 05, 2020 8:39 pm

drgeoff wrote:
Tue May 05, 2020 9:37 am
I'll guess that your software's pin numbering convention is not matched to your interpretation of the GPIO numbers.
This is possible but when I remove the wire from the pin, the state will stabilize to low. I've used the python RPi.GPIO and gpiozero library. The former required setup to use BCM and the latter, BCM is the default setting.
pcmanbob wrote: Hi.

So first check you are actually connecting to the correct gpio pin

check your pin number ( BCM / BOARD ) using this site : https://pinout.xyz/#

secondly what voltage is your pic32 outputting ? pi gpio works at 3.3v and is not 5v tolerant .

If you are still having problems then I suggest you post pictures of your setup showing the connections between the pic32 and the pi clearly and the code you are using .

please use code tags when posting code.

Add [code] at the top

code goes here

and [/code] at the bottom.
I'll reverse the direction to output to verify that I'm using the correct pin layout. I did use the link you provided and you can use the command 'pinout' on the board for the layout as well.

The voltage for the pic32 is 3.3v.
hippy wrote:
bisraelwalter wrote:
Tue May 05, 2020 6:16 am
The output to trigger is coming from my pic32.
Have you connected your PIC32's 0V to the Pi's 0V ?
I'll give this a try. I knew what you meant when you used '0V' but I do agree that 'ground' is the right term.
emma1997 wrote: I'm probably the one who is confused. Last few weeks a few other cases of using 0v clearly indicating ground, probably other members not you. It's surprising how many beginners don't know about common ground. I sometimes fail to do it myself but out of forgetfulness, not lack of smarts, because I should know better.

So just to bring me up to speed, what did you mean? PIC output to Pi active low input?
My pic32 is the source of the signal. I've tried using active low and active high.


Thanks all for the replies. I'll try the suggestions and if it doesn't work, I'll post some pics and code.

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Floating Pins

Tue May 05, 2020 9:23 pm

bisraelwalter wrote:
Tue May 05, 2020 8:39 pm
hippy wrote: Have you connected your PIC32's 0V to the Pi's 0V ?
I'll give this a try. I knew what you meant when you used '0V' but I do agree that 'ground' is the right term.
I am never going to agree, detest the use of "ground" and "earth" except when referring to a contact hammered into the planet's soil, so we'll have to agree to disagree.

Form "I'll give it a try" I would guess that whatever it's called wasn't connected. If so that's almost certainly a major part of the problem.

emma1997
Posts: 774
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Floating Pins

Tue May 05, 2020 10:03 pm

hippy wrote:
Tue May 05, 2020 9:23 pm
I am never going to agree, detest the use of "ground" and "earth" except when referring to a contact hammered into the planet's soil, so we'll have to agree to disagree.
drgeoff wrote:
Tue May 05, 2020 8:37 pm
To me "0 volts" or "0 volts rail" is more correct than ground. The first two are the voltage to which other voltages in circuit are referred as a Potential Difference. Often that "0 volts" is not at ground (= earth) potential.
So that makes two of you out of 7 billion. Although drgeoff seems to be waffling. lol. I'm guessing now that actually was hippy in all those previous posts too. I will repeat that ground is always 0v but not all 0v points (ie pin output) are ground so don't make a lot of sense.

Generally in the field of EE all voltages are in reference to 'ground', be it chassis or earth. Including 0v readings which may or may not be ground, but definitely not the same thing. Like Billy The Bard said: a rose by any other name... still not 0v.

In any case thanks for clearing up my confusion, or lack of.

bisraelwalter
Posts: 3
Joined: Tue May 05, 2020 5:48 am

Re: Floating Pins

Wed May 06, 2020 3:36 am

hippy wrote:
bisraelwalter wrote:
Tue May 05, 2020 6:16 am
The output to trigger is coming from my pic32.
Have you connected your PIC32's 0V to the Pi's 0V ?

I was eating in the cafeteria at work when I read this and felt this was the answer but I didn't want to get ahead of myself and get too excited. I deleted what I originally wrote which was along the lines of this is most likely the reason AND IT WAS!!!!!!

If I could give you a hug, I would. Instead, I will change my 0V stance.

Thank you and thanks to everyone else here. I appreciate the help. Hopefully this post will help someone else too.

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

Re: Floating Pins

Wed May 06, 2020 9:25 am

emma1997 wrote:
Tue May 05, 2020 10:03 pm
hippy wrote:
Tue May 05, 2020 9:23 pm
I am never going to agree, detest the use of "ground" and "earth" except when referring to a contact hammered into the planet's soil, so we'll have to agree to disagree.
drgeoff wrote:
Tue May 05, 2020 8:37 pm
To me "0 volts" or "0 volts rail" is more correct than ground. The first two are the voltage to which other voltages in circuit are referred as a Potential Difference. Often that "0 volts" is not at ground (= earth) potential.
So that makes two of you out of 7 billion.
At least three
I will repeat that ground is always 0v but not all 0v points (ie pin output) are ground so don't make a lot of sense.

Generally in the field of EE all voltages are in reference to 'ground', be it chassis or earth. Including 0v readings which may or may not be ground, but definitely not the same thing.
That sounds like "All chickens are hens but not all hens are chickens"

If a bloke is lying flat his head is at zero feet above his feet whether he's on the beach or in a 747 crossing the channel; if he's standing on a ladder or on the floor, his head is five foot eleven inches above his feet.
The reference point is his feet, whatever you want to call it. Calling it "Ground" just confuses things, because it may be nowhere near the ground, and "Earth" to an astronaut is different again.

As to "chassis", one thing I learned fairly quickly was that having my left foot on the chassis of the 70kVA generator and my right foot on the ground could be painful, unless someone had taken care to make it not.

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Floating Pins

Wed May 06, 2020 1:05 pm

Burngate wrote:
Wed May 06, 2020 9:25 am
That sounds like "All chickens are hens but not all hens are chickens"
Indeed but it's not worth arguing over. I also detest the use of "momentarily" used to mean imminently but it won't stop those who use it telling me that it's the correct word to use, or insisting that the only correct spellings are "aluminum", "analog", "color", etc, and any other spelling is outright wrong. One often might as well be arguing with a flat-earther; they are right, everyone else is wrong, end of.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13009
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Floating Pins

Wed May 06, 2020 2:11 pm

In electronics the reference rail (0 volt rail) is commonly called GND or "signal ground".

If you are referencing the electric potential the earth is at we normally call that "ground" or "earth" potential.

In schematics there are different symbols for them:
Image

And no, GND doesn't have to be the same potential as "earth", in fact it often isn't as the RPI is normally power from a double isolated power supply, and so "GND" is floating relative to "earth", and there may be a large (but low power) voltage difference between the two.

Normally the only galvanic connection between the RPI's GND level and earth is through the HDMI cable, but monitors are often not grounded either, which can led to the infamous "halve mains voltage problem" where the GND can be floating with 50% of the mains voltage relative to earth on it. Due to AC voltage leaking through the monitors power filter caps.

emma1997
Posts: 774
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Floating Pins

Wed May 06, 2020 5:07 pm

That does sum it up. And a major reason to usually only 'ground' one end of shield on USB and some other cables to prevent unwanted current draw and noise.

IMO ok for hippy to use or avoid or reinterpret whatever terms he wants as long as he qualifies for the purpose of any particular conversation. I understood what he meant by 0v in previous posts but a couple of my local ham pals were more confused and took great exception. Tempest in a teacup at a local club meeting.

Anyway, arguing about it may not be necessary but is big fun. After all this is THE INTERNET. lol

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Floating Pins

Wed May 06, 2020 5:58 pm

mahjongg wrote:
Wed May 06, 2020 2:11 pm
In schematics there are different symbols for them:
Image
What I have never understood is why the official Pi schematics went from using "Signal Ground" to "Earth Ground". Neither are correct and accurate in my view.

Perhaps that's added somewhat to the confusion. I guess it is more common to use "Earth Ground" ( no matter that I consider it incorrect ) and it's easier to go with the herd. I always use ┴

Perhaps that's a European convention which distinguishes it from something which connects to an earth stake driven into the soil and a chassis connection.

drgeoff
Posts: 10676
Joined: Wed Jan 25, 2012 6:39 pm

Re: Floating Pins

Wed May 06, 2020 6:10 pm

hippy wrote:
Wed May 06, 2020 5:58 pm
mahjongg wrote:
Wed May 06, 2020 2:11 pm
In schematics there are different symbols for them:
Image
What I have never understood is why the official Pi schematics went from using "Signal Ground" to "Earth Ground". Neither are correct and accurate in my view.

Perhaps that's added somewhat to the confusion. I guess it is more common to use "Earth Ground" ( no matter that I consider it incorrect ) and it's easier to go with the herd. I always use ┴

Perhaps that's a European convention which distinguishes it from something which connects to an earth stake driven into the soil and a chassis connection.
Most mistakes are made unwittingly by people who don't know what is correct. My experience is that there is no shortage of such people in any field. :)

hippy
Posts: 7459
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Floating Pins

Wed May 06, 2020 6:30 pm

A quick whiz through Google Images shows that it may be a cultural or 'by rote' difference.

Looking at Elektor and a few other European magazines; they use ┴ as I always have. Sinclair Electronics uses ┴ , while Acorn Atom and BBC Micro circuits use the earlier form of ┴ with a blob and "0V" indicated. R A Penfold uses ┴ but acknowledges the 'with blob' use.

I guess I just followed that ┴ convention.

Forrest Mims, more familiar to an American audience, ( incorrectly IMO ) uses the "Earth Ground" so I imagine a lot simply followed that convention.

Return to “Troubleshooting”