I want to build a safe that can only be opened via an HTTP POST request. In order to do this the safe will contain a Raspberry Pi Zero W hosting a simple ExpressJS server that listens to these requests and uses rpi-gpio.js[1] to unlock an electronic lock[2].
This lock uses a 12V DC @ 2A power supply as the standby power, but it also needs a 12V signal to unlock electronically. I initially wanted to unlock it directly using one of the 3.3V GPIOs on the Raspi, but the lock would not unlock when setting the pin to 1. I tried several GPIOs, checked that they are functioning correctly, and they are indeed outputting the documented signal. I also tried using the 5V pin on the GPIO (that cannot be controlled) to see if 5V would be enough, but no luck on that as well.
The lock does unlock correctly if I feed the 12V @ 2A signal from the power supply (the same power supply I'm using to power the lock on standby) into the positive unlock input on the lock's logic board.
Since I can unlock it using the 12V @ 2A signal from the power supply, I want to use one of the GPIOs on the Raspi as a switch to open/close the circuit. Here's an idea of what I want to accomplish: https://i.sstatic.net/sdf4c.png (mirror: https://i.postimg.cc/MH2wLh8m/untitled.png)
I was thinking about using a ready made IRF520 MOSFET board with a reverse emf protection diode across the output to protect it from the voltage generated by the lock coil on power off.
My questions are:
- Is an IRF520 suited for this job?
- Which diode should I get?
Any insights are appreciated. Thanks for reading.