An electromagnet is a temporary magnetic device that generates a controllable magnetic field when an electric current passes through a wire coil, typically wound around a ferromagnetic core. In a real circuit, it changes the electrical dynamics by acting as a highly inductive load that converts electrical energy into mechanical holding or actuation force, which fundamentally requires flyback protection to prevent voltage spikes from destroying your switching components when de-energized.
The Core Physics: Ampere-Turns and Inductive Loads
Unlike permanent magnets that rely on the aligned magnetic domains of materials like neodymium or ferrite, an electromagnet relies on moving charge. When current flows through a conductor, it creates a circular magnetic field. By looping the wire into a coil (a solenoid geometry), those individual fields superimpose, creating a strong, concentrated magnetic flux through the center. Wrapping that coil around a high-permeability core—like soft iron or silicon steel—amplifies the flux density by hundreds or thousands of times compared to an air core.
Let's look at a worked numeric example using a common 12V DC P40/20 holding electromagnet module. Suppose the internal coil has a measured resistance of 18 ohms and consists of 500 turns of enameled copper wire.
- Current (I): Using Ohm's Law (I = V/R), 12V / 18Ω = 0.66 Amps.
- Power Dissipation (P): P = V × I, so 12V × 0.66A = 7.92 Watts. This energy is lost entirely as heat in the coil.
- Magnetomotive Force (NI): 500 turns × 0.66A = 330 Ampere-Turns.
While 330 AT is enough to generate roughly 40 kg (88 lbs) of holding force against a flat steel plate, the inductive nature of the coil creates a hidden hazard. According to Faraday's Law of Induction, a collapsing magnetic field induces a voltage spike proportional to the rate of current change ($V = -L \frac{di}{dt}$). If you switch off this 12V electromagnet using a microcontroller's GPIO pin or a MOSFET without a flyback diode, the collapsing field will generate a reverse voltage spike that can easily exceed 100V, instantly bricking your ESP32 or frying the switching transistor.
Standard DC Holding Electromagnet Specifications
When sourcing electromagnets for DIY automation, CNC braking, or custom locking mechanisms, you will typically encounter the standard 'P-series' cylindrical holding modules. These are designed for zero-gap static holding, meaning they exert maximum force only when the mating steel surface is in direct physical contact.
| Model Size (Dia × H) | Nominal Voltage | Coil Resistance (Ω) | Rated Power (W) | Max Holding Force (kg) | Typical Duty Cycle (ED) |
|---|---|---|---|---|---|
| P20/15 (20mm × 15mm) | 12V DC | 96 Ω | 1.5 W | 6 kg (13 lbs) | 100% (Continuous) |
| P25/20 (25mm × 20mm) | 12V DC | 57 Ω | 2.5 W | 15 kg (33 lbs) | 100% (Continuous) |
| P40/20 (40mm × 20mm) | 12V DC | 18 Ω | 8.0 W | 40 kg (88 lbs) | 25% Intermittent / 100% at 50% voltage |
| P59/30 (59mm × 30mm) | 24V DC | 38 Ω | 15.0 W | 100 kg (220 lbs) | 25% Intermittent |
| P80/38 (80mm × 38mm) | 24V DC | 16 Ω | 36.0 W | 200 kg (440 lbs) | 10% Intermittent (Heavy Pull) |
Note: Data derived from standard commercial manufacturer spec sheets for bare-bobbin DC electromagnets. Always verify the exact resistance and duty cycle on your specific datasheet, as variations exist between brands.
The most critical spec in this table is the Duty Cycle (ED - Einschaltdauer). A 100% ED rating means the coil can remain energized indefinitely without exceeding its thermal limits (usually Class B insulation rated for 130°C). A 25% ED rating means the electromagnet can only be powered for 15 seconds out of every minute. If you wire a 25% ED P40/20 module to a continuous 12V supply for a security door lock, the coil will overheat, melt its internal enamel insulation, short out, and fail within hours. For continuous-hold applications, you must either buy a 100% ED rated module or use a 'pull-and-hold' circuit that applies full voltage to engage, then drops to a lower PWM duty cycle (around 30%) to maintain the hold while keeping the coil cool.
Where You Meet This in Practice
Electromagnets are the hidden muscle behind almost all automated electrical control systems. While hobbyists often use them for custom latches or robotic grippers, they are foundational to residential and industrial wiring.
- Relays and Contactors: Every time your thermostat clicks on the AC, or your well pump starts, an electromagnet is doing the work. The 'coil' in a contactor is simply an electromagnet that pulls a steel armature, closing heavy-duty mechanical contacts to switch high-current loads. A 24V AC contactor coil might draw 20VA (apparent power) to pull in, but only 5VA to hold, utilizing an internal shading coil or economizer circuit to prevent AC hum and overheating.
- Maglocks (Electromagnetic Locks): Used on commercial fire egress doors. These are massive, specialized electromagnets rated for 600 to 1200 lbs of holding force. They are strictly fail-safe—when power is cut during a fire alarm, the magnetic field collapses and the door opens. Because they draw 500mA+ continuously, they require dedicated access control power supplies, not standard 12V wall warts.
- Automotive Starters and Fuel Injectors: The starter solenoid uses an electromagnet to physically throw the heavy pinion gear into the engine's flywheel ring gear, while simultaneously closing the high-current contacts to spin the motor. Fuel injectors are precisely timed, high-speed electromagnets where the mechanical travel is measured in millimeters and the response time in microseconds.
The practical reality of installing these devices is managing the air gap. Magnetic holding force is inversely proportional to the square of the distance between the electromagnet face and the target. A microscopic layer of rust, a coat of paint, or a piece of debris on the mating surface acts as an air gap. An electromagnet rated for 40 kg of force at zero gap might drop to just 5 kg of force with a 1mm air gap. Always ensure mating surfaces are bare, flat, and clean steel.
Clearing Up the Confusion: Solenoids, Relays, and Permanent Magnets
People frequently confuse electromagnets with other magnetic or electromechanical components. Here is how to tell them apart on the bench.
Electromagnets vs. Permanent Magnets: Permanent magnets (like Neodymium N52) generate a persistent magnetic field due to their atomic structure. They require zero electrical power to hold a load, making them ideal for fail-secure applications (the lock stays engaged if power fails). However, they cannot be easily turned off. To release a permanent magnet, you must physically slide it off the steel surface, which requires overcoming the full shear force. Electromagnets release instantly when power is cut, which is why they are mandatory for automated sorting, robotic pick-and-place, and emergency egress doors.
Latching vs. Non-Latching: A standard electromagnet drops its load the millisecond power is removed. A latching electromagnet (often found in bi-stable relays or smart gas valves) uses a pulse of current to move an armature into the field of a permanent magnet, which then holds it in place mechanically or magnetically without continuous power. A second, reverse-polarity pulse is required to break the permanent magnet's hold and release the latch. This is highly power-efficient for battery-operated IoT devices.
Frequently Asked Questions
Can I run a 12V DC electromagnet on AC power?
No. While the coil will generate a magnetic field, the 50/60Hz alternating current will cause the magnetic field to collapse and reverse 120 times a second. This induces massive eddy currents in a solid iron core, leading to rapid, extreme overheating and a violent mechanical vibration (humming). AC electromagnets require specially laminated cores (thin sheets of steel insulated from each other) to block eddy currents, and often feature a copper 'shading ring' on the pole face to maintain magnetic flux during the zero-crossing of the AC sine wave.
Why does my electromagnet stay slightly magnetized after I turn it off?
This is called magnetic remanence or residual magnetism. The soft iron core has retained a slight magnetic alignment. In precision applications, this 'sticking' force can prevent a part from dropping cleanly. To fix this, engineers add a small brass or plastic spacer pin in the center of the electromagnet face to maintain a microscopic 0.1mm air gap, or they apply a brief reverse-current pulse to actively demagnetize the core upon release.
How do I calculate the wire gauge needed for winding my own electromagnet?
First, determine your target resistance based on your voltage and desired power dissipation (R = V² / P). Then, use a standard copper wire resistance table to find the AWG that gives you that resistance over the total estimated length of your winding. Ensure the wire's current rating exceeds your calculated amperage, and always use magnet wire (enameled copper), never bare or PVC-insulated wire, as the enamel allows for tight, dense packing of thousands of turns in a small volume.






