Electricity: charge, current, voltage, resistance

The four quantities behind every circuit, explained with a water hose, and your first LED that you predict before you build.

55 min

Ta strona nie jest jeszcze przetłumaczona, dlatego jest po angielsku.

Four quantities

QuantitySymbolUnitWhat it is
chargeQcoulomb [C]the “amount of electricity”, carried by electrons
currentIampere [A]how much charge flows through a wire per second
voltageUvolt [V]the “pressure” that pushes the current
resistanceRohm [Ω]how hard it is for the current to flow

Charge can be positive or negative. Electrons are negative, protons positive. Equal charges push each other away, opposite charges pull together.

Current is how much charge passes a point in a given time:

I=Qt[A=C/s]I = \frac{Q}{t} \qquad [\text{A} = \text{C/s}]

Voltage is the “pressure” of electricity in a wire, just like water pressure in a hose. More exactly, it is the difference of potential between two points: U = φ₁ − φ₂. No difference, no current, the same way water does not flow through a hose when the pressure is equal at both ends.

Resistance is how hard it is for the current to get through. In the hose, it is a narrow place where the pressure drops. A resistor is a part with a deliberately large resistance, so the other parts do not burn. A potentiometer is a resistor whose resistance you change by turning a knob.

The water picture: higher pressure (voltage) pushes more water (current); a narrower hose (resistance) lets less through. Keep this picture; we will use it all through the course.

A circuit is a closed loop

Current only flows when there is a complete path: from the + of the battery, through the parts, and back to the −. That loop is called a circuit. Break it anywhere, and the current stops everywhere at once, not only after the break.

That is what a switch does. A closed switch completes the loop. An open switch makes a gap, and a gap of air is a resistance so large that practically no current gets across.

The battery does not “fill” the wire with electricity. The wires are already full of electrons, like a hose that is already full of water. The voltage pushes all of them along at the same time. That is why a lamp lights the moment you flip the switch, even though each electron moves very slowly.

Which way does the current flow? On paper, we say current flows from + to −. This rule was agreed on long before anyone knew about electrons. Electrons are negative, so they actually drift the other way, from − to +. For everything in this course it does not matter: use “from + to −” and all the formulas work.

Big and small numbers

In electronics you meet very small currents and very large resistances. Instead of writing many zeros, we use prefixes:

PrefixSymbolMeansExample
megaM× 1 000 0001 MΩ = 1 000 000 Ω
kilok× 1 0004.7 kΩ = 4700 Ω
millim÷ 1 00020 mA = 0.020 A
microµ÷ 1 000 000300 µA = 0.000 3 A = 0.3 mA

Always convert to plain units (V, A, Ω) before you put numbers into a formula. 9 V divided by 450 Ω gives amps. 9 V divided by “0.45” (because you meant kΩ) gives nonsense.

Ohm’s law

U=R⋅I⟺I=UR⟺R=UIU = R \cdot I \quad\Longleftrightarrow\quad I = \frac{U}{R} \quad\Longleftrightarrow\quad R = \frac{U}{I}

Why? Back to the hose:

  • higher pressure (U) → more water flows → I grows with U,
  • narrower hose (R) → less water flows → I falls with R.

The formula I = U / R says both at once. Multiply both sides by R and you get U = R · I.

Example: a 9 V battery and a 450 Ω resistor give I = 9 / 450 = 0.02 A = 20 mA.

The LED needs about 2 V for itself

An LED (light-emitting diode) lights up when current flows through it, and only in one direction: the longer leg is +. It does not behave like a resistor: once it has the voltage it needs, it lets almost any current through. Straight from a battery it would take far too much current and burn out. That is why an LED always gets a resistor in series.

A red LED keeps about 2 V for itself (green and blue ones a bit more). The rest of the voltage is left for the resistor:

UR=U−2 VI=U−2 VRU_R = U - 2\,\text{V} \qquad I = \frac{U - 2\,\text{V}}{R}

Now try it here. Change the voltage and the resistor and watch the current.

Dioda LED i jej rezystorPrzesuwaj oba suwaki.
Prąd
9.2mA
LED
bright
Napięcie na R
3.0V

I = (U − 2 V) / R

Picking the resistor yourself

Example: a 9 V battery, an LED that needs about 2 V and 20 mA:

R=9−20.02=350 ΩR = \frac{9 - 2}{0.02} = 350\,\Omega

350 Ω is not a value you can buy, so you take the nearest bigger standard value, for example 390 Ω. Bigger means a little less current, which is the safe side.

Check the result with the real resistor: (9 − 2) / 390 ≈ 0.018 A = 18 mA. A little under 20 mA, exactly what we wanted.

Resistors are sold in standard series of values. The most common one (called E12) repeats these numbers in every decade: 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82. So you can buy 33 Ω, 330 Ω, 3.3 kΩ and 33 kΩ, but not 300 Ω. That is why the same few values (220, 330, 1 k, 4.7 k, 10 k) appear in almost every kit.

How much current should an LED get? A normal 5 mm LED is usually made for about 20 mA at most; check the datasheet of yours. For an indicator light, 2 to 10 mA is often bright enough, and it saves battery. Modern LEDs are quite bright even at a few milliamps.

Power: how warm does the resistor get?

Every resistor turns the voltage it “uses up” into heat. How much heat each second is the power P, measured in watts [W]:

P=U⋅IP = U \cdot I

where U is the voltage across that part and I is the current through it.

Back to the 5 V LED circuit with 330 Ω. The resistor gets 5 − 2 = 3 V and the current is about 9 mA:

PR=3 V⋅0.009 A≈0.027 W=27 mWP_R = 3\ \text{V} \cdot 0.009\ \text{A} \approx 0.027\ \text{W} = 27\ \text{mW}

The small resistors in kits are usually rated for 0.25 W (a quarter of a watt). 27 mW is about a tenth of that, so the resistor stays cool. The LED itself gets 2 V · 9 mA ≈ 18 mW.

Check yourself

What the full course covers

The full course has eleven lessons. Each one has experiments you predict before you build, worked examples with real numbers, and a homework:

  1. Electricity: charge, current, voltage, resistance (this lesson, free)
  2. Series, parallel and the voltage divider
  3. Measuring with a multimeter: volts, amps, ohms and the beep
  4. Capacitors: storing charge, RC timing and clean power
  5. Current, magnetism and the DC motor
  6. The microcontroller and your first MicroPython program
  7. PWM: half a volt from a pin that only knows on and off
  8. Diodes and transistors: switching big currents with a small pin
  9. Sensors: buttons, knobs, light and measuring distance with sound
  10. Batteries, power supplies and safety
  11. Reading schematics and datasheets