1

I have a raspberry Pi 3, and am looking to use a 3 wire automotive LED switch (think missile switch or lighted rocker switch) to trigger a GPIO pin, and power the LED when in the on position.

If I use the positive terminal and the ACC terminal (the one on the bottom right), for the switch, this works ok. But I don't think that's how it's supposed to be wired up. When I wire the switch per the markings, it only intermittently triggers the GPIO pin.

Has anyone built a circuit/switch with this configuration?

Switch Terminals Back Switch Terminals Front

  • There are plenty of tutorials online, regarding the GPIO and switches, give those a look first. – Darth Vader May 18 '16 at 7:08
  • Yes, and like I mentioned, I have no problem triggering the input, but it's really the switch that doesn't seem to work - I can use to to trigger the GPIO pin, but I can't also get the LED to light at the same time. It's an automotive type switch with a light built in. – Arlo May 18 '16 at 7:12
  • if it is ab auto switch it may require 12 volts. if you connect 3. 3 volts and ground from the Pi does the LED light? If the terminals are not marked have you tried reversing the power and ground. If that works you can simply replace the 3.3 volt connection with one of the GPIO's. A picture of the switch and any other data would help us help you. – Steve Robillard May 18 '16 at 7:19
  • As @SteveRobillard said, it's important to know the LED specification here. If you have a datasheet, or manufacturer and part number, for the switch we can help – NoChecksum May 18 '16 at 9:14
  • Thanks guys - I'll post a picture and part number if I can find it. – Arlo May 18 '16 at 18:14
1

The solution in the end is using a pull-down resistor set up since the switch provides power (3.3V in this case) to the ACC (accessory) terminal when on. Whereas a simple on/off switch just connects one terminal to the other.

Solution to my situation (and hopefully anyone else wanting to use a 3-terminal LED type switch):

0

Unfortunately they product description is all but clear and there is no datasheet available. From the product description however we learn:

This simple on-off switch is rated for 20A at 12V [...] Note: The LED can be illuminated with as low as 3.3V.

To me that reads: connect anything between 3.3V and 12V and both the switch operates and the LED works fine. In my book that would include a current limiting resistor for the LED inside the switch, albeit one of the review suggests to have killed the LED while operating it without a resistor. Using 3.3V is also in the range of what the Pi's GPIO pins can handle. Yeah!

The review furthermore explains how to wire the switch as follows:

There are 3 connection points. Apply voltage (12V) to the +. Apply ground to the Ground symbol. The third pin is your output pin for when the toggle is active. These are generally used in automotive applications (12V) however, they can be used in other applications, hence the note about how low the LED will operate.

and

I measured the voltage drop across the LED as 1.9V

Combining all the information I'd suggest to do the following:

  • Connect 3.3V via a 1.5kOhm resistor to the + pin of the switch. If the switch has no internal resistor for the LED this would limit the current to about 1mA (quite low for the LED to be on the safe side). The resistor should also not prevent the switch from properly toggling its output.
  • Connect GND to the earth pin of the switch.
  • Connect a voltmeter to the third pin of the switch (or a GPIO pin of the pin, if you dare).

If the output toggles according to the switch but the LED does not light up - decrease resistor. Again, I find it strange to believe that there is no appropriate resistor integrated but you're about to find out.

  • Thanks Ghanima - I need to go buy voltmeter actually. So I'll check that out - perhaps voltage drop isn't always enough or something to trigger the pin when it's wired as instructed (I've also looked at some other SPST lighted switch diagrams and it should be the same). – Arlo May 19 '16 at 0:57
  • Finally got my multimeter and, per the design of the switch, the (+) and (-) terminals are connected to power and ground respectively, and when the switch is off, the ACC (third terminal) registers about 0.6V, and when on, it's the full 3.3V. This will also power the LED. However, the way I understand GPIO pins, is that to trigger them, they need to be grounded or not. So if I am able to turn 3.3V on or off with that third terminal, is there a way to trigger the pin? I haven't been able to find anything out there about that, because it seems like that's just not how the GPIO pin works. – Arlo May 24 '16 at 4:21
  • Ok, I figured it out! Yay! Learning more about pull-up and pull-down resistors/circuits, I've now got my switch working so that the LED comes on when the switch is on, and using a pull-down set up, I can now also trigger the GPIO pin consistently. Thank you all for pointing me in the right direction - I love this tiny computer :-) – Arlo May 24 '16 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.