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?

  • 1
    \$\begingroup\$ "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. \$\endgroup\$
    – EM Fields
    Mar 2, 2016 at 8:54
  • 2
    \$\begingroup\$ Celinoid, n. Electromagnetic device designed to pick up celery. (It didn't work.) \$\endgroup\$
    – Transistor
    Mar 3, 2016 at 19:47
  • \$\begingroup\$ Corrected typo. transistor, you made me laugh :) \$\endgroup\$ Mar 3, 2016 at 19:59

2 Answers 2


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.

  • \$\begingroup\$ So my only concern is to include a diode... zener or schottky? \$\endgroup\$
    – Hoytman
    Mar 3, 2016 at 20:03
  • \$\begingroup\$ 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). \$\endgroup\$ Mar 3, 2016 at 20:05
  • \$\begingroup\$ Actually, a zener can be used but across the transistor, to make the collapsing of the field quicker: electronics.stackexchange.com/questions/26944/… \$\endgroup\$ Mar 7, 2016 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.

  • \$\begingroup\$ I can use a 12 volt wall adapter for 12 volt coils \$\endgroup\$
    – Hoytman
    Mar 3, 2016 at 19:36
  • \$\begingroup\$ 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. \$\endgroup\$
    – Transistor
    Mar 3, 2016 at 20:52
  • \$\begingroup\$ I'm wrong of course, the current will be 75% so the magnetic strength will also be 75% (edit made) \$\endgroup\$ Mar 7, 2016 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.