An electro magnet is a coil of wire wrapped around a ferromagnetic core that generates a controllable magnetic field only when electrical current flows through it.
The Core Physics: Ampere-Turns and Magnetic Force
When you design or select an electro magnet for a DIY linear actuator, a maglock, or a custom relay, the pulling force is not determined by voltage alone. It is governed by Ampere-turns (NI), which is the product of the current flowing through the coil and the number of wire turns. The ferromagnetic core concentrates this magnetic flux, but the air gap between the core and the armature is where the actual mechanical work happens. As the air gap closes, the reluctance of the magnetic circuit drops, and the holding force increases exponentially.
Let us look at a worked numeric example. Suppose you are winding a custom holding magnet and need 500 Ampere-turns to securely hold a 10 lb steel plate against vibration. You plan to use a standard 12V DC bench supply. If you wind the coil to have a total DC resistance of 24 ohms, your steady-state current will be:
To achieve the required 500 Ampere-turns at 0.5A, you need exactly 1,000 turns of wire (500 / 0.5 = 1,000). If you choose 26 AWG enameled copper magnet wire (which has a diameter of roughly 0.016 inches including the enamel coating), 1,000 turns will require a specific bobbin window area. If your bobbin can only physically fit 600 turns of 26 AWG wire, you must either switch to a thinner wire (like 28 AWG) to fit more turns, or increase the supply voltage to push more current through fewer turns. According to fundamental magnetic circuit theory detailed by Electronics Tutorials, balancing the thermal limits of the wire gauge against the required Ampere-turns is the primary design constraint.
What an Electro Magnet Changes in Your Circuit
Treating an electro magnet like a simple resistive load is the most common mistake makers and junior technicians make. While it has DC resistance, it is fundamentally a massive inductor. This changes the behavior of your circuit in two critical ways:
- Inrush and Steady-State Profile: When you first apply voltage, the current does not instantly reach V/R. The inductance opposes the change in current, causing an exponential ramp-up. The mechanical pull-in force is delayed until the current reaches the threshold required to close the air gap.
- Back-EMF and Inductive Kickback: When you switch the circuit off, the collapsing magnetic field induces a massive reverse voltage spike to keep the current flowing. As explained in the All About Circuits DC textbook, this back-EMF can easily reach hundreds of volts, even in a low-voltage 12V or 24V system. This spike will destroy unprotected switching transistors, weld relay contacts, and fry microcontroller GPIO pins.
Where You Meet This in Practice
You interact with electromagnets constantly in both residential wiring and bench projects. Recognizing them helps you troubleshoot control circuits and size power supplies correctly.
- Solenoid Valves: Used in irrigation systems, RO water filters, and pneumatic compressors. These are usually intermittent-duty electromagnets designed to pull a plunger against spring pressure.
- Magnetic Door Locks (Maglocks): Common in commercial access control. These are continuous-duty holding electromagnets with no moving parts other than the armature plate. They draw continuous current and generate steady heat.
- Relays and Contactors: The coil inside a mechanical relay is a small electro magnet that pulls the switch contacts closed. Contactors used for HVAC compressors or EV battery disconnects use heavy-duty electromagnets to overcome stiff spring loads.
- Scrap Yard Cranes and MRI Machines: At the industrial and medical extreme, massive superconducting or high-current copper electromagnets are used to lift tons of steel or align atomic nuclei.
Bench Walkthrough: When a 12V Solenoid Fries an ESP32
To understand what happens when you ignore the inductive nature of an electro magnet, let us walk through a real-world bench failure.
- The Setup: A builder wants to control a 12V, 1.5A pneumatic solenoid valve using an ESP32 DevKit v1. The ESP32 operates at 3.3V logic, so the builder uses an IRLZ44N logic-level N-channel MOSFET to switch the solenoid's ground path. The ESP32 GPIO pin connects to the MOSFET gate via a 1kΩ resistor.
- The Numbers: The solenoid coil has a DC resistance of 8 ohms (12V / 8Ω = 1.5A). The IRLZ44N has a maximum Drain-Source breakdown voltage (Vdss) of 55V. The ESP32 GPIO pin is rated for a maximum of 3.6V and 40mA.
- The Outcome: The system works for about twenty cycles. Then, the ESP32 randomly resets. On the next power-up, the solenoid is stuck permanently ON, and the ESP32 GPIO pin is dead, reading 0V in software but physically shorted to the 3.3V rail. The MOSFET is hot to the touch.
- What Went Wrong: The builder forgot the flyback diode. When the MOSFET turned off, the solenoid's inductance (approximately 50mH) generated a voltage spike. Because the current (1.5A) was forced to stop in nanoseconds (high di/dt), the back-EMF spike exceeded 80V. This punched through the MOSFET's 55V Vdss limit, destroying the silicon die and creating a short between the drain and the gate. The 12V solenoid supply then fed backward through the ruined MOSFET gate, straight into the ESP32 GPIO pin, instantly vaporizing the microcontroller's internal ESD protection diode and damaging the onboard 3.3V LDO regulator.
- The Fix: Replace the ESP32 and the MOSFET. Solder a 1N4007 rectifier diode directly across the solenoid coil terminals, with the cathode (stripe) facing the 12V positive supply. This provides a safe recirculation path for the inductive kickback, clamping the spike to roughly 0.7V above the supply rail.
Common Confusions: Electromagnets vs. Inductors vs. Permanent Magnets
People commonly confuse electromagnets with standard inductors and permanent magnets. While they share underlying physics, their physical construction and circuit roles are entirely different.
Electro Magnet vs. Inductor: An inductor is designed to store energy in a magnetic field while preventing mechanical movement. Inductors often have air gaps, powdered iron cores, or distributed gaps to prevent magnetic saturation and keep the inductance value stable across varying currents. An electro magnet is designed to maximize mechanical pull; it uses a solid, low-reluctance ferromagnetic core (like soft iron) with minimal air gaps to concentrate the flux into physical force. If you use a power inductor as a makeshift electromagnet, it will produce very weak pulling force because its core is intentionally designed to leak or limit flux.
Electro Magnet vs. Permanent Magnet: A permanent magnet (like Neodymium or Ferrite) has a fixed magnetic field due to the alignment of its internal atomic domains. It requires zero electrical power to hold a load. An electro magnet requires continuous electrical power to maintain its field. The advantage of the electro magnet is control: you can turn it off to release the load, or reverse the current polarity to reverse the magnetic poles, which is the foundational principle of DC and stepper motors.
FAQ: Sizing and Driving Electromagnets
Q: Can I run a 12V electro magnet on a 24V power supply?
A: Yes, but you cannot connect it directly. Doubling the voltage quadruples the power dissipation (P = V²/R), which will quickly melt the coil's enamel insulation and cause a short circuit. You must either use a dropping resistor to halve the voltage, or drive the coil with a PWM signal at a 50% duty cycle to maintain the correct average current. PWM is preferred as it is far more energy-efficient and generates less heat.
Q: Why is my solenoid getting too hot to touch after a few minutes?
A: You are likely exceeding its duty cycle. Many DIY and pneumatic solenoids are rated for 'intermittent duty' (often 10% to 25% duty cycle), meaning they are designed to be energized for only a few seconds at a time. The high inrush current required to pull the plunger generates massive heat. Once the plunger is seated, the current doesn't drop significantly in a standard DC coil. If you need it to stay on continuously, you must buy a 'continuous duty' solenoid, or add an economy resistor in series with a normally-closed relay contact that drops the holding current once the plunger closes.
Q: Does the polarity of the DC voltage matter when wiring an electro magnet?
A: For the magnetic pulling force, no. Reversing the polarity simply reverses the North and South poles of the core, but the attractive force to an unmagnetized steel armature remains identical. However, if your circuit includes a flyback diode, the polarity must match the diode's orientation. If you reverse the supply voltage but leave the flyback diode in the original position, the diode will become forward-biased, creating a dead short across your power supply the moment you turn it on.






