Blog · 2026-07-05 · Electronics
Two resistors in a row: the humblest circuit in electronics, and one of the most used on any robot. Here's the divider from first principles to the practical details — value selection, tolerance, impedance, calibration — that decide whether yours reads true.
Somewhere on almost every robot, a voltage needs to become a smaller voltage. The battery reads 12.6 V and the ADC pin tolerates 3.3. A sensor outputs 5 V logic into a 3.3 V board. A current-sense module wants its signal scaled. The tool for all of these is the same two-resistor circuit — and precisely because it's so simple, the engineering content lives entirely in the choices: which values, which tolerance, and which situations the divider quietly can't handle. Get those right and a fifty-cent circuit gives you telemetry you can trust for the life of the robot.
R1 from the input voltage to a middle node; R2 from that node to ground; the output is the middle node. Current flows through both resistors in series, the voltage drops divide in proportion to resistance, and the output is the fraction across R2:
Vout = Vin × R2 ÷ (R1 + R2)
That's the entire theory. A 3S LiPo at its 12.6 V full charge, through R1 = 27 kΩ and R2 = 9.1 kΩ: Vout = 12.6 × 9.1/36.1 = 3.18 V — comfortably inside a 3.3 V ADC's range, with the full battery swing (12.6 down to ~9.9 V) mapping onto 3.18 down to 2.50 V. Your code multiplies the ADC reading by one constant and battery voltage appears in a variable. The Voltage Divider Calculator runs this design in reverse — give it your input and ADC, it returns real-world resistor values from the standard series plus the code constant — but knowing the equation means you can sanity-check anything it, or any sensor vendor, hands you.
The ratio is set by the worst case: the maximum input must land at or below the ADC reference. Design to about 95% of the reference rather than 100% — batteries fresh off the charger overshoot, references vary a couple of percent, resistors have tolerance, and an ADC pin taken above its reference at best clips your reading and at worst (above the supply rail) damages the chip. The margin costs a sliver of resolution and buys the whole circuit's safety. For a 3S pack into 3.3 V: target ~3.13 V at 12.6 V in, a ratio near 4:1. For 4S into 3.3 V: near 5.4:1. For 5 V logic signals into a 3.3 V input, the classic 1 kΩ / 2 kΩ pair yields 3.33 V — right at the edge, which is why 1 kΩ / 1.8 kΩ (3.21 V) is the more careful choice.
Infinitely many pairs give the same ratio — 270 Ω/91 Ω, 27 k/9.1 k, 2.7 M/910 k — so what sets the scale? Three competing pressures:
Drain (pushes values up). The divider conducts continuously: I = Vin ÷ (R1+R2). At 12.6 V, the 360 Ω total of the smallest pair above burns 35 mA and 0.44 W — a resistor heater. The 36 kΩ pair draws 0.35 mA: fine on a switched circuit, marginal soldered permanently across a small pack (0.35 mA for a month is ~250 mAh — a real bite from a 1,000 mAh pack in storage). The 3.6 MΩ pair draws 3.5 µA — negligible forever.
ADC accuracy (pushes values down). An ADC input isn't a perfect observer: its sample-and-hold circuit briefly draws current from the source, and a high-impedance divider can't supply it fast enough, producing readings that sag low or vary with sample rate. Most microcontroller ADCs specify a maximum source impedance around 10 kΩ (the divider's output impedance is R1∥R2 = R1×R2/(R1+R2)). ESP32 ADCs are notoriously sensitive here.
The reconciliation: tens of kilohms total, and where higher values are needed for drain reasons, add a capacitor from the output node to ground — 100 nF is customary. The cap acts as a local charge reservoir the ADC samples from, making even megohm dividers read cleanly, and it low-pass filters noise for free. This resistor-pair-plus-cap is the canonical battery monitor, and it's what the calculator's impedance warning is steering you toward.
Resistors come in tolerance grades, and dividers inherit them unkindly: a 5% R1 high and 5% R2 low shifts the ratio several percent. On a battery monitor, 3% of 12 V is 0.36 V — the entire useful gap between "plenty left" and "land immediately" on lithium chemistry, whose discharge curve spends most of its life in a narrow voltage band (as the battery capacity guide shows). Two remedies, use both: 1% metal-film resistors (they cost nothing more in practice) and a one-time calibration — measure the actual pack voltage with a multimeter, read your ADC's report, and scale your code constant by the ratio. Calibration absorbs resistor tolerance, ADC reference error and everything else in one constant. In code, average 8–16 samples per reading (motor PWM loves to spray noise into analog pins) and apply a little hysteresis before declaring low-battery.
Once you know the shape, you see it everywhere on a robot. The "voltage sensor" module is a 30 kΩ/7.5 kΩ divider (5:1) on a breakout — knowing that, you can check whether its ratio suits your ADC reference instead of trusting the listing. A photoresistor or thermistor circuit is a divider where one resistor varies with light or temperature — the fixed resistor's value shapes where the sensor is most sensitive. Balance connectors present per-cell voltages that monitors read through divider networks. I²C bus pull-ups interacting with a stuck device form an accidental divider — which is why a bus voltage stuck at half-rail during debugging is such a diagnostic clue. And every potentiometer is a divider with a movable midpoint. The two-resistor pattern is less a circuit than a grammar.
Boundaries keep the tool honest. A divider cannot step voltage up — only down. It cannot power anything: the moment a load draws current from the midpoint, it's effectively a third resistor in parallel with R2 and the ratio collapses; dividers are for signals into high-impedance inputs, never for making a "5 V supply" from 12 V (that's a regulator's job — see the power distribution guide). It divides noise and spikes right along with the signal but doesn't clamp them: a motor-switching transient rides through scaled but intact, which is what the output capacitor and, for rough environments, a small series resistor plus clamp diodes are for. And it's one-directional for logic: fine for a 5 V output feeding a 3.3 V input, useless for the reverse trip — bidirectional lines like I²C need a real level shifter, the subject of the companion article 3.3 V vs 5 V Logic.
R1 — the larger one, for a step-down ratio — connects to the input; R2 to ground; output from between. Swapping them turns a 4:1 divider into a 1.33:1 divider and delivers ~9.5 V from a 3S pack into your 3.3 V pin. Check twice; the smoke test is not a metaphor here.
Yes — tap the balance connector with a divider per tap (each scaled for that tap's maximum), and subtract adjacent readings in code for per-cell voltages. Mind the subtraction: two 1%-accurate readings differ by up to 2%, so calibrate per channel if per-cell precision matters.
Two effects: genuine voltage sag (the pack really does droop under load — see the sag article) and PWM noise coupling into the ADC line. The capacitor and sample-averaging cure the second; nothing but power-system design cures the first, and your divider faithfully reporting it is a feature.
A calibrated battery reading is only useful if the code treats it wisely. Sample it away from motor-start moments where possible, or at least average across them. Convert to per-cell voltage (divide by S) so thresholds are chemistry-meaningful and portable between packs. Act in stages: a soft warning around 3.6 V per cell, reduced performance around 3.5, and a controlled shutdown by 3.4 — under load, remember, the resting voltage is higher than what you're reading, so these loaded thresholds are deliberately conservative. And log it: a timestamped voltage trace from each run costs nothing and turns "the battery seems worse lately" into a graph with an answer.
One equation, three pressures on the values, one calibration. Let the Voltage Divider Calculator pick buyable resistors and write your code constant, and when the signal needs to travel the other direction — 3.3 V out into a 5 V world — continue to 3.3 V vs 5 V Logic: Level Shifting Explained.