Lesson 1 of 5 · 20 min
Voltage, current and resistance
Every circuit you will ever build comes down to three quantities and one equation. Learn them properly once and the rest of electronics stops being a collection of recipes and becomes arithmetic you can do on the back of an envelope. This lesson assumes nothing: we start from what electricity actually is.
Charge and current
Matter contains electric charge. Electrons carry a tiny negative charge, about 1.6 x 10^-19 coulombs (C). The coulomb is the unit of charge, and it is a huge amount: roughly 6.24 x 10^18 electrons.
Current is how fast charge flows past a point. One ampere (A) means one coulomb per second:
I = Q / t
If 0.5 C passes through a wire in 10 s, the current is I = 0.5 C / 10 s = 0.05 A = 50 mA. Robotics lives in the milliamp range (1 mA = 0.001 A) for signals and in the amp range for motors.
By historical convention, current is drawn flowing from positive to negative, the opposite of the real electron drift. Every datasheet and every formula uses this conventional current, so you should too.
Voltage is a difference
Charges do not move unless something pushes them. That push is voltage, measured in volts (V). One volt means one joule of energy is given to each coulomb of charge:
V = E / Q
A 9 V battery gives each coulomb 9 J as it moves through the circuit. The crucial point is that voltage is always measured between two points. Saying "the pin is at 5 V" really means "5 V above ground", where ground is the point we agreed to call 0 V. There is no such thing as voltage at a single point, only a difference.
Here is the one water-pipe picture you need. Think of a tank high above a pipe: the height difference is the voltage, the flow of water is the current, and a narrow section of pipe is the resistance. A taller tank pushes more water through the same pipe, and a narrower pipe lets less through at the same height. That is the whole analogy. From here on we use the real thing, because wires do things pipes do not, such as storing energy in fields, which you will meet in lesson 4.
Resistance
Resistance measures how strongly a component opposes current. Its unit is the ohm (symbol Ω). A material's resistance depends on its shape and its stuff:
R = rho * L / A
Here rho is the resistivity of the material in ohm-metres, L is the length and A is the cross-section area. Copper has rho of about 1.68 x 10^-8 Ω m. For a 1 m jumper wire with a cross-section of 0.5 mm^2 (0.5 x 10^-6 m^2):
R = 1.68 x 10^-8 * 1 / 0.5 x 10^-6 = 0.034 Ω
That is 34 milliohms: negligible, which is why we treat wires as perfect conductors in most circuits. A resistor is a part deliberately made to have a chosen, much larger resistance, such as 220 Ω or 10 kΩ.
Ohm's law
In a resistor, the current is proportional to the voltage across it. Georg Ohm wrote this down as:
V = I * R
Rearranged, it gives you whichever unknown you need: I = V / R and R = V / I. Keep the units consistent: volts, amps, ohms. If you work in kΩ and mA, the result still comes out right (kΩ times mA gives V), but mixing kΩ with A is the classic way to get a number that is off by a factor of 1000.
Example 1: find the current. A 9 V battery is connected across a 450 Ω resistor.
I = V / R = 9 V / 450 Ω = 0.020 A = 20 mA
Example 2: find the resistance. You apply 5 V to an unknown component and measure 25 mA.
R = V / I = 5 V / 0.025 A = 200 Ω
Example 3: find the voltage. 2 mA flows through a 4.7 kΩ resistor. How much voltage is across it?
V = I * R = 0.002 A * 4700 Ω = 9.4 V
Or in convenient units: 2 mA * 4.7 kΩ = 9.4 V. Same answer, fewer zeros.
Power and why resistors get hot
Voltage is energy per coulomb, current is coulombs per second. Multiply them and the coulombs cancel, leaving energy per second, which is power in watts (W):
P = V * I
Substitute Ohm's law and you get two more forms that are often handier:
P = I^2 * R and P = V^2 / R
Where does the energy go? Charges pushed through a resistor keep colliding with the atoms of the material and hand over their energy as heat. This is not a flaw, it is exactly what a resistor does: it turns electrical energy into heat.
Take 5 V across a 100 Ω resistor:
- Current:
I = 5 V / 100 Ω = 0.050 A - Power:
P = 5 V * 0.050 A = 0.25 W
A common through-hole resistor is rated for 0.25 W (a quarter watt). This one would run at its limit and get too hot to touch comfortably. Compare the LED resistor from Blink: 220 Ω carrying 13.6 mA dissipates P = I^2 * R = 0.0136^2 * 220 = 0.041 W, about a sixth of its rating, so it stays cool.
What is a safe voltage?
Danger to a person comes from the current that passes through the body, not the voltage alone. The voltage matters because dry skin has a resistance of tens of kΩ or more, and a higher voltage forces more current through it. As a rough guide, currents above about 10 mA can cause painful, involuntary muscle contraction, and a few tens of mA across the chest can be fatal.
The practical rules:
- Anything below about 50 V AC or 120 V DC is classed as extra-low voltage. Hobby robotics (USB 5 V, a 3.7 V LiPo cell, a 12 V supply) sits comfortably inside that.
- Mains (230 V or 120 V) is lethal. Do not open, modify or probe mains equipment while it is plugged in. Use a certified, enclosed power adapter.
- Low voltage does not mean low risk. A LiPo battery can deliver tens of amps into a short circuit, which melts wires and starts fires long before it can shock you. Fuse your battery leads and never leave charging batteries unattended.
Check yourself
A 12 V supply is connected across a 600 Ω resistor. What current flows?
Check yourself
A 330 Ω resistor has 3.3 V across it. How much power does it dissipate?