3

Heyo!

How to control single 12V LED using Raspberry's GPIO?

To be more exact, I need to connect 12V LED & push button to Raspberry Pi 3 B+ GPIO in order to control LED (on/off) and read button push events.

I'm gonna use this huge momentary push button that has a 12V LED illumination inside.

I'm building a small arcade-like machine. I am a programmer w/o any experience in soldering. Frankly, this is my first project of this kind.

Please, help me to draw a simple circuit that just works.

As I understand it's easy to connect button, the tricky part is to control LED, right?

Thank you!

UPDATE:

I've just noticed that button description contains this line: "push button ... comes complete with 5v bulb ...", so maybe LED is 5v/12v! I don't know if this info will help to simplify the circuit.

2
  • 2
    Better off to start experimenting with a separate switch and a 'regular' LED. You don't have sufficient specs from the linked website, as it is horribly conflicted. How do you reconcile the title "5/12V Large Dome Light Switch" with the text "comes complete with 5v bulb" with the list text "1 x 12V LED Lamp" - is it 5v or 12v? Also current is not given. Additionally, how do you reconcile "Shipping: US $4.52 to United States via China Post Registered Air Mail" with "4.) Free Shipping from USA." Seems like a very dodgy website.
    – Glen Yates
    Commented Feb 22, 2019 at 19:19
  • 1
    You'd be more likely to get a proper answer if you could supply a schematic or link to a spec sheet for the pushbutton switch. I followed the link you provided, but didn't see that information.
    – Seamus
    Commented Feb 24, 2019 at 6:52

2 Answers 2

4

As per your requrement if your LED supply is 12v then you can't connect LED directly to GPIO pins. Because it only give 3.5v & 50mA at output. Simply you connect driver circuit between LED and raspberry pi. If you want simple ON/OFF function then you go with simple transistor driver or MOSFET driver. Both driver has its own advantages and disadvantages. So according to your requrement you choose driver circuit. For total system you can use 12v DC supply, for raspberry pi you use 7805 IC with heatsink as a voltage regulator.

1
  • 2
    Good answer, but you could make it better still by adding a schematic to illustrate how to connect the components of a "driver circuit". Here's how to use the schematic tool.
    – Seamus
    Commented Feb 24, 2019 at 6:47
2

You are better off asking electronics questions on a dedicated electronics site.

The Pi's GPIO are 3V3 only so can't be used to directly provide power to a 12 volt LED.

You will need to use a transistor to switch the 12V supply on and off for the LED. You can use a Pi GPIO to switch the transistor on and off.

If you search on line you will find hundreds of example circuits.

Also look through the free MagPi magazine for lots of help.

https://www.raspberrypi.org/magpi/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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