The fundamental law of magnetism states that like magnetic poles repel while opposite poles attract, and in electrical systems, a current-carrying conductor generates a proportional magnetic field that exerts mechanical force on ferromagnetic materials. In a real circuit or installation, this law dictates the minimum pull-in voltage of your relays, the holding torque of your stepper motors, and the exact air-gap distance for your proximity sensors. Builders most commonly confuse magnetic flux density (measured in Tesla or Gauss, the actual magnetic field passing through a specific area) with magnetic field strength (measured in Amperes per meter, the external magnetizing force applied to the material).
The Core Physics: Poles, Fields, and Electromagnetic Force
When we talk about the law of magnetism in electronics, we are merging the basic pole-repulsion rule with Ampere's Law. Ampere's Law tells us that any electrical current creates a circular magnetic field around the conductor. By winding that conductor into a coil (a solenoid), we concentrate those circular fields into a single, unified magnetic pole.
The strength of this electromagnet is not arbitrary; it is strictly bound by the physical properties of the core material and the geometry of the coil. If you double the current, you double the magnetic field strength. But if you push too much current through a ferromagnetic core, you hit magnetic saturation. At that point, the core cannot align any more internal magnetic domains, and the law of magnetism shifts from being governed by the high-permeability iron core to being governed by the permeability of free space (air). This saturation point is the exact reason why simply adding more voltage to a relay coil eventually yields zero additional pulling force.
Worked Numeric Example: Calculating Relay Pull-In Flux
Let's apply the law of magnetism to a real component to see what happens inside a standard relay. We will use the ubiquitous Omron G5V-2 12VDC DPDT signal relay.
- Coil Resistance (R): 288 Ω
- Applied Voltage (V): 12V DC
- Current (I): 12V / 288 Ω = 0.0416 A (41.6 mA)
- Approximate Turns (N): 15,000
- Magnetic Path Length (L): 0.02 meters (2 cm)
- Core Relative Permeability (μr): ~2,000 (soft iron)
To find the magnetic flux density (B) inside the core, we use the formula derived from Ampere's Law: B = μ0 × μr × (N / L) × I.
Plugging in the numbers (where μ0 is the permeability of free space, 1.256 × 10-6 T·m/A):
B = (1.256 × 10-6) × 2000 × (15,000 / 0.02) × 0.0416
B = 0.078 Tesla (or 780 Gauss)
This 780 Gauss field is what physically pulls the steel armature down to close the contacts. If your supply voltage sags to 9V (a common brownout scenario in 12V automotive or solar systems), your current drops to 31.2 mA, and your flux density falls to 585 Gauss. If the relay's mechanical spring tension requires 600 Gauss to overcome the air gap, the relay will chatter or fail to pull in entirely. This is why the law of magnetism forces us to size relay drive circuits with strict voltage-drop margins.
Where You Meet This in Practice
You interact with electromagnetic actuation constantly on the bench and in the panel. Here is where the physics directly impacts your hardware choices:
- Contactors and Motor Starters: Large 240V AC contactors rely on the law of magnetism to pull heavy copper contacts together. The initial 'pull-in' current is high because the air gap is large (low inductance). Once the armature closes, the air gap vanishes, inductance spikes, and the holding current drops. If a contactor hums loudly, it means dirt or a mechanical obstruction is maintaining a tiny air gap, preventing the magnetic circuit from sealing and keeping the coil drawing maximum current until it burns out.
- Inductors and Flyback Spikes: When you de-energize a relay coil, the magnetic field collapses. According to Faraday's and Lenz's laws (corollaries to the broader electromagnetic laws), this collapsing field induces a massive reverse voltage spike to keep current flowing. Without a flyback diode (like a standard 1N4007), this spike will easily exceed 100V and instantly destroy the driving MOSFET or microcontroller GPIO pin.
- Stepper Motor Detent Torque: Even when unpowered, the permanent magnets in a NEMA 17 stepper motor interact with the iron stator teeth. This 'cogging' is a direct result of magnetic pole attraction seeking the lowest reluctance path.
Common Confusions: Flux Density vs. Field Strength
The most frequent mistake hobbyists make when reading sensor datasheets or designing magnetic latches is conflating B (Flux Density) with H (Field Strength).
Magnetic Field Strength (H) is the effort you put in. It is driven purely by the electrical current and the number of coil turns, measured in Amperes per meter (A/m). It does not care what material is inside the coil.
Magnetic Flux Density (B) is the result you get. It is the actual concentration of magnetic lines passing through an area, measured in Tesla (T) or Gauss (G). It is heavily dependent on the core material's permeability.
If you wrap a coil around a plastic tube and push 1 Amp through it, you get a specific H and a very tiny B. If you swap the plastic tube for a soft iron core and push the exact same 1 Amp through the same coil, your H remains exactly the same, but your B multiplies by thousands. When selecting a Hall effect sensor, the datasheet will always specify its trip point in Gauss or milliTesla (flux density), because that is what the silicon die actually experiences.
Decision Path: Choosing the Right Magnetic Sensor
When you need to detect a magnetic field for a limit switch, current sensor, or door alarm, the law of magnetism offers multiple transduction methods. Use this decision tree to select the exact component for your build.
| If Your Application Requires... | Then Choose This Technology... | Concrete Part Pick | Why It Wins Here |
|---|---|---|---|
| Directly switching high loads (>500mA) without a microcontroller | Reed Switch (Glass encapsulated) | Standex Meder MK06-6 | Contacts are sealed in inert gas, handles up to 1A directly, zero standby power draw. |
| High-speed logic switching (>1kHz) or RPM counting | Digital Hall Effect (Omnipolar) | Texas Instruments DRV5032 | Solid-state, no contact bounce, operates down to 1.65V, ultra-low power sleep modes. |
| Measuring exact linear position or DC current magnitude | Linear Hall Effect (Ratiometric) | Allegro Microsystems A1324 | Outputs an analog voltage proportional to the Gauss level (1.3 mV/G), ideal for ADC reading. |
| Detecting weak fields in high-EMI environments (like near VFDs) | GMR (Giant Magnetoresistance) or Fluxgate | NVE Corporation AAH002 | GMR sensors offer much higher sensitivity and temperature stability than standard Hall silicon. |
Frequently Asked Questions
Does temperature change the law of magnetism?
The fundamental law does not change, but the material properties do. Every ferromagnetic material has a Curie temperature. For standard Neodymium (NdFeB) magnets, operating above 80°C (176°F) causes permanent, irreversible loss of magnetic flux density. If your motor or sensor operates in a hot engine bay, you must specify Samarium Cobalt (SmCo) magnets, which tolerate up to 300°C, or use high-temperature Hall sensors like the TI DRV5012.
Can I stack two identical magnets to double the Gauss reading on my sensor?
No. Magnetic fields do not scale linearly when stacked. Stacking two N52 magnets will increase the reach (the distance at which the field is detectable), but the surface flux density will not double. The magnetic circuit quickly approaches saturation in the surrounding air, and you will see diminishing returns on your sensor's analog output.
Why do AC contactors have a shading coil?
Because AC current crosses zero 120 times a second (on a 60Hz grid). Without a shading coil (a shorted copper ring embedded in the pole face), the magnetic field would collapse to zero every 8.3 milliseconds, causing the armature to violently chatter and destroy the contacts. The shading coil uses Lenz's law to generate a delayed, out-of-phase magnetic field that holds the armature closed during the zero-crossings.
For deeper reference on magnetic unit conversions and SI standards, consult the NIST Guide to the SI. For practical circuit implementations of magnetic components, All About Circuits provides excellent foundational math, while the Texas Instruments Hall Effect portfolio offers modern application notes for solid-state magnetic sensing.






