A magnetic field is an invisible vector field that exerts a physical force on moving electrical charges, magnetic materials, and current-carrying wires.

The Core Physics: Flux, Tesla, and Gauss

When you push current through a conductor, you generate a magnetic field around it. Conversely, when you move a conductor through an existing magnetic field, you force electrons to move, generating current. This two-way street is the foundation of every motor, generator, and transformer on your workbench. To quantify this, we use magnetic flux density (the B-field), which measures how concentrated the magnetic lines of force are in a given area.

The standard SI unit for magnetic flux density is the Tesla (T), defined by the National Institute of Standards and Technology (NIST) as one weber per square meter. In older schematics or when buying raw magnets, you will frequently see Gauss (G). The conversion is straightforward: 1 Tesla equals exactly 10,000 Gauss. A typical ceramic fridge magnet sits around 0.005 T (50 G), while a high-grade N42 Neodymium magnet pulls in at roughly 1.2 T (12,000 G) at its surface.

Worked Numeric Example: Lorentz Force on a Wire

Let’s calculate the actual physical force a magnetic field exerts on a current-carrying wire, a principle that dictates the torque in your DC motors. The formula for the Lorentz force on a straight wire is F = I × L × B × sin(θ), where I is current, L is the length of the wire inside the field, B is the magnetic flux density, and θ is the angle between the current and the field (we’ll assume 90° for maximum force, so sin(90°) = 1). For a deeper mathematical breakdown, refer to the Georgia State University HyperPhysics database.

Imagine you are designing a custom voice-coil actuator. You place a 5 cm (0.05 m) segment of 14 AWG copper wire into the gap of an N42 Neodymium magnet yielding 1.2 Tesla. You drive a steady 15 Amps through the wire.

  • F = 15 A × 0.05 m × 1.2 T × 1
  • F = 0.9 Newtons

0.9 Newtons is roughly equivalent to 90 grams of lateral force. While that sounds small, in a tightly packed motor armature with dozens of active coil segments acting on a small radius, these fractions of a Newton compound rapidly to produce substantial rotational torque.

What Magnetic Fields Change in a Real Circuit

In practical circuit design, magnetic fields are rarely just about creating motion; they fundamentally alter how voltage and current behave over time. The primary mechanism here is inductance. Any time current flows through a wire, it builds a magnetic field around that wire. If the current changes, the field expands or collapses, and that changing field induces a voltage that opposes the change in current.

This is where magnetic fields bite hobbyists. Consider a standard 12V electromechanical relay driven by an ESP32 GPIO via a transistor. The relay coil is essentially an inductor. When the transistor switches off, the magnetic field in the coil collapses instantly. According to Faraday’s Law of Induction, this rapid change in flux (di/dt) generates a massive reverse voltage spike—often exceeding 50V to 100V. Without a flyback diode to absorb this energy, that spike will arc across the transistor junction or feed back into your microcontroller, permanently bricking the GPIO pin.

Safety & Component Warning: Never switch an inductive load (relay, solenoid, motor, contactor coil) with a MOSFET or BJT without a reverse-biased flyback diode (like a 1N4007) placed directly across the coil terminals. The collapsing magnetic field will destroy solid-state switches that lack adequate avalanche clamping.

Beyond inductive kickback, external magnetic fields cause Electromagnetic Interference (EMI). If you route a 120V AC mains cable parallel to a low-voltage analog sensor line (like a thermocouple or audio signal), the 60Hz alternating magnetic field from the mains will induce a parasitic current in the sensor wire. This manifests as a persistent 60Hz hum or erratic ADC readings. The fix is physical separation, routing wires at 90-degree crossings, or using twisted-pair shielding to cancel out the induced magnetic flux.

Where You Meet This in Practice

You interact with engineered magnetic fields every time you power up a project. Here is where they do the heavy lifting in modern electronics:

  • Hall Effect Sensors: Devices like the Allegro A3144 (digital) or SS49E (analog) rely on magnetic fields to function. When a magnetic field passes perpendicularly through the semiconductor die, it pushes the flowing electrons to one side of the material, creating a measurable transverse voltage. As noted in the HyperPhysics Hall Effect primer, this allows you to measure RPM on a motor shaft or detect a closed door without any physical contact or mechanical wear.
  • Switch-Mode Power Supplies (SMPS): The transformers in your bench power supply or phone charger use high-frequency alternating magnetic fields to transfer energy between isolated primary and secondary windings. The ferrite core concentrates the flux, ensuring maximum mutual inductance and minimal energy loss.
  • Stepper and BLDC Motors: In a NEMA 17 stepper motor, the stator contains multiple electromagnetic coils. By sequentially energizing these coils, the controller creates a rotating magnetic field that drags the permanent magnet rotor along in precise 1.8-degree increments.

Common Confusions: Magnetism vs. Electrostatics

The most frequent mistake beginners make is confusing magnetic fields with electric fields. They are related but distinct phenomena. An electric field exists around any static electrical charge (like the voltage potential sitting at a battery terminal), and it pushes or pulls other charges along the wire. A magnetic field, however, is only generated by moving charges (current) or the intrinsic quantum spin of electrons in a permanent magnet.

People often assume that bringing a strong neodymium magnet close to a stationary wire will "push" the electrons and create a voltage. It won’t. A static magnetic field does absolutely nothing to stationary charges. To induce a voltage, either the wire must physically move through the field, or the magnetic field itself must change in strength over time.

Think of an electric field like water pressure sitting in a closed pipe—it represents the potential to move water the moment a valve opens. A magnetic field, by contrast, is like a cross-wind on a lake. The wind doesn’t push a sailboat that is tied to the dock; it only exerts force when the boat is moving across the water or when the wind itself shifts direction.

Frequently Asked Questions About Magnets and Magnetic Fields

How do I measure a magnetic field with a standard multimeter?

You cannot measure a static magnetic field directly with a standard multimeter. Multimeters measure voltage, current, and resistance, not magnetic flux density. To measure a field, you need a dedicated Gaussmeter or a Hall effect probe. However, if the magnetic field is changing (like an AC electromagnet or a spinning motor), you can use your multimeter to measure the AC voltage induced in a test coil of wire placed near the source, using Faraday’s Law to calculate the field strength backward.

Will a strong neodymium magnet erase my SSD or flash drive?

No. Solid-state drives (SSDs), USB flash drives, and SD cards store data using floating-gate transistors that trap electrical charges, not magnetic domains. Even a massive 1.4 T neodymium magnet will not alter the data on flash memory. However, that same magnet will instantly and permanently destroy a traditional spinning hard disk drive (HDD), a magnetic stripe credit card, or a compass. Keep strong magnets away from mechanical relays and reed switches, as the external field can force the internal contacts to stick or chatter.

Why does my 3D printer stepper motor get too hot to touch?

Unlike standard DC motors that only draw heavy current under mechanical load, stepper motors are typically energized continuously to maintain their holding position. This constant current creates a static magnetic field to lock the rotor, resulting in continuous I²R (current squared times resistance) heating in the copper windings. It is entirely normal for a NEMA 17 stepper motor case to reach 50°C to 70°C (122°F to 158°F). If it smells like burning plastic or exceeds 80°C, your stepper driver’s VREF current limit is set too high, or you lack adequate heatsinking and active cooling on the motor driver IC.

Does twisting wires actually cancel out magnetic interference?

Yes, and it is a critical technique for analog signal integrity. When you twist two wires together (like in a twisted-pair cable or a DIY thermocouple extension), any external magnetic field induces a tiny voltage loop in one direction for the first twist, and in the exact opposite direction for the next twist. Because the loops are physically adjacent and tightly coupled, the induced magnetic noise cancels itself out. For high-precision ADC circuits, always use twisted pairs for differential signals rather than running two loose, parallel wires across a breadboard.