I have a question about the Solenoid lock: can I use it with a 12v relay module without an external power supply?

I'm using Raspberry pi 3 model B.

  • Yes, you can use batteries, eg, Lip0, lead acid etc: raspberrypi.stackexchange.com/questions/124290/…
    – tlfong01
    Apr 11, 2023 at 2:47
  • 1
    @tlfong01 a battery is an external power supply
    – jsotola
    Apr 11, 2023 at 6:06
  • There's only 3.3V & 5V available on an RPi so you'd need a buck converter to run a 12V solenoid. It would be possible if the current draw for the buck converter & solenoid is tiny but you'll be better off with a battery or 12V external power supply.
    – Dougie
    Apr 11, 2023 at 6:44
  • Please edit your question and add more details about "the Solenoid lock". (Model, type, link to data sheet.) Electromagnetic components draw a fairly high current and and can create currents when switched off. You normally need an external transistor and protective circuitry like a flyback diode or maybe even a relay, and external power supply.
    – Bodo
    Apr 11, 2023 at 15:34
  • Thank you everyone, but I think you didn't get my question someone told me that I can use relay module with 12v without needing an external power supply so that's why I'm asking.
    – Sh2071
    Apr 12, 2023 at 15:35

1 Answer 1


Your question is a bit vague. Perhaps the best answer is to show a couple of alternatives schematically:

I'll assume that your reference to "a 12v relay module without an external power supply" is blether, and your question is rather how to supply 12V of power to a Solenoid-driven door lock.

The answer to that question is an unqualified "it depends on how much power is required"! Shown below are two approaches:

Option 1:

IF your Solenoid doesn't require more than say 100 milliamps of current at 12VDC, you may be able to add a DC-DC converter to boost the 5V RPi Supply up to 12VDC as shown below.


simulate this circuit – Schematic created using CircuitLab

Option 2:

But unless you've got a substantial 5V RPi supply, I think the external supply may be a better option - shown below:


simulate this circuit

Other Details:

These schematics aren't detailed enough to actually build a circuit. That's because you didn't give enough information to support these details. Suggest you now do a bit of homework, and edit your question to make it clear enough to allow someone to help with a properly detailed answer.

  • Ok thank you so much.
    – Sh2071
    Apr 12, 2023 at 15:36

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.