i'm new in raspberry pi. i want to parallel powered my raspberry pi with 12 v and 5 amp, because i want to powered not just the raspberry pi. i want to powered a solenoid too that run in 12 volt and 4 amp. so i have a idea to powered it from gpio, but refer to this link, the raspberry pi can't powered from the gpio. does anyone has a solution to powered the raspberry pi besides from usb c power supply ? thank you very much and pardon my english.

  • 1
    If you actually read the posts that you linked you would find the Foundation documentation and realise that it is possible.
    – Milliways
    Commented May 7, 2020 at 8:18
  • Hi @farhan, Welcome and nice to meet you. Ah, let me see. (1) First thing first, a warning: (a) Relays and solenoids, whether 5V or 12V have "Back EMF" which might fry Rpi or other hardware stuff. So it is better to use optical isolation, to prevent noise, EMF, EMI etc. (Yes I fried two PSUs last year) (2) You might search rpi.org.forum: raspberrypi.org/forums/search.php?keywords=relay+tlfong01, Searched query: "relay" "tlfong01" - Search found 480 matches: relay tlfong01. / to continue, ...
    – tlfong01
    Commented May 9, 2020 at 2:03
  • You might find the following few of my 480 posts useful: (3) raspberrypi.org/forums/… (4) raspberrypi.org/forums/… (5) raspberrypi.org/forums/… (6) raspberrypi.org/forums/…. / to continue, ...
    – tlfong01
    Commented May 9, 2020 at 2:05
  • By the way, usually you use a relay to control a solenoid valve, solenoid door lock etc. So you need to know how to use a relay. In case you find the above posts a bit too advanced, you might like to start with the fundamentals: Re: Relay Module KY-019 5V - tlfong01, rpi.org.forum, 2018jun02, 16,025 views raspberrypi.org/forums/viewtopic.php?f=37&t=77158#p1323061 Have a great project, yours faithfully, tlfong01. Cheers.
    – tlfong01
    Commented May 9, 2020 at 2:14

1 Answer 1


This is how to do it:


simulate this circuit – Schematic created using CircuitLab

Ordinarily, solenoids are used to actuate a mechanical device, and have a "control" input that is typically connected to a switch. However, as you've not provided any details on the solenoid or the application, I've shown a manual toggle switch in the schematic. This can be replaced with a relay or a transistor if needed.

I think the rest of the circuit is self-explanatory, but please let us know if you have questions.

You could have searched for a Raspberry Pi pinout, and you would have found something like this for the RPi 4B.

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.