The voltage divider
Two resistors in series and a wire taken from the middle. It is the most common circuit in electronics and the one people size wrongly most often, because the ratio sets the voltage and the size sets what it costs you.
Drag either resistor and watch the tap point move. Then notice the second number: what the pair wastes, every second, forever.
The formula, and what it really says
Vout = Vin × R₂ ÷ (R₁ + R₂). In words: the bottom resistor's share of the total. Two equal resistors give you half the input, whatever they are — 1 kΩ + 1 kΩ and 1 MΩ + 1 MΩ both output exactly half.
So the ratio is the only thing that sets the voltage. The absolute values set two other things, and both matter:
- How much current the pair wastes. 1 kΩ + 1 kΩ across 5 V draws 2.5 mA continuously. On a coin cell that is the whole budget.
- How easily the output sags. A divider is a weak source. Draw current from the tap and the voltage drops, because you are now in parallel with R₂.
The working range. Total 10 kΩ to 100 kΩ suits almost everything a microcontroller reads. Below that you are burning current for no reason; above about 100 kΩ an ESP32's ADC cannot charge its sampling capacitor in time and the reading goes soft and noisy.
The two jobs it does
Reading a higher voltage. A 12 V battery into a 3.3 V ADC needs a ratio of about 1:3.6 — 33 kΩ on top and 10 kΩ underneath gives 2.8 V at 12 V input, with headroom for a fully charged pack. This is the standard battery monitor.
Reading a sensor that is a resistor. An LDR, a thermistor or a soil probe is R₁ or R₂. As it changes, the tap moves, and your ADC reads a voltage instead of a resistance. Put the fixed resistor at roughly the sensor's mid-range value and you get the widest swing.
Why level shifting is not always this
A divider only works on the input side: it brings someone else's 5 V signal down to something your 3.3 V pin can read. It cannot raise your 3.3 V output to 5 V, and it is too slow for fast buses once the resistors are large. See logic levels for what to use instead.
Edit this page — content/fundamentals/electricity/the-voltage-divider.mdx
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.