Step-by-step guide to building a DIY solenoid‑powered door latch
Ever tried to keep a closet door shut with a rubber band and got a surprise when it snapped? A solenoid latch can turn that frustration into a satisfying click, and you can build one with parts you probably already have. In this post I walk you through the whole process, from picking the right coil to wiring the final circuit, so you can add a touch of electromechanics to any door in your home workshop.
Why a solenoid latch makes sense now
Most people think solenoids are only for industrial machines, but the truth is they are tiny, cheap, and perfect for hobby projects. A latch that opens and closes with a pulse of electricity lets you automate cabinets, pet doors, or even a secret bookshelf entrance (yes, I’ve built one for a friend). The best part is you get a real‑world electromechanical system to play with, which is exactly the kind of hands‑on learning I love to share on Magnetic Mechanics.
What you’ll need
Core components
- Solenoid coil – 12 V, 5 W is a good balance of force and heat. Look for a “pull type” coil; it pulls the plunger in when energized.
- Metal latch plate – a flat piece of steel about 30 mm wide and 5 mm thick works well.
- Spring – a compression spring that returns the plunger when power is removed. About 20 mm long, 5 mm diameter.
- Power supply – a 12 V DC wall adapter rated for at least 1 A.
- Switch or relay – a momentary push button for testing, or a 5 V logic‑level MOSFET if you want to drive it from a microcontroller.
Tools and extras
- Drill with 3 mm and 6 mm bits
- Small metal file
- Soldering iron and heat‑shrink tubing
- Wire cutters, strippers
- Multimeter (helps catch wiring mistakes)
Designing the latch mechanism
1. Mount the solenoid
Drill a 6 mm hole in the door frame where you want the latch to sit. The hole should be just deep enough for the coil body to sit flush with the surface. Insert the coil, making sure the plunger points toward the door edge. Use a few screws or epoxy to hold it steady.
2. Attach the latch plate
Cut the steel plate to match the width of the door edge. File the edges smooth so the plate slides without catching. Position the plate so the solenoid plunger will push it open when energized. Secure the plate with two small bolts, leaving a tiny gap (about 0.2 mm) for the plunger to move.
3. Add the return spring
Place the compression spring behind the plunger, between the coil housing and the latch plate. The spring should be just strong enough to pull the plate closed when power is off, but not so strong that the coil can’t overcome it. A quick test with a hand‑press will tell you if the force feels right.
Wiring the circuit
4. Basic power wiring
Strip the two leads from the solenoid. Connect one lead directly to the positive terminal of the 12 V supply. The other lead goes to the collector of an N‑channel MOSFET (or to one side of a push button if you’re just testing). The MOSFET’s source pin connects to ground, and its gate receives the control signal.
5. Adding a flyback diode
When the coil is turned off, it generates a voltage spike that can damage the MOSFET. Solder a diode (1N4007 works fine) across the coil terminals, cathode to the positive side, anode to the negative side. This gives the spike a safe path to dissipate.
6. Control signal
If you’re using a microcontroller, connect its output pin to the MOSFET gate through a 220 Ω resistor. Add a pull‑down resistor (10 kΩ) from gate to ground so the MOSFET stays off when the controller is not driving it. For a simple manual test, replace the microcontroller line with a momentary push button wired between gate and 5 V.
Testing and tweaking
7. First power‑up
Turn on the 12 V supply and press the button or trigger the microcontroller output. You should hear a soft “click” as the plunger pulls the latch plate open. Release the control and watch the spring snap the plate back into place. If the latch sticks, check the spring tension and make sure the plate can move freely.
8. Measuring current
Use a multimeter to read the coil current while it’s energized. It should be close to the coil’s rated current (about 0.4 A for a 5 W, 12 V part). If it’s much higher, you may have a short or the coil could be damaged.
9. Heat management
Run the latch for a few seconds at a time and feel the coil housing. A warm touch is normal, but it should not become hot enough to burn your fingers. If it does, consider adding a small heat sink or reducing the duty cycle (run it for 200 ms, wait 800 ms).
Installing the finished latch
10. Mount the door
Attach the door to the frame so the latch plate aligns with the strike plate on the door edge. Adjust the strike plate position until the plunger pushes the door fully closed when power is off. Tighten all screws, then give the whole assembly a few cycles to confirm reliable operation.
11. Optional upgrades
- Feedback sensor – a tiny Hall effect sensor can tell you when the latch is fully closed, useful for safety interlocks.
- Battery backup – a small 12 V lead‑acid or Li‑ion pack can keep the latch functional during a power outage.
- Remote control – pair the MOSFET driver with a cheap RF module and you have a wireless door latch.
My takeaways
Building a solenoid‑powered latch is a perfect blend of mechanical design and simple electronics. The biggest lesson I learned was to respect the spring force; a weak spring makes the latch feel floppy, while an overly strong one can starve the coil of power. Also, never skip the flyback diode – I learned that the hard way when a MOSFET smoked on my first prototype.
Give it a try, and you’ll end up with a door that opens at the push of a button, a whisper of a click, and a satisfying sense of having turned a piece of raw physics into a useful everyday gadget.
- → Build a Low‑Cost Autonomous Delivery Robot for Your Home in 7 Simple Steps @robofrontier
- → How to Build a Modular Linear Actuator System for Home Automation Projects @actuatorblocks
- → Designing a Reliable Relay-Based Control Circuit: A Step-by-Step Guide for Hobbyists @relaytechinsights
- → Step-by-Step Guide to Building a Low-Cost Automated Conveyor with Linear Rails @precisionmotion
- → DIY Holiday Wreath from Everyday Items @festivediy