# How do I build a good power supply for a coil?

I want to build several different Arduino projects which use coils, magnets and/or solennoids. These projects include:

• Magnetic door locks
• 55 lb electromagnets
• Magnetic door latches
• Relay

I can buy a power supply designed for a magnetic security door lock, but I would rather use my simple 9 or 12 volt wall adapter.

Will I need to add some capacitance for early switch-on power? Will I need to limit the current after the magnet powers up? Will I need to add some sort of protection for the Arduino? Are there other concerns?

How do I build a good power supply for a coil?

• "Celinoid" ? ;) First, determine how much power your various widgets will need and then determine how you'll be able to supply it. Or, if know how much power you have available, determine whether it's enough to run your widgets. – EM Fields Mar 2 '16 at 8:54
• Celinoid, n. Electromagnetic device designed to pick up celery. (It didn't work.) – Transistor Mar 3 '16 at 19:47
• Corrected typo. transistor, you made me laugh :) – Mister Mystère Mar 3 '16 at 19:59

Inductors will oppose themselves to a change in current, in particular at startup. So there will not be an inrush current, it will build up quickly and settle at its nominal value. You might have thought it would be necessary because motors do have an inrush current, but it's relative to their rated current, which is reduced because of the back emf generated by the shaft rotation. Basically, your inductor is just like a blocked motor winding, the steady state current is only limited by the winding resistance, and at steady state both the stored magnetic energy and the Joule heating are maximum.

So as long as you design your power supply for the nominal current, you're fine: no brownouts due to voltage drops from the high current draw will occur. A basic NPN transistor in common emitter configuration in saturation mode can be sufficient since you probably do not need to reverse the current direction. See "relay drive", for example.

Be absolutely certain to include a freewheeling diode in parallel to the inductor, to protect the transistor (and its controller) against the high voltage which is generated by the inductor when the transistor shuts off - remember: inductors oppose themselves to a change in current.

• So my only concern is to include a diode... zener or schottky? – Hoytman Mar 3 '16 at 20:03
• Not a zener, a schottky is good if you want a low power but slow discharge, whereas a normal one is better if you want a faster discharge and the package can handle the increased dissipation (schottky have lower forward voltage drop). – Mister Mystère Mar 3 '16 at 20:05
• Actually, a zener can be used but across the transistor, to make the collapsing of the field quicker: electronics.stackexchange.com/questions/26944/… – Mister Mystère Mar 7 '16 at 10:57

If you operate a 12V maglock with 9V power it will only come on at about three quarter strength, that may be enough for a demo.

Door latches are going to be unreliable at reduced voltage

Electromagnets will be weak like the maglock if under-powered.

Capacitors aren't likely to help, but a diode parallel with the coil will protect your switching device from the energy stored in the inductor, this diode is essential.

• I can use a 12 volt wall adapter for 12 volt coils – Hoytman Mar 3 '16 at 19:36
• Jasen's "half strength" calculation is based on $P=\frac {V^2} {R}$. If voltage is dropped to 0.75 of the spec., then for the same resistance the power will be $0.75^2 = (\frac {3}{4})^2 = \frac {9}{16}$ of the full power. – Transistor Mar 3 '16 at 20:52
• I'm wrong of course, the current will be 75% so the magnetic strength will also be 75% (edit made) – Jasen Mar 7 '16 at 2:39