Voltage divider calculator

Voltage Divider Calculator: Measure Battery Voltage with Arduino and ESP32

A voltage divider is the simplest circuit for scaling a voltage down by a fixed ratio using two resistors in series. The output is Vout = Vin × R2 / (R1 + R2). In RC and maker projects its most common job is letting an Arduino or ESP32 analog input measure a LiPo battery safely. The calculator below gives you the output voltage, divider current, resistor power and ADC reading, suggests a standard resistor value for any target voltage and generates ready-to-use Arduino code.

🔋 Voltage Divider Calculator

Scale a high voltage down with two resistors to a level an Arduino or ESP32 can read. Calculates output voltage, current, resistor power and ADC value, and suggests a standard resistor for a target voltage.

Circuit

The highest voltage to be measured (e.g. a fully charged 4S LiPo = 16.8 V).
Selecting a preset updates the input voltage.
Resistor between Vin and the output node.
Resistor between the output node and GND.

Microcontroller ADC

The output must not exceed this value.
Uno/Nano: 10-bit, ESP32: 12-bit.
📉 Output voltage Vout
— V
✖️ Multiplier (Vin = Vout × k)
—
Division ratio R2 / (R1+R2)—
Divider current—
Power in R1—
Power in R2—
Thevenin (source) resistance—
Expected ADC reading at Vin—
Maximum measurable Vin—
Resolution (1 ADC step)—

Find a resistor for a target output

A value slightly below the reference leaves a safety margin.
Ideal / standard—

Arduino code

💡 The higher the divider resistance, the less current it draws from the battery, but ADC accuracy can suffer. A total of 10–100 kΩ is a good starting point for ESP32 and Arduino. With high-value dividers, a 100 nF capacitor on the output stabilises the readings.
// makerion · build beyond limits

How a voltage divider works

When two resistors are in series, the same current flows through both. By Ohm’s law, the voltage across each resistor is proportional to its value, so the voltage at the junction is the fraction R2 / (R1 + R2) of the total.

Current:  I    = Vin / (R1 + R2)
Output:   Vout = Vin × R2 / (R1 + R2)
In code:  Vin  = Vout × (R1 + R2) / R2

Example: A fully charged 4S LiPo is 16.8 V. With R1 = 47 kΩ and R2 = 10 kΩ, the output is 16.8 × 10 / 57 ≈ 2.95 V, safely below the ESP32’s 3.3 V limit.

Why you can’t measure the battery directly

An Arduino Uno’s analog inputs tolerate at most 5 V, and an ESP32’s only 3.3 V. A 3S LiPo (12.6 V) or a 12 V battery is far above that, and connecting it directly will destroy the pin and probably the board. The divider brings the voltage into range, and your code multiplies it back up.

Choosing resistor values

The ratio is not enough on its own; the absolute values matter too:

Total resistanceAdvantageDisadvantage
Low (1–10 kΩ)Stable, accurate ADC readingsDraws milliamps from the battery continuously
Medium (10–100 kΩ)Good balanceIdeal for most projects
High (>100 kΩ)Draws very little currentReadings can be noisy; add a capacitor

The ADC charges a small sampling capacitor on every reading. If the divider’s source resistance (R1 ∥ R2) is too high, that capacitor doesn’t fully charge and readings come out low. For AVR Arduinos, a source resistance around 10 kΩ or less is recommended. With high-value dividers, a 100 nF capacitor from the output to ground solves most of the problem.

If the battery stays connected, the divider current matters: a 1 kΩ + 1 kΩ divider draws 6 mA at 12 V, enough to drain a battery over weeks. A 47 kΩ + 10 kΩ divider draws only about 0.2–0.3 mA.

To read resistor values from their color bands, use the resistor color code calculator.

Ready-made dividers for LiPo batteries

Battery (full)For ESP32 / 3.3 VFor Arduino Uno / 5 V
1S LiPo (4.2 V)10 kΩ + 22 kΩ → 2.89 VCan connect directly
2S LiPo (8.4 V)22 kΩ + 10 kΩ → 2.63 V10 kΩ + 10 kΩ → 4.20 V
3S LiPo (12.6 V)33 kΩ + 10 kΩ → 2.93 V22 kΩ + 10 kΩ → 3.94 V
4S LiPo (16.8 V)47 kΩ + 10 kΩ → 2.95 V27 kΩ + 10 kΩ → 4.54 V
6S LiPo (25.2 V)82 kΩ + 10 kΩ → 2.74 V47 kΩ + 10 kΩ → 4.42 V

The first resistor is R1 (top) and the second is R2 (bottom). Always keep the output a little below the reference voltage; a full battery can rise slightly higher while connected to a charger. For LiPo cell voltages and safe ranges, see the LiPo battery guide.

Measuring with an ESP32

The ESP32’s ADC is not linear: readings drift near 0–0.1 V and 3.1–3.3 V. To get good results:

  • Choose a divider that keeps the output in the middle of the range (roughly 0.2–2.9 V).
  • Use analogReadMilliVolts() in the Arduino-ESP32 core, which applies the chip’s factory calibration.
  • ADC2 pins can’t be used while Wi-Fi is on; use ADC1 pins (GPIO 32–39).
  • Average several readings.
const int PIN = 34;                  // ADC1
const float K = (47.0 + 10.0) / 10.0;

float readVin() {
  uint32_t sum = 0;
  for (int i = 0; i < 16; i++) sum += analogReadMilliVolts(PIN);
  return (sum / 16.0) / 1000.0 * K;
}

Improving accuracy

  1. Use 1% tolerance resistors. With 5% parts, the ratio can be off by a few percent.
  2. Calibrate: Measure the real battery voltage with a multimeter, compare it with your reading and correct the multiplier in code.
  3. Know your reference: An Uno powered from USB may have a 5 V rail anywhere from 4.8 to 5.1 V, and it measures relative to that. For more stable results, use the internal 1.1 V reference (analogReference(INTERNAL)) with a matching divider.
  4. Average several readings with a short delay between them.

What a voltage divider is not for

A voltage divider is not a power supply. It can’t power a load such as a motor, servo, LED strip or module: as soon as the load draws current, the output voltage drops and the resistors heat up. To step voltage down for powering devices, use a regulator, a buck converter or, in RC systems, a BEC.

Likewise, a divider can shift a 5 V signal down to a 3.3 V input for slow signals, but a proper level shifter is more reliable on fast buses such as SPI or high-speed UART.

RC uses

  • Battery monitoring and low-voltage alarms built with an Arduino.
  • Telemetry: Flight controllers and telemetry modules measure battery voltage through a built-in divider; the “voltage scale” setting in their software is simply this divider’s multiplier.
  • Per-cell monitoring: Multi-cell packs need a separate divider on each balance lead tap, subtracting each reading from the next to find individual cell voltages.

Frequently asked questions

What happens if I swap R1 and R2?

The output will be far higher than expected. For 4S, 10 kΩ on top and 47 kΩ on the bottom gives about 13.9 V, which will destroy the microcontroller. Measure the output with a multimeter before connecting it for the first time.

What power rating do the resistors need?

In typical battery-sensing dividers, resistor power is in the milliwatt range, so standard 1/4 W resistors are plenty. The power rows in the calculator let you check.

Why do my readings fluctuate?

Common causes are a high-value divider without a capacitor, electrical noise from motors and ESCs, and not averaging. Add a 100 nF capacitor, keep wires short and average several readings.

Will the divider drain my battery?

Yes, slowly. A 47 kΩ + 10 kΩ divider draws about 0.3 mA from a 4S pack. That is negligible in the short term but can take a battery to dangerous levels if left connected for weeks. For long-term connections, switch the divider in only when measuring, for example with a MOSFET.

Found this useful?Share it with a friend or follow us on Instagram for new projects.

Similar Posts