I'm working on a project to take a mic input (over USB) on a RPi 2 and trigger the action of white LEDs lighting up and a Solenoid Lock activating by turning GPIO pins to ON. However, I'm far from confident in my own ability to create circuits that are correct, so I thought I'd make sure here that I'm on the right track.

I'm using a solenoid lock from Adafruit (this one) that needs 12V and takes 0.5A to fully charge the electromagnet. To move from 5V on the RPi 2 to 12V needed for the lock, I'm looking at using a flexible DC Booster. The LEDs are Adafruit Sequins.

So, my questions are just two: 1) is my wiring diagram anywhere close? and 2) can I use just any GPIO pins as ON/OFF switches to complete each circuit?

Thank you to anyone willing to lend a word!

Raspberry Pi with LEDs and Lock Solenoid Fritz Diagram


Comments on the circuit:

  • The transistor Q1 needs to swap the collector and emitter, so the emitter (with the arrow) is the one connected to ground.
  • The GPIO5 connection isn't right, because it connects directly to ground, making it useless (if you drive it high, it will likely burn out due to driving too much current directly to ground). Similar to Q1, put another transistor between the LEDs and ground, with GPIO5 connected via a resistor to the transistor's base.
  • Each LED also needs a series resistor to control the amount of current that goes through it.

Can I use just any GPIO pins as ON/OFF switches to complete each circuit?

Each GPIO has a maximum current limit. If the GPIO is driving something that uses no more than that current limit, then you can connect it directly. Otherwise, you need to have the GPIO drive a transistor that can handle the current of the circuit it's driving.

| improve this answer | |
  • Thank you - your reply was extremely helpful. Ok, so I have a couple more questions in follow up. 1) Can the resistor/transistor for GPIO5 be the same ones (2.2k ohm and the TIP120)? 2) Each LED has a 100 ohm resistor already in series on its board, will that do? – Steve-o Dec 1 '16 at 2:09
  • Also, I realize now I believe I could connect the LED parallels straight to GPIO5 and ground instead. I'm seeing the Adafruit peeps do it here: youtu.be/c7H5dYH_ghE – Steve-o Dec 1 '16 at 2:22
  • @Steve-o If this answer help you, so please accept it with a click on the tick on its left side. Only accepting an answer will finish your question and it will not pop up again and again for years. If you have additional questions, please open a new question for each. – Ingo May 23 at 9:52

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.