ESP32 Calcs

Voltage Divider Calculator — With ESP32 ADC Reality Checks

Who this is for: For measuring voltages your microcontroller can't take directly — a 12 V battery rail or a 4.2 V LiPo into a 3.3 V ADC pin — and for splitting rails for sensors.

Two-resistor voltage divider: output voltage, divider current and dissipation — plus the R2 value that hits a target voltage, and the ESP32 ADC limits that decide whether your reading will actually be stable.

Quick answer: Vout = Vin × R2 ÷ (R1 + R2). For 12 V measured through 100 kΩ (R1) and 33 kΩ (R2): Vout = 12 × 33 ÷ 133 ≈ 2.98 V — inside a 3.3 V ADC's range. The divider current is Vin ÷ (R1 + R2) ≈ 0.09 mA and the pair dissipates about 1.1 mW. Two checks matter more than the math: keep the divider current between roughly 0.1 and 1 mA so the ADC reads stably, and never exceed 3.3 V on an ESP32 pin, no matter what the ratio says.

Signal being divided (battery, sensor output, rail)

Used by the R2 solver below

Vout
0.819 V
Divider current
0.248 mA
Total dissipation
0.82 mW
Divider ratio
24.8%
Solve for R2Value
Exact R2 for 2.5 V with R1 = 10 kΩ31.25 kΩ
Voltage across R1 / R22.48 V / 0.82 V
ESP32 ADC reality checkNumber
Safe analog input range0 – 3.3 V
Practical full-scale (11 dB attenuation)≈ 3.1–3.3 V
Recommended divider current0.1 – 1 mA
Dividing 5 V (or a 4.2 V LiPo) down to under 3.3 V is the #1 reason people reach for this calculator — an ESP32 ADC pin is not 5 V tolerant. Two practical traps: keep the divider current around 0.1–1 mA (roughly 1 kΩ – 100 kΩ total) or the ADC's sampling capacitor will drag readings low and noisy, and add a 100 nF capacitor from the tap to GND. On Wi-Fi projects, read analog values from ADC1 pins only — ADC2 is disabled while the radio is active. For a battery gauge, pick R1/R2 for a full-scale that matches your max voltage (e.g., 100 kΩ / 100 kΩ halves 6 V into the useful range).
Core facts
FormulaVout = Vin × R2 ÷ (R1 + R2)
Solvergives exact R2 for a target Vout
Recommended current0.1–1 mA through the divider
ESP32 ADC0–3.3 V · ADC1 only while Wi-Fi is on
Stabilizer100 nF capacitor from tap to GND

How a voltage divider works (and where it lies to you)

A voltage divider is two resistors in series: the input voltage splits across them in proportion to their resistance, and you tap the middle. That's the whole circuit — and it's the most-used (and most-misused) trick for getting a bigger voltage into a smaller ADC.

The classic use on an ESP32: measure a battery. A 4.2 V LiPo can't touch a 3.3 V pin, so R1 = 100 kΩ and R2 = 100 kΩ halves it to 2.1 V at full charge — or 47 kΩ/100 kΩ maps 4.2 V to a full-scale 2.85 V for better resolution. The calculator's second mode solves this backwards: enter Vin, R1 and your target Vout, get the exact R2 and then pick sensible standard values nearby.

Where dividers mislead: they assume nothing is connected to the tap. An ADC input (or anything else) loads the divider and drags Vout down — the ESP32's ADC samples through a small capacitor, so high-impedance dividers (say 1 MΩ) read low and jumpy. Keeping the total resistance in the 1 kΩ–100 kΩ range, adding a 100 nF capacitor from the tap to ground, and staying on ADC1 pins during Wi-Fi use are the three habits that turn a divider from a flaky toy into an instrument.

Common uses

  • Monitoring a 12 V or 24 V battery rail from a 3.3 V ADC
  • Reading a 4.2 V LiPo's charge level on an ADC1 pin
  • Level-shifting a 5 V sensor's analog output into range
  • Creating a 1.65 V midpoint reference for a single-supply circuit
  • Biasing a microphone or electret module around mid-rail

Choosing resistor values that survive contact with reality

Higher total resistance = less wasted current = more noise and slower settling into the ADC's sampling capacitor. Lower total = stable reading, more drain (0.1–1 mA is the sweet spot for battery projects, which is why you don't use 100 Ω values for a battery gauge). The compromise values people actually use: 100 kΩ/100 kΩ for 2:1, 47 kΩ/100 kΩ for 4.2 V→2.85 V, 100 kΩ/33 kΩ for 12 V→2.98 V, 100 kΩ/10 kΩ for 24 V→2.18 V. Every one of those keeps divider current under 0.3 mA.

The ESP32-specific limits

The ADC reads 0–3.3 V (practically ≈3.1 V with 11 dB attenuation, and readings compress near the top). ADC2 pins stop working while Wi-Fi is active — analog battery monitoring on a Wi-Fi device must use ADC1. And the ADC is not a precision instrument: it's noisy, non-linear near the rails, and ±2% is a realistic expectation before calibration; if you need better, calibrate against a known voltage in software.

Frequently Asked Questions

How do I pick R1 and R2 to measure a 12 V battery with an ESP32?
Target Vout near but below 3.3 V at full charge, with divider current under ~0.3 mA. For 12 V: R1 = 100 kΩ, R2 = 33 kΩ gives 2.98 V and 0.09 mA. For a 12 V lead-acid that really charges to 14.4 V: 100 kΩ + 24 kΩ lands at 2.79 V, safely inside range. Always leave headroom: a divider built for exactly 3.30 V at nominal voltage overshoots during charging and clamps the ADC (or worse).
Why does my voltage divider reading jump around?
High-value dividers present a high source impedance to the ADC, and the ESP32's ADC samples through a small capacitor — that combination reads low and noisy. Keep the total divider resistance at or under ~100 kΩ, add a 100 nF capacitor from the tap to ground, average a burst of readings in software, and keep the wire from the tap to the pin short.
Can I measure 5 V with a voltage divider into an ESP32?
Yes — that's exactly what dividers are for, since an ESP32 pin must never see above ~3.3 V. Two equal 10 kΩ resistors bring 5 V down to 2.5 V. Don't try to measure the 5 V rail with the same values if it can reach higher during transients; size the divider for the worst-case voltage and read your real maximum in software.
Is a voltage divider the same as a level shifter for digital signals?
For slow signals, a divider works as a poor man's level shifter (5 V data into 3.3 V input is a common case). For anything fast — SPI clocks, WS2812 LED data — a divider's RC with the line capacitance rounds the edges and corrupts the signal; use a proper level shifter (or a series resistor for a tolerant input). Dividers are for slow analog sensing and slow digital lines, not data buses.
Why does the divider current matter if I'm measuring a battery?
Because the divider draws that current 24/7 — it's a permanent load on the battery you're trying to protect. 0.09 mA sounds tiny, but it's 2.2 mAh a day: on a 2000 mAh battery left alone, that's nothing; on a coin cell, it's the whole battery in a week. For low-power nodes, power the divider from a GPIO (turn it on only while measuring) or use 1 MΩ values with a capacitor, weighing current against ADC stability.
What is the best resistor pair for a mid-rail reference?
For a 3.3 V single-supply op-amp or microphone bias at 1.65 V: two equal resistors — 10 kΩ/10 kΩ for low impedance, or 100 kΩ/100 kΩ to save current, plus a bypass capacitor on the tap. Feed it from a stable rail, not a noisy one — a divider faithfully divides noise too.

More guides

ESP32 AI Hardware Projects

The AI hardware builds everyone is making: voice assistants, desktop AI boxes, smart displays and AI toys — with the parts list, the wiring, and what each one actually teaches.

How Many LEDs Can an ESP32 Drive?

The honest answer: data pins drive unlimited addressable LEDs, GPIO pins safely drive one 10 mA indicator — here's the wiring that makes big strips work.

More Electronics calculators

Battery Life Calculator

Battery runtime for microcontroller projects: enter capacity, active current, duty cycle and sleep current to get real-world battery life in hours and days — the way it actually behaves on an ESP32-class board.

LED Resistor Calculator

Series resistor for one or more LEDs: enter supply, forward voltage and target current to get the exact resistance, the nearest E24 value to buy, actual current and the power rating you need.

PCB Trace Width Calculator

IPC-2221 trace width for your current, temperature rise and copper weight — external or internal layer — plus resistance and voltage drop when you enter the trace length.

LED Strip Power Calculator

Power supply sizing for LED strips: enter length and W/m to get total watts, total amps, the PSU wattage to buy with headroom, and how many power injection points the strip needs.