>
section 2 of 915 min read

2. Currents and Magnetic Fields

We have spent a lot of time on stationary charges. Now we let them move and watch a whole new phenomenon emerge.

2.1 What current is, mechanically

A current is moving charge. Specifically, current is the rate at which charge flows through a cross-section of a wire:

I=dqdtI = \frac{dq}{dt}

If 1 coulomb crosses your cross-section per second, that is 1 ampere — about 6.24 × 10¹⁸ electrons per second. A typical phone charger pushes 1–3 A. A laptop charger, 3–5 A. The starter motor in your car, hundreds of amps for a fraction of a second.

Here is a fact worth marveling at: although the current in a wire might be 1 A, the individual electrons are crawling along the wire at less than a millimeter per second. The reason your light turns on the instant you flip the switch is not that electrons race down the wire — they barely move — but that the push (the electric field) propagates down the wire at nearly the speed of light. The whole column of electrons starts moving almost simultaneously. It is like a long pipe already filled with marbles: push one in at one end, a different marble pops out the other end almost instantly, even though no individual marble traveled the length of the pipe.

Conventional current vs electron flow. Benjamin Franklin, picking arbitrarily, decided current "flows from positive to negative." This is the convention every textbook still uses. We later discovered that electrons actually flow the other way — from negative to positive. So when an electronics textbook says "current flows from + to −," that means the electrons are flowing from − to +. This bit of historical clumsiness has confused students for a century. It does not actually matter for any practical purpose; just know that "conventional current" is a fiction we keep around because nobody wants to rewrite all the textbooks.

2.2 Ohm's law: the most-used equation in electronics

We have voltage (the push) and current (the flow). What relates them? In ordinary materials at ordinary temperatures, the relationship is shockingly simple:

V=IRV = IR

Voltage equals current times resistance. Push harder, more flow. Make the pipe narrower (more resistance), less flow. This is Ohm's law, named after Georg Ohm who measured it in 1827.

We have already seen the water version of this:

Water-pipe analogy revisited. Imagine a vertical water tank feeding a pipe at the bottom. The height of the water is the voltage (the pressure pushing water out). The flow rate through the pipe is the current. The narrowness of the pipe is the resistance.

  • Tall tank, fat pipe: lots of flow. (High V, low R, big I.)
  • Short tank, fat pipe: gentle flow. (Low V, low R, modest I.)
  • Tall tank, narrow pipe: trickle. (High V, high R, small I.)
  • Tank empty: no flow at all. (V=0, no current, regardless of pipe.)

Now swap pipe for a kinked garden hose, and you literally feel the resistance — the kink restricts flow no matter how high you raise the source.

The unit of resistance is the ohm (Ω), defined exactly so that 1 V=1 A×1 Ω1 \text{ V} = 1 \text{ A} \times 1 \text{ Ω}. Resistors come in values from milliohms (battery internal resistance, motor windings) to gigaohms (input of an electrometer, glass insulators). Most resistors you will use are in the 100 Ω to 10 MΩ range — the sweet spot for normal electronics.

Two important rearrangements you will use constantly:

I=VR,R=VII = \frac{V}{R}, \qquad R = \frac{V}{I}

The first is "given a voltage and a resistance, how much current flows?" — used to size LED current-limit resistors, for example. The second is "given a voltage and a current, what was the resistance?" — used to figure out unknown resistances by measuring.

2.3 Worked example: sizing a resistor for an LED

You have a 5-volt power supply and a red LED. The LED drops about 2.0 V across itself when conducting and is rated for a maximum current of 20 mA. What resistor do you need in series so the LED runs comfortably?

The remaining voltage across the resistor is 52=35 - 2 = 3 V. To get 20 mA through it (or, more comfortably, 10 mA — LEDs last longer at lower currents):

R=VI=3 V0.010 A=300 Ω.R = \frac{V}{I} = \frac{3 \text{ V}}{0.010 \text{ A}} = 300 \text{ Ω}.

A 330 Ω resistor (the next standard value up) is the canonical "Arduino-blink-LED resistor." Now you know exactly why. If you forget the resistor, the LED tries to draw infinite current at zero internal resistance, instantly burns out (or the output pin of your microcontroller does, because microcontroller pins are typically rated for about 20 mA themselves and a direct-connected LED can draw 100+).

Real-world payoff. Almost every embedded gadget you can find has resistors performing exactly this role — limiting current to LEDs, shifting logic levels, biasing transistor base currents. The total resistor count in a modern smartphone is in the thousands. They are cheap, inert, and the workhorse passive component of all electronics.

2.4 Power: when energy meets time

Voltage tells you energy per charge. Current tells you charge per second. Multiply them: energy per second — which is power. The unit is the watt (W), equal to one joule per second.

P=VIP = VI

Or, using Ohm's law to substitute, you also get the equivalent forms:

P=I2R=V2R.P = I^2 R = \frac{V^2}{R}.

A 100-watt incandescent lightbulb on a 230-V line draws about 0.43 A. A 1500-W toaster on a 120-V line draws about 12.5 A. A laptop on USB-PD at 20 V drawing 5 A is consuming 100 W — and that is also where the heat in the resistor analogy goes: in your laptop, 100 W of electrical power becomes about 100 W of heat over time, requiring fans to dissipate it.

The I2RI^2R form is enormously important: resistive losses go up as the square of current. This is why every long-distance power transmission line operates at hundreds of thousands of volts. If you must move power P=VIP = VI over a wire, and the wire has resistance RR, your loss is I2RI^2 R. Cut II in half by doubling VV for the same PP — and your loss drops to one quarter. That is the I2I^2 in the equation paying off massively. The whole electric grid is structured around this single fact.

Consequence for hardware security. If P=VIP = VI, and a chip's VV is fixed, then its instantaneous power consumption is proportional to its current. Differential Power Analysis is an entire family of attacks built on the observation that a chip executing AES draws different currents when manipulating different bits of the secret key. Listen to the current with a sufficiently fast probe, and the key is recoverable from a few thousand operations. Every modern crypto chip now includes hardware countermeasures (current-balanced logic, power-supply jitter, decoupling caps that hide transients) specifically because Ohm's law leaks information.

2.5 Magnetic fields: what moving charge creates

Here is a deeply weird fact. Stationary charge produces an electric field. Moving charge produces, in addition, a magnetic field. Switch frame of reference (run alongside the moving charges) and the magnetic field disappears, replaced by an extra electric field. Magnetism is electricity seen from a moving frame. This was Einstein's first hint (in his 1905 paper on special relativity) that space and time were not what we thought.

For our purposes, the practical fact is this: any wire carrying current has a magnetic field circling it. Right-hand rule: point your right thumb along the direction of current flow, and your fingers curl in the direction of the field.

Eddies in a river. Imagine a river flowing south. The water itself is the current. Now imagine the swirls and eddies that form on either side of a moving boat (or even a stick stuck in the riverbed). Those swirls go around the disturbance — perpendicular to the flow, not along it. Magnetic fields do exactly that around currents. The "river" is electrons; the "swirls" are the magnetic field lines.

Quantitatively, the field of a long straight wire at distance ρ\rho from the wire is

B=μ0I2πρ,B = \frac{\mu_0 I}{2\pi \rho},

where μ0=4π×107\mu_0 = 4\pi \times 10^{-7} T·m/A is the permeability of free space — magnetism's analog of the permittivity ε0\varepsilon_0 we met for the electric field. (And — connecting two of nature's deepest constants — it turns out that the speed of light is c=1/μ0ε0c = 1/\sqrt{\mu_0\varepsilon_0}. We will see why in a moment.) The unit of magnetic field is the tesla (T). One tesla is enormous; the Earth's magnetic field is about 50 microteslas, while a refrigerator magnet is about 5 millitesla, and an MRI machine pumps out 1.5–3 T at the patient.

2.6 Inductors: coils that store energy in a magnetic field

If you wind a wire into a coil, the magnetic fields from each loop add up inside the coil and produce a much stronger field there. An inductor is just such a coil — possibly with an iron core to enhance the field even more.

When current flows through an inductor, energy is stored in its magnetic field, exactly as energy is stored in a capacitor's electric field:

W=12LI2,W = \frac{1}{2}LI^2,

where LL is the inductor's inductance, in units of henries (H). Big coils with iron cores can have henries of inductance; tiny SMD inductors on PCBs are in the microhenry to nanohenry range.

The defining behavior of an inductor: its voltage is proportional to the rate of change of its current, not the current itself.

vL=Ldidtv_L = L \frac{di}{dt}

This is the magnetic dual of the capacitor's iC=Cdv/dti_C = C \, dv/dt. Inductors resist changes in current; capacitors resist changes in voltage. Try to interrupt an inductor's current suddenly and you get a giant voltage spike — the energy stored in the magnetic field has to go somewhere. This is why every relay coil, motor winding, and solenoid in your circuits should have a flyback diode across it: the diode safely catches the spike and lets the magnetic energy bleed away through the diode's resistance instead of arcing across an MCU pin and frying it.

Real-world inductors you have used today.

  • Every laptop charger has a transformer (two coupled inductors). The primary winding stores energy in a magnetic field, then dumps it into the secondary at a different voltage.
  • Every wireless phone charger is two inductors loosely coupled across an air gap — the Qi standard.
  • The variable inductor of an old AM radio (the dial you turn) tunes which station you receive — the LC tank circuit selects one frequency.
  • The ferrite beads on cables (those little black cylinders you sometimes see molded onto USB cables) are inductors used to suppress high-frequency interference.

2.7 The Lorentz force: what a magnetic field does to a charge

A magnetic field BB exerts a force on a charge only if the charge is moving, and the force is perpendicular to both the velocity and the field:

F=qv×B\vec{F} = q\vec{v} \times \vec{B}

(That is a vector cross product, but you can ignore the math: just remember the direction is perpendicular to both arrows.)

Combined with the electric force, the total force on a charge is the Lorentz force:

F=q(E+v×B).\vec{F} = q(\vec{E} + \vec{v} \times \vec{B}).

This single equation is responsible for:

  • Electric motors. Run current through a coil sitting in a magnetic field, the Lorentz force pushes the coil sideways, the coil rotates, you have torque. Every motor on Earth — from your fridge compressor to a 20-megawatt wind turbine generator — uses this.
  • The Hall effect. If a current flows through a flat slab of conductor sitting in a perpendicular magnetic field, the Lorentz force pushes the moving charges to one edge, building up a transverse voltage called the Hall voltage. The polarity of this voltage tells you whether the moving charges are positive or negative — which is how we historically proved that current in p-type semiconductors is carried by holes, not electrons. Today, Hall sensors (a single tiny IC) live in your phone (to detect the magnet in the flip-cover and turn off the screen), in brushless motors (to know rotor position), in your car (wheel speed), and in non-invasive current probes used by both legitimate test gear and power-analysis attackers.
  • CRT televisions and oscilloscopes. Electrons fired down a vacuum tube are steered toward different pixels by Lorentz forces from coils around the tube. Old technology, but the entire field of electron-beam manipulation depends on it.
  • Mass spectrometers sort atoms and molecules by their charge-to-mass ratio using magnetic deflection.
  • Cyclotrons and synchrotrons accelerate particles to relativistic speeds by repeatedly bending their paths with magnetic fields and giving them little electric kicks each lap.

2.8 Faraday's law: the great connection

So far we have: charges create electric fields. Currents create magnetic fields. The two seem like separate effects.

In 1831 Michael Faraday discovered they are not. He found that a changing magnetic field creates an electric field. In equation form:

Edl=dΦBdt.\oint \vec{E} \cdot d\vec{l} = -\frac{d\Phi_B}{dt}.

In words: the rate of change of magnetic flux through a loop drives a voltage around the loop's perimeter. A constant magnetic field does nothing. A changing field — moving a magnet near a coil, or pulsing the current in a nearby coil — induces a voltage in the coil.

This single equation is responsible for an absurd amount of modern technology:

  • Electric generators. Spin a coil in a magnetic field; the flux through it changes, voltage appears, you have electric power. Every coal, gas, hydro, wind, and nuclear plant on Earth uses Faraday's law. Even solar plants (which use photovoltaics, not Faraday) are still distributed via grids whose transformers are pure Faraday's law.
  • Transformers. Apply AC voltage to a primary coil; its changing current makes a changing magnetic field in the iron core; that changing field induces a voltage in a secondary coil. The voltage ratio is the turns ratio. Every wall-wart adapter, every utility pole, every laptop charger contains a transformer.
  • Wireless charging. Same principle as a transformer, just with an air gap. Qi chargers run at a few hundred kilohertz to keep the coupling efficient across that gap.
  • RFID and NFC. The reader sends out a changing magnetic field; the tag's coil picks it up via Faraday induction; the tag uses that induced power to send a coded reply (by modulating how much power it absorbs, which the reader can detect). Your contactless credit card has a coil and a chip; it has no battery — it runs entirely on the magnetic field from the terminal.
  • Hall sensor's cousin, the inductive proximity sensor. A coil radiates a small AC field; a metal target nearby couples to it via Faraday; the change in coil impedance is detected. Used in metal detectors, factory automation.

2.9 The displacement current and Maxwell's flash of insight

Faraday's law has an obvious dual: should changing electric fields create magnetic fields, just as changing magnetic fields create electric ones? In 1865 James Clerk Maxwell realized that the existing equations of electromagnetism (Coulomb, Gauss, Ampère, Faraday) had a logical inconsistency. To fix it, he added a term called the displacement current — essentially saying yes, a changing electric field acts like a current and creates a magnetic field. With this addition, the four equations now famously known as Maxwell's equations were complete:

E=ρ/ε0(Gauss for E — charges make E-fields)\nabla \cdot \vec{E} = \rho/\varepsilon_0 \qquad \text{(Gauss for E — charges make E-fields)} B=0(Gauss for B — no magnetic monopoles)\nabla \cdot \vec{B} = 0 \qquad \text{(Gauss for B — no magnetic monopoles)} ×E=Bt(Faraday — changing B makes E)\nabla \times \vec{E} = -\frac{\partial \vec{B}}{\partial t} \qquad \text{(Faraday — changing B makes E)} ×B=μ0J+μ0ε0Et(Ampeˋre-Maxwell — currents and changing E make B)\nabla \times \vec{B} = \mu_0\vec{J} + \mu_0\varepsilon_0 \frac{\partial \vec{E}}{\partial t} \qquad \text{(Ampère-Maxwell — currents and changing E make B)}

Maxwell wrote these down and immediately noticed something staggering. If you wiggle an electric field, it creates a magnetic field (last equation). That magnetic field, if it is changing (which it is), creates an electric field (third equation). That new electric field, if changing, creates a magnetic field. And so on, forever, propagating outward through space.

He computed how fast the disturbance propagates. The answer: 1/μ0ε03×1081/\sqrt{\mu_0\varepsilon_0} \approx 3 \times 10^8 m/s. The speed of light. Maxwell had derived, from the laws of static electricity and magnetism, the existence of light itself — and predicted that radio waves, microwaves, X-rays, and gamma rays were all the same phenomenon at different frequencies. They all propagate at the same speed; they are all electromagnetic waves; they differ only in wavelength. Heinrich Hertz confirmed it experimentally in 1887 with the first radio transmission. Within decades, the entire field of radio communications was built on Maxwell's equations.

Hardware-security implication. Every clock signal in your CPU is a changing voltage. By Maxwell, every changing voltage radiates an electromagnetic wave at the same frequency. That wave can be picked up across the room with a sensitive antenna — and if you sample it fast enough, you can sometimes reconstruct what the chip was computing. This is the TEMPEST family of attacks, and it has been demonstrated against everything from CRT monitors (van Eck phreaking, 1985) to modern smartphones executing AES (multiple papers from the 2010s). Counter-defense: shielded rooms (Faraday cages), EM-resistant logic styles, careful PCB layout to keep noisy clocks away from antenna-like traces.