Resistors and Dividers
Basic Electronics
Course 1 · Chapter 3 · Resistors and Voltage Dividers
The resistor is the most common part in any circuit, and the voltage divider (two resistors in series, read from the middle) is the most useful thing you can build with it. Almost every sensor on a robot, from a light sensor to a button to a battery-level monitor, is read through a divider of some kind. This chapter covers how to read and choose resistors (colour codes, standard values, tolerance, power rating), then derives the divider formula, shows what happens when you connect a load to it, and uses it for pull-up and pull-down resistors, potentiometers and a light-sensitive circuit. It builds directly on Ohm's law from Basic Electronics 1 and the series, parallel and meter rules from Basic Electronics 2.
1. Choosing and reading resistors
Types
| Type | Typical tolerance | Typical power | Where you meet it |
|---|---|---|---|
| Carbon film | ±5 % | 1/8 W, 1/4 W, 1/2 W | Cheap hobby kits; fine for LEDs, pull-ups, general use |
| Metal film | ±1 % (or better) | 1/4 W, 1/2 W | Dividers, sensor circuits, anywhere the value matters |
| Wirewound / power | ±1 to 5 % | 1 W to 100 W | Motor, heater and load circuits; they run hot |
| Surface mount (SMD) | ±1 to 5 % | 1/16 W to 1/2 W | Every circuit board; value printed as digits (472 = 47 × 102 = 4.7 kΩ) |
| Variable (pot, trimmer) | ±20 % | 0.1 to 0.5 W | Section 5 |
The colour code
Through-hole resistors are too small to print numbers on, so the value is a set of coloured bands. Hold the resistor with the tolerance band (gold or brown, set slightly apart) on the right and read from the left. In a 4-band resistor the first two bands are digits, the third is the multiplier (a power of ten) and the fourth is the tolerance. A 5-band resistor (usual for 1 % metal film) has three digit bands, then the multiplier, then the tolerance.
| Colour | Digit | Multiplier | Tolerance |
|---|---|---|---|
| Black | 0 | × 1 | |
| Brown | 1 | × 10 | ±1 % |
| Red | 2 | × 100 | ±2 % |
| Orange | 3 | × 1 k | |
| Yellow | 4 | × 10 k | |
| Green | 5 | × 100 k | ±0.5 % |
| Blue | 6 | × 1 M | ±0.25 % |
| Violet | 7 | × 10 M | ±0.1 % |
| Grey | 8 | ||
| White | 9 | ||
| Gold | × 0.1 | ±5 % | |
| Silver | × 0.01 | ±10 % |
Why 4.7 k and not 4.5 k? The E-series
Resistors are made in a fixed set of preferred values, called the E-series, spaced so that each value is a fixed ratio above the last. The E12 series has 12 values per decade, so the ratio is 101/12 = 1.212. Rounded to two digits it gives:
In practice a hobby kit holds E12 or E24 values (1 k, 2.2 k, 4.7 k, 10 k, 22 k ...). When your calculation gives an awkward value, pick the nearest standard value and recalculate what the circuit does with it, as the divider design in section 3 shows.
2. Power rating and heat
A resistor turns all of the electrical power it receives into heat. The power is found from Ohm's law three equivalent ways:
Safety margin and derating
The rated power is what the part can dissipate at a stated ambient temperature (usually 70 °C) and still last. The manufacturer's derating curve is a straight line falling to zero power at the maximum temperature (typically 155 °C). So the hotter the surroundings, the less the resistor may dissipate:
3. The voltage divider
Two resistors in series across a supply share its voltage in proportion to their sizes. Take the voltage from the junction between them, and you have a lower voltage than the supply. This is a voltage divider.
Derivation
Worked example 1: 5 V down to 3.3 V
This is a real task: a 5 V sensor output going to a 3.3 V logic pin. Try R1 = 1 kΩ and R2 = 2 kΩ.
Tolerance: how accurate is a divider?
Take the 1 k / 2 k divider above. The worst high output comes when R2 is 5 % high and R1 5 % low, the worst low output the other way round:
The divider ratio is a little better than the resistors alone suggest, because errors in the two resistors partly cancel, but 1 % metal-film resistors are well worth the extra pennies when the voltage matters (a battery monitor, a reference level).
Loading: what happens when you connect something
The formula assumes nothing is connected to Vout. A load (an input pin, another circuit) of resistance RL connects in parallel with R2, which makes the lower leg smaller and the output lower. This is exactly the meter-loading effect of Basic Electronics 2.
The Thevenin view of a loaded divider
There is a tidy way to see this. From the output terminal, a divider looks like one source in series with one resistor (Thevenin's theorem, 1883). The source voltage Vth is what the output reads with nothing connected. The resistor Rth is what you measure between the output and ground with the supply replaced by a wire (so R1 and R2 are in parallel). Then the load simply forms a second divider with Rth:
4. Pull-up and pull-down resistors
A digital input pin reads 1 if it sees a high voltage and 0 if it sees a low one. If nothing is connected to the pin (it floats), it picks up stray electric fields from your hand, the mains wiring and neighbouring wires, and reads randomly. A button that only connects the pin to one rail leaves it floating whenever it is not pressed. The fix is a resistor that gently holds the pin to the other rail until something stronger takes over.
Each is a voltage divider where one leg is the button (0 Ω closed, infinite open) and the other is the pull resistor:
- Button open: the input pin draws almost no current (a CMOS input leaks about 1 µA at most). The resistor carries that tiny current, so the voltage across it is I × R = 1 µA × 10 kΩ = 10 mV. The pin sits within 10 mV of the rail it is tied to: a clean logic level.
- Button pressed: the button shorts the pin to the opposite rail, and the resistor now carries a current of V/R from supply to ground: 3.3 / 10 kΩ = 0.33 mA, which is small and only flows while the button is held.
Choosing the value
5. The potentiometer: a divider you can turn
A potentiometer (pot) is a resistive track with a sliding contact called the wiper. It has three terminals: the two ends of the track, and the wiper. The resistance between the ends is fixed (say 10 kΩ). The wiper splits the track into two parts, which makes a voltage divider whose ratio you set with the knob.
- Linear (B) and logarithmic (A) taper. A linear pot's resistance changes evenly with angle, which is what you want for position and sensor inputs. A logarithmic pot is for audio volume controls, matching the ear's sense of loudness. For robotics use linear.
- As a variable resistor (rheostat): use only the wiper and one end; the resistance between them goes from 0 to R. Tie the unused end to the wiper to stop the track going open-circuit if the wiper lifts.
- Trimmers are small pots for one-off adjustment with a screwdriver. Servo and joystick position sensors are often pots too.
- A pot on an ADC input (Basic Electronics 10) reads a number from 0 to 1023 on a 10-bit converter: at 2.50 V on a 5 V reference the reading is about 2.50 / 5 × 1023 = 512.
6. A light sensor from a divider
A light-dependent resistor (LDR, or photoresistor) is a resistor whose value falls as light on it increases. It is a perfect partner for the divider because a microcontroller reads voltage, not resistance, and the divider turns resistance into voltage.
Typical figures for a small cadmium-sulphide cell (they vary a lot between parts, so measure yours with the meter):
| Light | LDR resistance (illustrative) |
|---|---|
| Darkness | about 1 MΩ or more |
| Dim room | about 20 kΩ |
| Bright room | about 5 kΩ |
| Bright sunlight | about 500 Ω |
Place the LDR as the upper resistor (R1) and a fixed 10 kΩ resistor as the lower one (R2), so the output rises with light:
Choosing the fixed resistor. At Vout = half supply, a given change in the LDR resistance gives the biggest change in output. The divider is at half supply when R2 equals the LDR resistance, so choose R2 equal to the LDR resistance at the brightness you most care about: about 20 kΩ for a dim-room detector, 5 kΩ for a daylight detector, 10 kΩ if you want a good compromise over the whole range. Because the LDR changes over several decades, the output is naturally compressed, which is good for an ADC: it gets a useful signal from a vast range of light.
7. Build it: three dividers
Build the three circuits one at a time, taking each apart before the next. All use the same supply: 5 V from a USB power adapter, a breadboard power module, or the 5 V pin of an Arduino or similar board (use the board only as a power supply for now). If you use 3 AA cells (4.5 V), multiply every voltage reading below by 0.9.
Parts list
| Part | Value | Colour code (4-band) |
|---|---|---|
| R1 (stage A) | 1 kΩ, 1/4 W | brown-black-red |
| R2 (stage A) | 2 kΩ (or 2.2 kΩ, with new readings), 1/4 W | red-black-red |
| RL (load) | 10 kΩ, 1/4 W | brown-black-orange |
| Potentiometer (stage B) | 10 kΩ linear | |
| LDR (stage C) | Small CdS photoresistor | |
| R (stage C) | 10 kΩ, 1/4 W | brown-black-orange |
| Supply | 5 V (see above) | |
| Breadboard, 4 jumper wires, multimeter |
Measure each resistor with the meter and write the value down before you fit it: you will use the measured values to check your calculations.
Stage A: fixed divider and loading
- Wire with the supply disconnected. Check with the meter on Ω between the rails: with RL not yet fitted you should read about 3 kΩ.
- Connect the supply and read the supply voltage first (it is rarely exactly 5.00 V).
- Read Vout without RL (about 3.33 V), then fit RL and read again (about 3.13 V). Then swap RL for a 2 kΩ resistor (about 2.50 V).
Stage B: potentiometer
Turn the knob from one end to the other, watching the reading sweep from 0 V to 5 V. Set it to about half way (read 2.50 V) and add the 10 kΩ load: the reading should fall to about 2.00 V.
Stage C: light sensor
Before applying power, measure the LDR's resistance in room light, in the shade of your hand, and with a torch on it, and compare your Vout readings against 5 × 10 k / (RLDR + 10 k) using those resistances. Cover the sensor and the output should fall towards 0 V; shine a torch on it and it should rise.
Simulator version
Falstad Circuit Simulator (falstad.com/circuit): add a DC voltage source and set it to 5 V, resistors set to 1 k, 2 k and 10 k (double-click a part to edit its value), and a ground symbol. Hover over the middle node or use the right-click Scope option to see the voltage. For stage B use the Potentiometer from the Passive Components menu (its slider sets the wiper position). If your version has no photoresistor, a second potentiometer or a resistor you edit by hand stands in for the LDR.
Tinkercad Circuits (tinkercad.com): place a breadboard, resistors (their value is set in the panel that opens when you click a part), a Potentiometer and a Photoresistor (click it to move the light slider), a 5 V Power Supply and a Multimeter. Wire per the hole lists above, set the multimeter to volts, and press Start Simulation. To compare against the formula, set the multimeter to Ω, with the supply disconnected, to read the photoresistor's resistance at the slider's current position, then calculate the expected voltage.
Expected readings
| Measurement | Calculated | Real (typical) | Simulator |
|---|---|---|---|
| A: rail to rail resistance (supply off, no load) | 3.00 kΩ | 2.8 to 3.2 kΩ | 3.00 kΩ |
| A: Vout, no load | 3.33 V | 3.2 to 3.45 V (scales with supply) | 3.33 V |
| A: Vout, RL = 10 k | 3.13 V | 3.0 to 3.25 V | 3.13 V |
| A: Vout, RL = 2 k | 2.50 V | 2.4 to 2.6 V | 2.50 V |
| B: wiper at half, no load | 2.50 V | depends on the knob position | 2.50 V |
| B: wiper at half, RL = 10 k | 2.00 V | 1.9 to 2.1 V | 2.00 V |
| C: LDR 20 k (dim) | 1.67 V | use your measured resistance | formula with the shown resistance |
| C: LDR 5 k (bright) | 3.33 V | use your measured resistance | formula with the shown resistance |
The real readings scale with the real supply voltage (a supply reading 5.10 V gives 5.10 × 2/3 = 3.40 V in stage A), and resistor tolerance adds a few percent. The result that holds whatever the part tolerances is the ratio: Vout divided by the supply voltage should be 0.667 in stage A before loading, and 0.50 in stage B at half travel.
8. Challenges
Quick reference
- Colour code: digits 0 to 9 = black, brown, red, orange, yellow, green, blue, violet, grey, white; multiplier is the power of ten; gold = 5 %, brown = 1 %
- E12: 10 12 15 18 22 27 33 39 47 56 68 82 (× powers of ten); E24 and E96 for 5 % and 1 %
- Power: P = VI = V²/R = I²R; choose a rating of at least 2 × P; derate above 70 °C: P × (155 − T)/85
- Divider: Vout = Vin × R2 / (R1 + R2); R1 = R2 × (Vin/Vout − 1)
- Loading: replace R2 by R2 || RL, or use Vth = Vin × R2/(R1+R2), Rth = R1 || R2, Vout = Vth × RL/(Rth + RL); keep RL ≥ 10 × R2
- Pull-up / pull-down: 4.7 k to 47 k, 10 k typical; pull-up button reads 0 when pressed
- Pot: Vout = x × Vin unloaded; load at least 10 × the pot value; linear taper for sensors
- LDR divider: LDR on top, Vout rises with light; make the fixed resistor equal to the LDR at the light level that matters
Next, Basic Electronics 4 moves from parts that only resist to parts that store energy: capacitors and inductors, the RC time constant, and a simple filter and button-debounce circuit.