LED not lighting on a 3-prong LED Switch

First off, I am not new to DC circuits but it has been a while since I have worked with them, but I am relatively experienced with coding.

I have been using a Sparkfun Pro Micro 5V/16MHz to build a game flight controller. Some of the switches I will install have 12v LEDs in the tips that I power from the 5v VCC port on the Pro Micro. The switches are supposed to light up when closed and ground the TX0 port (or any arduino pin I am using for this) so the pin will read a digital LOW. I have the pin pulled high with a 330 Ohm resistor (for current limiting of the LED).

The issue I'm having is that the LED and pull to ground don't both happen when the switch is closed. The LED works if just the power (middle pin on switch) and LED ground (left on switch) are connected. However, when the accessory pin (right on switch) connects to ground, the LED shuts off and TX0 is pulled LOW. I'm trying to figure out a way for both the pin to be pulled LOW and the LED light up when the switch is closed.

I've tried other resistors in various spots to no avail. My current theory is that the accessory pin grounds the whole signal so no current passes through the LED when the switch is closed. Do I need something like a diode or transistor? I have been researching those a bit and I feel that they would complicate things on the board.


Do you have a data sheet for the switch? Or a part number?

No sheet unfortunately, but this is the link to amazon where I got them.

It appears there is a third terminal which is floating. By your definition that is a pin. Also you have wires going to ???. A schematic would be better then this frizzy thing. Also show all power supplies and the sources. If powering with USB say so. All three pins need to be connected to make it work the way you say.

I would suggest "mapping" out the switch to see how it works. For example, use a multimeter in continuity mode to see what pins close when the switch is pushed, and vice versa. See what is connected to what and once you have an idea of how the switch works them show us it with a schematic. Post that picture and we will be able to help you out much more. I am pretty sure I know how your switch works because I have seen similar issues before, but if you can show us how the switch works in a schematic we can most likely get it fixed for you.

Until you check I don't know for certain, but I believe that switch is meant to pull something high.

It might work if you:
Ground the top left terminal.
Connect the middle terminal through a resistor (you chose 330r so you can go with that) to Vcc.
Use the top right terminal to pull an Arduino pin high.

You could use a NOT gate if you want the switch to pull something low, but if you could pull the Arduino pin high that would be easier. You may need another resistor on the top right terminal if the 330r resistor would put too much current into the Arduino pin while bringing it high.

Without a schematic or a datasheet I can't know for certain if that is how your switch works, but it sounds like that to me.

If that's how your switch works and you don't want to use a NOT gate, you could dismantle the switch and reverse the polarity of the LED, but I wouldn't suggest doing that until you know for sure how the switch works.

Hope this helps.

In my imagination, the switch, when closed, connects "+" to "light" terminals, and when open, connects nothing. The "light" terminal is connected to "ground" terminal by the led and series resistor (chosen for 12V).

If I'm right, the way to connect it would be "ground" to ground, "+" to 5V and "light" to an Arduino pin, with an external pull-down resistor (10K).

It would even be possible to light the led when the switch is off/open by changing the Arduino pin to OUTPUT, HIGH. But take care not to set the pin to OUTPUT, LOW, because a short circuit would occur if the switch were on/closed. A low value resistor between the "light" terminal and the Arduino pin would project against a short circuit but would also make the led dimmer.

The switch has an internal resistor.
You need to use 12 volts, which is to be fed to the tab with the + symbol.
If you switch to the ON position, the tab at the right side of your picture will be connected to that 12 volts.
The anode of the LED is connected through a resistor to that same tab.
The cathode is connected to the tab with the GND symbol.
This means you cannot use this switch to pull down some voltage like you seem to have tried, without losing the LED function.
And you cannot directly connect to an Arduino pin without a voltage divider, trying to do that will destroy (part of) your Arduino.

@MAS3 you confirmed how I imagined the switch's internal circuit, thanks!

But it can be used with only 5V, you do not have to use 12V. The led will be dimmer than the manufacturer intended. Only the OP can say if it is bright enough for their project. If it is not, opening the switch to change the resistor may be difficult and possibly destroy the switch. The only other option is to use 12V and a voltage divider as you suggested.

I hope the datasheet of the switch might help you in this regard.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.