Magnetism current is the physical principle where electrical current flowing through a conductor generates a proportional magnetic field in the surrounding space. In a real circuit, this phenomenon changes a passive conductive path into an active mechanical actuator or an energy-storage component, while simultaneously introducing inductance that violently opposes sudden changes in current flow. The most common mistake makers make is confusing the steady-state DC resistance of a coil with its transient inductive behavior. A relay coil might measure a harmless 120Ω on your multimeter, but interrupting its magnetism current generates a massive voltage spike that will instantly shatter a 3.3V microcontroller GPIO if left unprotected.
The Core Physics: Ampere-Turns and Magnetic Force
The strength of the magnetic field generated by a coil is dictated by Ampere-turns (A·t), the product of the current flowing through the wire and the number of loops. According to Ampere's Law, doubling the current or doubling the number of turns will double the magnetomotive force. However, wire resistance limits your current, meaning coil design is always a balancing act between turn count, wire gauge, and thermal dissipation.
Worked Numeric Example: Sizing a 12V Holding Electromagnet
Let's design a 12V DC holding electromagnet to lift a 200g steel armature. We need a strong magnetic field, so we will target 1,000 Ampere-turns.
- Power Supply: 12V DC bench supply, limited to 1.5A to keep the coil cool.
- Target Current: 1.0A (leaving 0.5A headroom).
- Required Resistance: Using Ohm's Law, R = V / I = 12V / 1.0A = 12Ω.
- Wire Selection: 26 AWG enameled copper wire, which has a resistance of roughly 0.133 Ω/meter at 20°C.
- Wire Length Needed: 12Ω / 0.133 Ω/m = 90.2 meters.
- Core Dimensions: A 20mm diameter iron cylinder (circumference ≈ 0.0628 meters).
- Turn Count: 90.2m / 0.0628m = 1,436 turns.
Result: By winding 1,436 turns of 26 AWG wire, the coil will draw exactly 1.0A at 12V, generating 1,436 Ampere-turns—well above our 1,000 A·t target. If the coil gets too hot to touch during continuous duty, you must step up to 24 AWG wire and recalculate to lower the resistance and current draw.
Where You Meet Magnetism Current in Practice
On the bench and in the panel, magnetism current is the operating mechanism for several critical components:
- Relays and Contactors: A small control current energizes a coil, creating a magnetic field that pulls an armature to close high-current load contacts. This provides galvanic isolation between your low-voltage logic and mains voltage.
- Solenoids: Used for linear mechanical actuation. The magnetic field pulls a plunger into the center of the coil, operating everything from sprinkler valves to automotive starter motors.
- Inductors and Transformers: In switch-mode power supplies (buck/boost converters), magnetism current is used to store energy in a magnetic field during the switch-on phase and release it to the load during the switch-off phase.
- Brushless DC (BLDC) Motors: Stator coils are sequentially energized to create a rotating magnetic field that drags the permanent magnet rotor along with it.
Decision Tree: Selecting Your Driver and Protection
Microcontrollers cannot source the magnetism current required to drive inductive loads directly. You need a driver circuit. Use this decision matrix to select the right switching component for your project.
| Application Scenario | Coil Current | Switching Speed | Recommended Driver | Flyback Protection |
|---|---|---|---|---|
| Standard 12V/24V Relay or Slow Solenoid | < 5A | < 10 Hz | Logic-Level N-Channel MOSFET (e.g., IRLZ44N) | 1N4007 Rectifier Diode |
| High-Speed PWM Proportional Valve | < 5A | > 1 kHz | Dedicated Load Driver IC (e.g., DRV8701) | Fast Recovery Schottky (e.g., SS34) |
| Heavy Industrial Contactor Coil | > 5A | < 1 Hz | Intermediate Relay + High-Power MOSFET | 1N4007 + RC Snubber Network |
| 3.3V Latching Relay (Pulse Only) | < 1A | Single Pulse | H-Bridge IC (e.g., DRV8833) or Dual MOSFET | Internal IC Clamp Diodes |
Default Pick: For 90% of hobbyist and DIY 12V/24V inductive loads under 5A, use an IRLZ44N logic-level MOSFET driven directly by a 3.3V or 5V GPIO through a 100Ω gate resistor, protected by a 1N4007 flyback diode wired in reverse across the coil.
The Inductive Kickback Hazard (And How to Clamp It)
When you abruptly cut power to an inductor, the magnetism current cannot stop instantly. The collapsing magnetic field induces a massive reverse voltage to keep the current flowing. Think of the magnetic field like a heavy mechanical flywheel: if you suddenly lock the shaft, the kinetic energy has to go somewhere, usually shattering the mechanism. In electronics, this 'shattering' is a voltage spike calculated by V = -L(di/dt).
If you are switching a 100mH relay coil carrying 100mA, and your MOSFET turns off in 50 nanoseconds, the theoretical voltage spike is:
V = 0.1H × (0.1A / 0.00000005s) = 200,000 Volts.
In reality, the voltage will rise until it finds a path to arc across or break down a semiconductor junction. This is why a flyback diode is non-negotiable. As detailed in this guide on inductor flyback voltage, the diode provides a safe, low-resistance recirculation path for the collapsing magnetism current, clamping the voltage spike to a safe ~0.7V above the supply rail.
Frequently Asked Questions
Q: Can I use a standard BJT (like a 2N2222) instead of a MOSFET to drive a relay?
A: Yes, but it is less efficient. A BJT requires continuous base current to stay saturated (typically 1/10th of the collector current). If your relay coil draws 100mA, your BJT needs 10mA from your microcontroller GPIO, which pushes the limits of many 3.3V MCUs. A MOSFET is voltage-driven and draws virtually zero steady-state gate current, making it the superior choice for modern low-voltage logic.
Q: Does the direction I wind my DIY electromagnet coil matter?
A: For a simple holding magnet or solenoid, the winding direction only dictates the magnetic polarity (North vs. South), which rarely matters for lifting ferrous metals. However, if you are building a motor, a transformer, or wiring two coils in series to add their magnetic fields, the winding direction and phase relationship are critical. Reversing one coil in a series pair will cause their magnetic fields to cancel each other out, resulting in a dead component that acts purely as a heating resistor.
Q: Why does my ESP32 reboot every time my solenoid activates?
A: This is a classic brownout caused by voltage sag, not inductive kickback. Solenoids draw a massive inrush current when the plunger is outside the coil (the air gap maximizes the required magnetism current). This inrush can drag your shared 5V or 12V-to-5V buck converter down below the ESP32's brownout detection threshold (usually ~2.4V). Fix this by powering the solenoid from a separate, higher-capacity power supply, sharing only the ground connection with your microcontroller.






