LessonThe voltage divider · 17 min

Sensors and knobs: dividers that change

Many sensors are simply resistors whose value changes with the world: light, temperature, moisture, pressure, position. A microcontroller cannot read a resistance - but it can read a voltage. Put the sensor in a divider and its resistance becomes a voltage.

Resistive sensors.
SensorIts resistanceUsed in
LDR (light-dependent resistor)about 100 Ω in bright light, 10 kΩ indoors, 1 MΩ darkstreet lights, night lights, automatic phone-screen brightness (similar sensors)
NTC thermistor 10 k (B = 3950)33.6 kΩ at 0 °C, 10 kΩ at 25 °C, 3.6 kΩ at 50 °C, 0.7 kΩ at 100 °Cbattery packs, chargers, incubators, 3D printers, fridges
Soil moisture probehigh when dry, low when wetirrigation controllers
Force-sensitive resistorfalls as you press hardertouch pads, scales
Potentiometerthe wiper moves between the two endsvolume knobs, joysticks, settings
An LDR in a divider. Darker → the LDR's resistance rises → it takes a bigger share → Vout rises. At 10 kΩ (indoor light) Vout = 2.5 V; in the dark (1 MΩ) about 4.95 V.
An LDR in a divider. Darker → the LDR's resistance rises → it takes a bigger share → Vout rises. At 10 kΩ (indoor light) Vout = 2.5 V; in the dark (1 MΩ) about 4.95 V.

Which way round?

  • Sensor at the bottom (from the output to 0 V): Vout rises as the sensor's resistance rises.
  • Sensor at the top: Vout falls as its resistance rises.
  • Either works: choose whichever makes your program read naturally ("bigger number = darker").
An NTC thermistor's resistance falls as it warms. On top of a 10 kΩ resistor, that makes Vout rise with temperature: 2.5 V at 25 °C.
An NTC thermistor's resistance falls as it warms. On top of a 10 kΩ resistor, that makes Vout rise with temperature: 2.5 V at 25 °C.
Worked example: a thermistor thermometer

The NTC (10 kΩ at 25 °C) sits on top of a 10 kΩ resistor on 5 V. What is Vout at 0 °C, 25 °C and 50 °C?

  1. 0 °C (33.6 kΩ): 5 × 10 / (33.6 + 10) = 1.15 V.
  2. 25 °C (10 kΩ): 5 × 10 / 20 = 2.50 V.
  3. 50 °C (3.59 kΩ): 5 × 10 / 13.59 = 3.68 V.

Answer: 1.15 V, 2.50 V and 3.68 V. Not a straight line - a program converts the voltage back to °C with a formula or a table.

Choosing the fixed resistor

To get the biggest change of Vout over the range you care about, make the fixed resistor the geometric mean of the sensor's two extremes:

Rfixed ≈ √(Rmin × Rmax)
Rmin, Rmax
the sensor's resistance at the two ends of the range you want to measure
InteractiveTry it: choose the fixed resistor for an LDR
Vout lit (5 V supply)-V
Vout at dusk-V
Change you can read-V

With 1 kΩ and 100 kΩ the best fixed resistor is √(1 k × 100 k) = 10 kΩ: a 4.1 V swing. Try 1 kΩ or 100 kΩ instead and it shrinks to 2.45 V.

The potentiometer: an adjustable divider

A 10 kΩ potentiometer across 5 V. Its wiper (the arrow) slides along the resistive track; Vout can be anything from 0 V to 5 V.
A 10 kΩ potentiometer across 5 V. Its wiper (the arrow) slides along the resistive track; Vout can be anything from 0 V to 5 V.

A potentiometer ("pot") is one resistor track with a sliding contact, the wiper. The track above the wiper is R1, the track below is R2, and turning the knob moves resistance from one to the other. Volume knobs, light dimmers' control knobs, joysticks (one pot per axis) and the small screwdriver-adjusted "trimmers" used to calibrate a circuit are all potentiometers.

Where you meet it

Street lights and night lights

An LDR divider (often with a comparator) switches the lamp at dusk.

Battery packs and chargers

A 10 k NTC in a divider tells the charger the cells are too hot to charge.

Egg incubators

A thermistor divider feeds the controller that switches the heater.

Every knob

Volume, tone, fan speed, joystick axes: pots as adjustable dividers.

Practice 1A 10 kΩ fixed resistor (top) and an LDR (bottom) are across 5 V. The LDR is 40 kΩ. Vout?

Show the answer

Answer: 4 V

5 × 40 / 50 = 4 V.

Practice 2A pot's wiper is 30 % of the way up from the 0 V end of a 10 kΩ track across 5 V. What is Vout?

Hint

R2 (below the wiper) = 3 kΩ, R1 = 7 kΩ.

Show the answer

Answer: 1.5 V

5 × 3 / 10 = 1.5 V.

Practice 3With the sensor at the TOP of the divider, as its resistance rises Vout:

  1. rises
  2. falls
  3. stays the same
  4. becomes negative
Show the answer

Answer: B. falls

The sensor takes a bigger share, leaving less across the bottom resistor.

Challenge 4A soil probe reads 50 kΩ dry and 2 kΩ wet. What fixed resistor gives the biggest swing?

Hint

√(Rmin × Rmax).

Show the answer

Answer: 10000 Ω

√(2 k × 50 k) = √(100 × 106) = 10 kΩ.

Challenge 5The thermometer above (NTC on top of 10 kΩ, 5 V) feeds a 10-bit Arduino ADC (0 - 1023 for 0 - 5 V). What number does it read at 50 °C (NTC 3.59 kΩ)?

Hint

First Vout, then N = Vout / 5 × 1023.

Show the answer

Answer: 753

Vout = 5 × 10 / 13.59 = 3.68 V. N = 3.68 / 5 × 1023 = 753.