RonMcJack
Posts: 5
Joined: Wed May 30, 2012 6:01 pm

Why does my LED light up when connected to 3v3 OR ground?

Sat Jun 23, 2012 8:33 pm

Hi all,

Very confused as to why this can even happen? I've got the 3v3 line and the ground line attached to my breadboard and the GPIO lines attached too. If I attach a 330ohm resistor in series with an led to from the GPIO to the 3v3 line. It works when the python script is executed. If I swap the 3v3 line to the ground line and execute the script it works just the same? I thought LEDs don't work backwards? If they dont, which direction is the current going in both cases?

domesday
Posts: 258
Joined: Fri Oct 21, 2011 5:53 pm
Location: UK

Re: Why does my LED light up when connected to 3v3 OR ground

Sat Jun 23, 2012 9:02 pm

Can you post a photo ?

RonMcJack
Posts: 5
Joined: Wed May 30, 2012 6:01 pm

Re: Why does my LED light up when connected to 3v3 OR ground

Sat Jun 23, 2012 9:09 pm

https://dl.dropbox.com/u/342006/VIDEO0073.3gp I've got a video. Red wire is the 3v3 black is 0v and the green is the GPIO. The resistor leg is attached to the 3v3 line in the video but works when connected to the 0v line too.

domesday
Posts: 258
Joined: Fri Oct 21, 2011 5:53 pm
Location: UK

Re: Why does my LED light up when connected to 3v3 OR ground

Sat Jun 23, 2012 9:56 pm

Sorry can't see the video, perhaps someone else can look at it and figure out what is going on.

User avatar
Gert van Loo
Posts: 2409
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Why does my LED light up when connected to 3v3 OR ground

Sat Jun 23, 2012 10:47 pm

Let me guess: You have one side connected to the GPIO and the other to either 3V3 or ground.
Yes it will light both times. And if I tell you why you will say Duh! Of course.
I'll give you one tip: Do no switch the GPIO continuously high/low but manually high or low.
Check the LED orientation and check if it lights when the GPIO is low or when it is high.

Good luck in figuring it out!

(Post edit, can I plead others NOT to explain :-) )

-- Gert

ksangeelee
Posts: 192
Joined: Sun Dec 25, 2011 5:25 pm
Location: Edinburgh, UK
Contact: Website

Re: Why does my LED light up when connected to 3v3 OR ground

Sat Jun 23, 2012 10:57 pm

Gert van Loo wrote:Good luck in figuring it out!

(Post edit, can I plead others NOT to explain :-) )

-- Gert
You edited just in time to prevent me spoiling all the fun. I'll wash my hands of this one!

User avatar
Gert van Loo
Posts: 2409
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Why does my LED light up when connected to 3v3 OR ground

Sat Jun 23, 2012 11:08 pm

ksangeelee wrote:
Gert van Loo wrote:Good luck in figuring it out!

(Post edit, can I plead others NOT to explain :-) )

-- Gert
You edited just in time to prevent me spoiling all the fun. I'll wash my hands of this one!
My experience is that people learn a lot more if they experience the Oooohhh YYyeeeesssss!!!

ksangeelee
Posts: 192
Joined: Sun Dec 25, 2011 5:25 pm
Location: Edinburgh, UK
Contact: Website

Re: Why does my LED light up when connected to 3v3 OR ground

Sun Jun 24, 2012 7:41 pm

Gert van Loo wrote:My experience is that people learn a lot more if they experience the Oooohhh YYyeeeesssss!!!
I agree with that statement, but because of the disparate nature of the Raspberry Pi documentation, and the incomplete datasheet, it's by no means obvious that a GPIO pin, when configured as an output, will source current when high, and sink current (act as ground) when low.

User avatar
Gert van Loo
Posts: 2409
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Why does my LED light up when connected to 3v3 OR ground

Sun Jun 24, 2012 7:49 pm

ksangeelee wrote:
Gert van Loo wrote:My experience is that people learn a lot more if they experience the Oooohhh YYyeeeesssss!!!
I agree with that statement, but because of the disparate nature of the Raspberry Pi documentation, and the incomplete datasheet, it's by no means obvious that a GPIO pin, when configured as an output, will source current when high, and sink current (act as ground) when low.
I can't completely agree with that.
In general if you talk about an output pin of a device it can source as well as sink.
The only time an output pin can NOT source would be if it is an open collector in which case you should expect that to be clearly mentioned.

I have seen no more posts so I suggest you tell him why it lights BOTH ways.
(I thought about it but to have the LED light both ways you can't just move one pin between VCC and GND. You also must swap it around.)

ksangeelee
Posts: 192
Joined: Sun Dec 25, 2011 5:25 pm
Location: Edinburgh, UK
Contact: Website

Re: Why does my LED light up when connected to 3v3 OR ground

Sun Jun 24, 2012 9:52 pm

RonMcJack wrote:https://dl.dropbox.com/u/342006/VIDEO0073.3gp I've got a video. Red wire is the 3v3 black is 0v and the green is the GPIO. The resistor leg is attached to the 3v3 line in the video but works when connected to the 0v line too.
Given that the ground rail plays no part in the circuit (since the GPIO pin is sinking the current through the LED), you might want to measure the voltage between what you think is ground and what appears to be 3v3 (video isn't clear enough to see the flat side of the LED).

Perhaps you've actually got 3v3 there too? That ribbon cable looks spliced and twisted, maybe you translated the pins incorrectly? In any case, that multimeter in the video background will confirm.

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

Re: Why does my LED light up when connected to 3v3 OR ground

Mon Jun 25, 2012 8:38 am

My suggestion would be to put in a second LED with resistor, and connect one to each of the red and black.
If your red and black are really 3v3 and 0v, and the LEDs are the same way round (anode to green) then only one should blink.
If you turn one LED round they should blink alternately (or neither will light)
If you've mixed up the pins so that one of the red or black isn't what you think it is, then they'll blink synchronously.

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 22 guests