I am building a smart lock and while the software and hardware parts are OK, the electronics part are an adventure for me.

I have an old 230-12V power unit and I need to use it to power both a Raspberry Pi (5V) and the lock (12V). I found a 12→5V converter and the last part remaining is to be able to control the 12V power with an RPi GPIO.

What is the kind of device I am supposed to look at? I am ready to dive in but need a pointer in the right direction.

I would very much prefer a device that is ready to use, but soldering is probably not a problem either.

I imagine that I could build a PBC on which everything would be in one place, nice and compact but this will be for a future exercise (maybe the low power part would come pretty soon, mains will wait)

  • \$\begingroup\$ You should look for "12V relay driver circuit", search engine images. Тhat's a big hint. \$\endgroup\$
    – Peter MP
    Jul 6 at 16:26
  • \$\begingroup\$ The most straight-forward way is to use a low-side switch with a n-MOSFET or a npn transistor. \$\endgroup\$
    – Sim Son
    Jul 6 at 16:40
  • 1
    \$\begingroup\$ Does this answer your question? Low side driver and flyback diode You may have to search for samples as 1k reels are most common.. Like Newark \$\endgroup\$ Jul 6 at 16:42
  • \$\begingroup\$ A Solid State Relay (SSR) is another possible choice. Though I would most likely use the low side switch if the circuit allowed. \$\endgroup\$
    – Aaron
    Jul 6 at 17:45

2 Answers 2


I would consider going to your favorite china supplier or even ebay etc. Use this term: "arduino switch opto" and expect a large choice of devices. The first one I looked at stated: "5pcs 15A 400W MOS FET Trigger Switch Drive Module PWM Regulator Control Panel for arduino DC 5V 12V 36V" Looking at the spec on Aliexpress and other places it gave the following: Specifications and applications: YXD WISH The following copied from there ad.

1: Operating Voltage: DC 5V - 36V;

2: The trigger source: digital high-low (DC3.3V - 20V), can be connected microcontroller IO port, PLC interfaces, DC power, you can access the PWM signal, the signal frequency 0--20KHZ perfect support.

3: output capacity: DC DC 5V - 36V, at room temperature, continuous current 15A, power 400W! Lower auxiliary cooling conditions, the maximum current up to 30A.

4: Applications: You can control the output of power equipment, motors, light bulbs, LED lights, DC motors, micro-pumps, solenoid valves, etc. you can enter

PWM, motor speed control, lamp brightness.

5: Availability: unlimited switch, Operating temperature: -40-85

The pricing was under $5.00 delivered to the US. There are many options from several suppliers. I have several that are rated at about 45 Amps and they work great.


It's always best to search for solutions with progressively narrower searches on keywords. (Socratic method, where you interact with the search engine)

Then you might find a way to do it with spares, low cost and ESD/EOS safe soldering.

I suggest a fully protected low side switch.

enter image description here

The supply goes to load then Drain and returns to Ground.



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.