An electromagnet is a temporary magnet created by passing electrical current through a wire coil, generating a controllable magnetic field that collapses the moment the current stops. Unlike permanent magnets, which rely on the fixed alignment of magnetic domains in materials like neodymium or ferrite, an electromagnet allows you to dial the magnetic flux density up or down by adjusting the current, and turn it off entirely. When you introduce an electromagnet into a real circuit, you are no longer just dealing with resistance; you are introducing inductance, which stores energy in a magnetic field and fundamentally changes how the circuit behaves during switching events.

A common point of confusion for beginners is conflating the electromagnet (the physical coil and core generating the field) with the solenoid (the complete mechanical actuator that uses an electromagnet to move a plunger). Another frequent mix-up is assuming that adding more turns of wire to a fixed-voltage coil will always make it stronger. As we will prove in the worked example below, that assumption can actually weaken your magnet if you ignore wire gauge.

The Core Physics: Ampere-Turns and Magnetic Flux Density

The strength of an electromagnet is primarily dictated by its Ampere-turns (AT), which is simply the current flowing through the coil multiplied by the number of wire loops. The magnetic flux density ($B$) inside a long, tightly wound coil (a solenoid) is calculated using the formula:

$B = \mu \cdot n \cdot I$

  • $B$ = Magnetic flux density in Teslas (T)
  • $\mu$ = Permeability of the core material (air is $\mu_0$, while soft iron cores multiply this by hundreds or thousands)
  • $n$ = Number of turns per unit length (turns / meter)
  • $I$ = Current in Amperes (A)

To see how wire gauge, resistance, and current interact to produce Ampere-turns, look at the specifications for four different 12V DC coil configurations wound on the exact same 1.5-inch diameter steel bobbin.

Table 1: 12V DC Electromagnet Coil Specifications (Fixed Bobbin Geometry)
Wire Gauge (AWG) Turns DC Resistance ($\Omega$) Current @ 12V (A) Ampere-Turns (AT) Relative Pull Force
28 AWG 1,400 29.8 $\Omega$ 0.40 A 560 AT Weak
26 AWG 1,050 16.2 $\Omega$ 0.74 A 777 AT Moderate
24 AWG 800 8.06 $\Omega$ 1.49 A 1,192 AT Strong
22 AWG 600 3.85 $\Omega$ 3.11 A 1,866 AT Very Strong
Key Takeaway: Notice that as the wire gets thicker (lower AWG), the number of turns decreases because thicker wire takes up more physical space on the bobbin. However, the Ampere-turns increase significantly. According to Georgia State University's HyperPhysics database, the magnetic field is directly proportional to the current. Thicker wire lowers resistance, allowing vastly more current to flow, which more than makes up for the lost turns.

Worked Example: Sizing a 12V DC Solenoid Coil

Let’s say you are building a custom 12V DC locking solenoid and need at least 1,500 Ampere-turns to generate enough force to pull a steel plunger across a 5mm air gap. You have a bobbin with a 1.5-inch outer diameter (circumference $\approx$ 4.71 inches, or 0.3925 feet).

The Trap: You might think, 'I'll just use 24 AWG magnet wire and wind 1,200 turns to get more AT.' Let's run the math on that assumption.

  1. Wire Length: 1,200 turns $\times$ 0.3925 ft/turn = 471 feet of 24 AWG wire.
  2. Resistance: 24 AWG copper has a resistance of roughly 25.67 $\Omega$ per 1,000 ft.
    $471 \text{ ft} \times (25.67 / 1000) = 12.09 \Omega$.
  3. Current: Using Ohm's Law ($I = V / R$), $12\text{V} / 12.09\Omega = 0.99\text{A}$.
  4. Ampere-Turns: $0.99\text{A} \times 1,200 \text{ turns} = \mathbf{1,188 \text{ AT}}$.

You missed your 1,500 AT target. By adding more turns of the same wire, you increased the resistance proportionally, which choked the current. The Ampere-turns remained virtually identical to the 800-turn version in Table 1.

The Fix: To hit 1,500 AT on a fixed 12V supply, you must drop the resistance by using thicker wire. If we switch to 22 AWG wire (16.14 $\Omega$ / 1,000 ft) and wind 800 turns:

  1. Wire Length: 800 $\times$ 0.3925 = 314 feet.
  2. Resistance: $314 \times 0.01614 = 5.07 \Omega$.
  3. Current: $12\text{V} / 5.07\Omega = 2.36\text{A}$.
  4. Ampere-Turns: $2.36\text{A} \times 800 \text{ turns} = \mathbf{1,888 \text{ AT}}$.

Target achieved. When designing electromagnets for a fixed voltage, wire thickness dictates your power, not just the turn count.

What an Electromagnet Changes in Your Circuit

When you wire an electromagnet into a DC circuit, it does not behave like a simple resistor or an LED. It is an inductor. This introduces two critical phenomena that will destroy your switching components if ignored.

1. Inductive Kickback (The Flyback Diode Requirement)

When current flows through the coil, energy is stored in the magnetic field. When you open the switch (or turn off the MOSFET), the magnetic field collapses rapidly. According to Faraday's law of induction, this collapsing field induces a massive reverse voltage spike to keep the current flowing. This spike ($V = -L \cdot di/dt$) can easily reach hundreds of volts, instantly punching through the gate oxide of a MOSFET or frying a microcontroller GPIO pin.

The Fix: You must place a flyback diode (like a 1N4007) in reverse bias directly across the coil terminals. When the switch opens, the voltage spike forward-biases the diode, creating a safe recirculation loop for the collapsing energy. For high-speed switching applications, a Schottky diode or a TVS diode is preferred to dissipate the energy faster.

2. Inrush vs. Holding Current

An electromagnet requires a massive burst of current to pull the armature across the air gap (inrush). However, once the plunger is seated against the core, the magnetic circuit is closed, and it takes far less current to hold it there. Leaving a 3A coil energized continuously at 3A generates $I^2R$ heat ($3^2 \times 5\Omega = 45\text{W}$), which will melt the coil insulation over time. Professional Texas Instruments solenoid driver circuits use PWM (Pulse Width Modulation) to hit the coil with 100% duty cycle for 50ms to pull the plunger, then drop to a 25% duty cycle to hold it, reducing heat dissipation by 75%.

Where You Meet Electromagnets in Practice

Electromagnets are the hidden muscles of modern electrical infrastructure. You will encounter them in the following applications:

  • Contactors and Relays: A small low-voltage electromagnet pulls a mechanical lever that closes heavy-duty contacts, allowing a 5V Arduino signal to safely switch a 240V AC motor.
  • Solenoid Valves: Used in irrigation, pneumatics, and hydraulic systems. The coil pulls a steel plunger to unblock a fluid orifice.
  • Audio Speakers: The 'voice coil' is an electromagnet suspended in the field of a permanent magnet. The AC audio signal rapidly changes the coil's polarity, vibrating the cone to create sound waves.
  • Maglev and MRI: Superconducting electromagnets cooled with liquid helium generate the massive, stable multi-Tesla fields required for medical imaging and frictionless rail transit.
Safety Caveat: If you are wiring electromagnets or contactor coils that operate on mains voltage (e.g., 120VAC or 240VAC relay coils), the inductive kickback is severe and can cause dangerous arcing across mechanical switches. Always use appropriately rated snubber circuits (RC networks) or solid-state relays with zero-crossing detection for AC inductive loads, and de-energize the panel before wiring.

Frequently Asked Questions

Can I use an electromagnet to generate electricity?

Yes, but indirectly. Moving a permanent magnet through an electromagnet's coil (or vice versa) induces a current, which is the operating principle of all electrical generators and alternators. However, simply passing a static magnetic field over a static coil will generate zero voltage; there must be relative motion or a changing field.

Why do electromagnets get hot?

The copper or aluminum wire used to wind the coil has inherent electrical resistance. As current pushes through this resistance, power is lost as heat ($P = I^2R$). If the coil is designed for intermittent duty (like a starter motor solenoid) and is left energized continuously, the heat will build up and eventually melt the thin enamel insulation on the magnet wire, causing a short circuit between the turns.

What is the difference between a solenoid and an electromagnet?

An electromagnet refers strictly to the physics of the coil and core generating a magnetic field. A solenoid is a specific type of electromagnet engineered to produce a linear mechanical force—specifically, a coil wound in a helix that pulls a movable steel plunger into its center. All solenoids use electromagnets, but not all electromagnets are solenoids (e.g., the stator coils in a motor are electromagnets, but they produce rotational torque, not linear pull).