Cable between 3.3v and GPIO with on/off switch
I want to have a couple of leds powered by the 3.3v output. I want to have a on/off switch on the cable, and I want to know when the leds are on and off.
I have two problems.
The leds cannot be connected 3.3v - GPIO as the gpio in does not allow enough ampere to let them shine bright. If I connect 3.3v - (GPIO & GND) then I cant identify if the switch is flipped or not.
The second problem - If I ignore that the lights are dim - when having the switch on i get a clear on signal, but when I have the switch off - I guess the cable works as an antenna and rapidly switches between on/off on the rpi.
I would really like a solution where I get bright shining leds and I didn't have to get a switch that grounds the wire when off (currently it is a simple table-lamp-light-switch).
Any Ideas?
Posted Jun 5, 2015, 1:17 PM UTC
Not sure I wholly understand the issue, but it sounds like it can be solved by a field effect transistor?
Sorry, I tried to read the wiki for Field effect transistors - but it didn't help me.
Basically I want this 3.3v --- [switch] -- [LED] -- GPIO, so that when the switch is hit the LED shines and I can read GPIO input to see the state of the switch. My two problems are that, the GPIO cannot drain enough to make the LED shine bright, and, when the switch is off then the input on GPIO changes between on/off because it is not connected to either ground or 3.3v. (I guess the second problem is lesser than the first)
Why not a SPDT that's connecting a power supply to an LED and connected to the GPIOs?
I have not been able to find an SPDT that looks like a lamp button, and I only manage to think out a solution that solves the GPIO input flickering problem, but not one that solves the problem with the LED not shining bright.
(Btw, assuming SPDT means http://en.wikipedia.org/wiki/Switch#Contact_terminology )
[deleted]