An electromagnet is a temporary magnet created by passing an electrical current through a wire coil, usually wrapped around a ferromagnetic core, generating a magnetic field that disappears when the current stops. That is the strict electromagnet science definition, but on the workbench, it means you are building a device that converts electrical energy into mechanical force or stores energy in a magnetic field. When you introduce an electromagnet into a circuit, you are no longer just dealing with resistance; you are introducing inductance, which fundamentally changes how current behaves over time.
The Core Mechanism and Circuit Behavior
When direct current flows through a straight wire, it generates a weak, circular magnetic field. By winding that wire into a coil (a solenoid), the individual magnetic fields of each loop叠加 (stack) together, concentrating the flux. Adding a ferromagnetic core—like soft iron or silicon steel—multiplies this field strength by thousands of times because the core's internal magnetic domains align with the coil's field.
But what does this actually change in a real circuit? It introduces inductance. An electromagnet resists changes in current. When you first apply voltage, the coil's inductance fights the rising current, but because the physical air gap in the magnetic circuit is large, the inductance is initially low. This results in a high inrush current. Once the mechanical armature pulls in and closes the air gap, the inductance spikes, and the current drops to a much lower holding current. If you size your power supply or driving transistor only for the holding current, your electromagnet will never pull in.
The Math on the Bench: A Worked Numeric Example
Let's move away from abstract theory and calculate the actual pulling force potential of a DIY magnetic lock using real bench values. We need to find the Magnetomotive Force (MMF) and the resulting Magnetic Flux Density (B).
MMF (Ampere-turns) = N × I
Magnetic Field Strength (H) = MMF / l
Flux Density (B) = μ × H
The Setup: You wind 400 turns of 20 AWG magnet wire around a silicon steel core with a magnetic path length (l) of 0.2 meters. You drive it with 1.5 Amps of DC current. The core material has a relative permeability (μr) of 2,000.
- Calculate MMF: 400 turns × 1.5 A = 600 Ampere-turns.
- Calculate H (Field Strength): 600 At / 0.2 m = 3,000 A/m.
- Calculate B (Flux Density): The absolute permeability (μ) is μ0 × μr. μ0 is 4π × 10^-7 T·m/A. So, B = (4π × 10^-7) × 2000 × 3000 = 7.54 Tesla.
The Reality Check (Core Saturation): If you actually build this, you will not get 7.54 Tesla. This is where textbook math meets bench reality. Silicon steel saturates at roughly 1.8 to 2.0 Tesla. Think of the magnetic core like a sponge absorbing water; once the sponge is completely full, pouring more water just makes a mess without holding any more liquid. Once the core hits ~1.8T, it saturates. Any additional current you push past this point doesn't increase the magnetic pull; it just turns into waste heat (I²R losses) in the copper wire. To get more force, you must increase the physical cross-sectional area of the core, not just pump up the amps.
Where You Meet Electromagnets in Practice
You interact with electromagnets constantly in both residential wiring and embedded projects. Here is where they show up and the specific components you will buy:
- Relays and Contactors: A small electromagnet pulls a mechanical switch to control a high-power circuit. When wiring a 240V HVAC compressor, the contactor coil (often 24VAC) is an electromagnet. Example part: Omron G7L-2A-B 24VDC relay.
- Solenoids: Electromagnets designed for linear mechanical motion. Used in sprinkler valves, automotive starters, and DIY smart locks. Example part: 12VDC 500mA push-pull solenoid.
- Transformers: Two or more electromagnets coupled together to transfer energy via a changing magnetic field, stepping AC voltage up or down.
- Motors: Brushed DC, BLDC, and stepper motors all rely on precisely timed electromagnet fields in the stator to push against permanent magnets or induced fields in the rotor.
Scenario Walkthrough: When the Collapsing Field Kills Your Circuit
Understanding the electromagnet science definition is critical because failing to respect the physics will destroy your components. Here is a classic failure mode I see in DIY smart-home builds.
The Setup: A maker wants to automate a 12V DC solenoid door lock (which is fundamentally a linear electromagnet) using an ESP32 microcontroller. They wire the ESP32 GPIO to the gate of an IRLZ44N logic-level MOSFET. The solenoid connects between the 12V supply and the MOSFET's drain. The ESP32 pin goes HIGH, the MOSFET turns on, and the lock pulls in perfectly.
The Numbers: The solenoid coil has a DC resistance of 6 ohms, drawing 2 Amps at 12V. Its inductance is roughly 50mH.
The Outcome: When the ESP32 code commands the lock to open, it sets the GPIO LOW. The MOSFET instantly dies, shorting the drain to the source internally. The lock remains permanently engaged, and the ESP32 pin might even be fried.
What Went Wrong: Inductive flyback. The formula for an inductor is V = L × (di/dt). When the MOSFET turns off, it tries to drop the current (di) from 2 Amps to 0 Amps in a fraction of a microsecond (dt). Because the magnetic field stored in the electromagnet's core cannot disappear instantly, it collapses and induces a massive reverse voltage spike to keep the current flowing. This spike easily exceeds 100V, instantly punching through the IRLZ44N's 55V maximum Drain-Source breakdown voltage (V_DSS).
Common Confusions and FAQ
What is the difference between an electromagnet and a permanent magnet?
A permanent magnet (like neodymium or ferrite) has its magnetic domains permanently aligned during manufacturing, requiring no external power to maintain its field. An electromagnet requires continuous electrical current to maintain its field. The massive advantage of an electromagnet is controllability: you can turn it off, reverse its polarity by reversing the current, or modulate its strength.
What do people commonly confuse in electromagnet math?
Beginners frequently confuse Magnetic Field Strength (H) with Magnetic Flux Density (B). 'H' (measured in Ampere-turns per meter) is the effort you put in—the electrical current and the coil geometry. 'B' (measured in Tesla) is the actual result—the magnetic flux inside the material. The relationship between them is dictated by the core material's permeability. As shown in our math example, you can keep increasing H, but B will flatline once the core saturates.
Does AC or DC make a better electromagnet?
DC is vastly preferred for holding electromagnets (like relays and magnetic locks) because it provides a steady, continuous pull without vibration. When you run AC through an electromagnet, the magnetic field drops to zero 120 times a second (on a 60Hz grid). This causes the armature to chatter and buzz violently. To fix this in AC contactors, manufacturers embed a shading ring (a copper loop) in the core face, which acts as a secondary shorted coil to keep the magnetic flux from dropping to zero during the AC crossover points. For more on magnetic field behaviors in different materials, see the Georgia State University HyperPhysics reference on solenoids.






