The relationship between electricity and magnetism is the fundamental physical principle where moving electric charges generate a magnetic field, and a changing magnetic field induces an electric voltage in a nearby conductor. This dual interaction dictates how we route high-speed PCB traces to avoid crosstalk, size inductors for switching power supplies, and manage electromagnetic interference (EMI) in motor drives. A common point of confusion on the bench is assuming that any magnetic field induces voltage; in reality, a steady DC current creates a static magnetic field that does absolutely nothing to a neighboring coil unless the current changes or the coil physically moves.
The Core Physics: Ampere and Faraday on the Bench
At the component level, we rely on two primary laws to harness this relationship. Ampere’s Law tells us that current flowing through a wire creates a proportional magnetic field around it. We exploit this to build electromagnets, relays, and the primary windings of transformers. Faraday’s Law of Induction is the reverse: a changing magnetic flux through a loop of wire induces an electromotive force (voltage). The faster the magnetic field changes, or the more turns of wire you have, the higher the induced voltage.
This isn't just textbook theory; it's the reason your microcontroller resets when you switch off a heavy load. Let's look at a concrete numeric example of Faraday's Law in action via inductive flyback.
Worked Example: The Relay Flyback Spike
Imagine you are driving a 12V Omron G5LE relay with an ESP32 GPIO via a 2N2222 NPN transistor. The relay coil has an inductance ($L$) of roughly 50 mH and draws 40 mA (0.04 A) at steady state. When the transistor switches off, the current drops to zero in about 1 μs ($1 \times 10^{-6}$ s).
Using the inductor voltage equation $V = L \times (di/dt)$:
$V = 0.050 \text{ H} \times (0.04 \text{ A} / 0.000001 \text{ s})$
$V = 2,000 \text{ Volts}$
That 12V relay just generated a 2,000V spike trying to keep the current flowing. Without a flyback diode (like a 1N4148) to clamp this, that spike will arc across the transistor's collector-emitter junction, destroying it instantly and injecting high-frequency EMI into your ESP32's power rail.
Where You Meet This in Practice
You interact with the relationship between electricity and magnetism every time you power up a project. Here is where it physically manifests on the workbench:
- Switch-Mode Power Supplies (SMPS): Buck and boost converters use inductors to store energy in a magnetic field during the 'on' cycle and release it as electrical current during the 'off' cycle. If you misunderstand core saturation, your inductor turns into a dead short.
- Transformers: Mains isolation and voltage step-down rely entirely on a changing AC magnetic field in the primary core inducing an AC voltage in the secondary winding. The ratio of turns dictates the voltage ratio.
- PCB Crosstalk and EMI: High-speed digital traces (like SPI or I2C lines) carrying rapidly changing currents generate tiny, localized magnetic fields. If a sensitive analog trace runs parallel to it, Faraday's law dictates that a noise voltage will be induced in the analog line.
- Motors and Generators: Brushless DC (BLDC) motors use sequenced magnetic fields to pull permanent magnets on the rotor. Back-EMF (the voltage generated by the spinning magnets passing the stator coils) is pure Faraday induction, and it limits the top speed of your motor.
Decision Tree: Selecting the Right Magnetic Core
When designing a custom inductor or EMI filter, the core material dictates how efficiently the magnetic field is contained and how much energy it can store before saturating. Use this decision tree to select the right material for your build.
| Application Scenario | Frequency Range | DC Bias / Current | Recommended Core Material | Concrete Part / Series |
|---|---|---|---|---|
| Mains Transformer (50/60Hz) | Ultra-Low | High | Silicon Steel Laminations | Hammond 166 Series |
| Audio Crossover Inductor | Low (20Hz-20kHz) | Moderate to High | Iron Powder or Gapped Ferrite | Jantzen Audio 000-1245 |
| DIY Buck Converter (SMPS) | Medium (50kHz-500kHz) | Low to Moderate | Manganese-Zinc (MnZn) Ferrite | Würth Elektronik WE-PD |
| RF EMI Choke / Bead | High (>1MHz) | Very Low (Signal) | Nickel-Zinc (NiZn) Ferrite | Fair-Rite 2643803802 |
The Default Pick: If you are building a standard 100kHz buck converter to step down 12V to 5V for an Arduino or Raspberry Pi project, default to the Würth Elektronik WE-PD 744774210 (10μH, shielded MnZn ferrite, rated for 4.3A). The MnZn material is optimized for the 50kHz-500kHz range, and the shielded construction prevents the magnetic field from radiating outward and inducing noise into nearby microcontroller GPIO pins.
Common Bench Mistakes and How to Avoid Them
Even experienced makers trip over the practical realities of magnetic fields. Here are the most frequent errors and how to fix them.
1. Ignoring Core Saturation
Every magnetic core has a limit, known as the saturation flux density ($B_{sat}$). Once the core is saturated, it cannot hold any more magnetic field lines. At this point, the inductance collapses to near zero, and the component acts like a plain piece of wire. If this happens in a switching regulator, the current spikes massively, usually destroying the switching MOSFET. Always check the datasheet for the $I_{sat}$ (saturation current) rating, and ensure it is at least 20% higher than your peak ripple current.
2. Using Ungapped Cores for Energy Storage
Pro Tip: Ferrite materials like TDK PC44 have incredibly high permeability, meaning they concentrate magnetic fields beautifully. However, this also means they saturate very quickly with high DC current. If you need an inductor to store energy (like in a buck converter), you must use a core with a physical air gap. The gap increases the reluctance of the magnetic circuit, lowering the overall inductance but drastically increasing the current it can handle before saturating. Never use an un-gapped toroid for a power inductor.
3. Treating Ground as a Magic EMI Shield
A changing magnetic field will induce a voltage in any conductive loop, including your ground plane. If you have a high-current motor driver on your PCB, the magnetic field generated by the motor traces can induce a voltage across the ground plane itself if the return path forms a large loop area. The fix is to route the high-current outbound and return traces as close together as possible (or use a ground plane directly beneath the signal layer) to minimize the loop area, thereby minimizing the magnetic flux captured by the loop.
FAQ: Electromagnetism on the Workbench
Can I use a solid steel bolt as an inductor core for a DIY project?
You can, but it is highly inefficient for anything above a few Hertz. Solid steel is conductive, so the changing magnetic field will induce swirling electrical currents inside the bolt itself, known as eddy currents. These currents generate massive amounts of heat and waste energy. This is why commercial transformers and inductors use ferrite (which is a ceramic and electrically insulating) or laminated steel sheets (which break up the eddy current paths). A steel bolt will likely overheat and melt your enamel wire coating.
Why do my I2C lines glitch when my DC motor starts?
This is a classic case of electromagnetic interference. When the motor starts, it draws a massive inrush current. This rapidly changing current generates a strong, expanding magnetic field. If your I2C wires (SDA and SCL) run parallel to the motor power wires, the changing magnetic field induces a voltage spike in the I2C lines via Faraday's Law. The microcontroller reads this spike as a false data bit, corrupting the bus. Fix it by twisting the motor wires together to cancel out their magnetic fields, twisting the I2C wires together, and physically separating the two cable bundles.
How does a flyback diode actually protect the circuit?
When the switch opens, the inductor's collapsing magnetic field tries to force current to keep flowing in the same direction. Without a path, the voltage rises until it arcs across the switch. A flyback diode (placed in reverse-bias across the coil during normal operation) becomes forward-biased when the voltage spikes. It provides a low-resistance loop for the inductor's stored magnetic energy to safely dissipate as heat in the coil's internal resistance and the diode, clamping the voltage spike to roughly 0.7V above the supply rail.






