Li-ion battery voltage monitor with warning LEDs on Arduino: design worksheet and code

A ₹703 design worksheet for monitoring a 3-cell Li-ion pack with a resistor divider and the Uno’s 1.1 V reference, with the divider maths, ADC counts and warning thresholds worked out.

About the author · Editorial & verification standards

  • Parts₹703
  • Bench time2–3 h
  • LevelIntermediate
  • ReviewedNov 2026

A ₹703 voltage monitor that tells you when a robot battery is getting low. A resistor divider scales a 3-cell pack (12.6 V full) down to a safe level, the Uno reads it against its internal 1.1 V reference, and three LEDs and a buzzer show green, yellow or red. The page works through the divider and the ADC counts so you can check your own numbers.

Scope: intermediate. This is a design worksheet with illustrative costs. It has not been bench-tested by this site. The divider and count tables were computed by script. The thresholds are common rules of thumb for Li-ion packs, not a battery maker’s limits; check your own cells’ datasheet. A monitor tells you the pack is low but does not protect it, so use a proper protection board for cut-off. Handle lithium cells with care.

How it works

The Uno’s ADC accepts 0 to 5 V by default, but the 5 V rail moves with USB and load, so the reading drifts. The internal 1.1 V reference is steadier but nominal, so the divider must bring 12.6 V below 1.1 V. A 110 kilohm resistor on top and a 10 kilohm resistor at the bottom gives a ratio of 10 / 120 = 0.0833, so 12.6 V becomes 1.05 V and 9.9 V becomes 0.825 V.

At the 1.1 V reference one ADC count is 1.1 / 1023 = 1.075 mV at the pin, which is 12.9 mV at the battery. The divider draws 12.6 V / 120 kΩ = 105 µA, a small drain. Because the divider’s source resistance is high for the ADC, a 100 nF capacitor from the pin to ground steadies the reading, and the sketch averages 16 samples.

Bill of materials

PartQtyUnitTotal
Arduino Uno R3 (or compatible)1₹550₹550
110 kilohm resistor, 1%1₹2₹2
10 kilohm resistor, 1%1₹2₹2
100 nF capacitor1₹3₹3
LEDs (green, yellow, red)3₹5₹15
220 ohm resistors3₹2₹6
Active buzzer module1₹15₹15
Breadboard1₹60₹60
Jumper wires1₹50₹50
Parts total₹703

Scroll the table sideways to see every column.

Prices checked Nov 2026. Shipping and tools are not included.

Prices are illustrative figures for Indian sellers in November 2026, before shipping, and have not been checked against current listings.

The numbers

Pack voltagePin voltageADC count (1.1 V ref)Suggested state
12.6 V (full)1.050 V977Green
11.1 V (nominal)0.925 V860Green
10.5 V0.875 V814Yellow
9.9 V0.825 V767Red, beep
9.0 V0.750 V698Red, beep
Pin voltage = pack voltage × 10 / 120. Count = pin voltage × 1023 / 1.1. Thresholds are examples: roughly 3.7 V per cell nominal, 3.5 V caution, 3.3 V warning.

The internal reference is only nominal, commonly given as 1.1 V with a spread of several percent, and resistor tolerance adds a little more. Compare the displayed value with a multimeter on the pack and enter the correction in the sketch’s calibration constant.

Power and wiring

PartConnects toNote
Divider topPack positive through the 110 kΩ resistorFuse the pack positive lead as for any robot
Divider middleA0, with the 100 nF capacitor to GND
Divider bottom10 kΩ to GNDJoin the pack negative to the Uno GND
LEDs through 220 ohmD2, D3, D4Green, yellow, red
BuzzerD8Active buzzer
Triple-check polarity and the resistor order before connecting the pack. Never connect a pack straight to an analog pin.

The sketch

// Li-ion 3S voltage monitor: Uno + 110k/10k divider + LEDs + buzzer
// Design worksheet: calibrate CAL against a multimeter.

const int PIN = A0;
const int LED_G = 2, LED_Y = 3, LED_R = 4, BUZ = 8;
const float R_TOP = 110000.0, R_BOT = 10000.0;
const float VREF = 1.10;
float CAL = 1.00;                    // multiply to match a meter reading
const float V_OK = 10.8, V_LOW = 9.9;

float readPack() {
  long sum = 0;
  for (int i = 0; i < 16; i++) { sum += analogRead(PIN); delay(2); }
  float pin = (sum / 16.0) * VREF / 1023.0;
  return pin * (R_TOP + R_BOT) / R_BOT * CAL;
}

void setup() {
  analogReference(INTERNAL);         // 1.1 V on an Uno
  pinMode(LED_G, OUTPUT); pinMode(LED_Y, OUTPUT);
  pinMode(LED_R, OUTPUT); pinMode(BUZ, OUTPUT);
  Serial.begin(9600);
  for (int i = 0; i < 3; i++) { analogRead(PIN); delay(10); }   // let the reference settle
}

void loop() {
  float v = readPack();
  digitalWrite(LED_G, v >= V_OK);
  digitalWrite(LED_Y, v < V_OK && v >= V_LOW);
  digitalWrite(LED_R, v < V_LOW);
  digitalWrite(BUZ, v < V_LOW && (millis() / 500) % 2 == 0);   // slow beep
  Serial.println(v, 2);
  delay(500);
}

If the display reads high or low by a fixed ratio, set CAL to meter ÷ displayed. A pack under load sags, so readings taken while the motors run are lower than the resting voltage; some builds use a longer average or only judge the state when the load is light. The sketch has been proofread but not compiled on this site.

Test plan

  1. Bench supply or a known pack: check the reading against a multimeter at two voltages and set CAL.
  2. Threshold check: use an adjustable supply, if you have one, to step across 10.8 V and 9.9 V.
  3. Under load: run the robot motors and see how much the reading sags.
  4. Divider current: measure the drain with the monitor connected for a day and see if it matters for your pack.
  5. Noise: watch the reading with the motors running and add averaging if it jumps.
  6. Wiring check: verify the divider output with a meter before first connecting to the Uno.

What usually goes wrong

SymptomLikely causeFix
Reading far too highDivider wired wrong or wrong resistor valuesMeasure the divider output with a meter before connecting
Reading saturates at 1023Pin voltage above 1.1 VIncrease the top resistor or check the ratio
Reading driftsReference or resistor toleranceCalibrate with CAL
Jumpy under loadMotor noiseAverage more samples and keep wires short
Pack drains slowly when idleDivider always connectedAdd a switch or accept 105 µA drain

Upgrades

  • Per-cell sensing: measure each cell to catch an unbalanced pack.
  • Cut-off relay: disconnect the load below a hard limit.
  • Current sense: add a current sensor and estimate remaining capacity.
  • Display: show voltage and a percentage on a small screen.

Cost and parts notes

The ₹703 total is an illustration and does not include shipping. Use the cost calculator to compare sellers.

Common questions

Why the 1.1 V reference?

It does not move with the USB supply. The cost is a smaller input range, so the divider must scale harder.

Why a capacitor on the analog pin?

The divider has a high source resistance, and the capacitor helps the ADC sample a steady voltage.

Is 3.3 V per cell a safe limit?

It is a common warning level, not a rule. Follow your cell’s datasheet.

Can I use this on a 12 V lead-acid battery?

With the same divider it would work for the 10 to 14 V range, but check the 1.1 V limit at the top of the range.

Last reviewed: November 2026. This is a design worksheet with illustrative costs. It has not been bench-tested by this site; library names, pins and limits must be checked against your board and the current library versions, and measurements from your build are welcome.

More builds

Next builds to try

Free: the final-year project pack

A shortlist with BOMs, a report outline that matches the usual chapter scheme, a costing sheet and 40 viva questions. Built for the February–April submission season.

The Build Note

One short email when something is worth your bench time.

A new build sheet, a part price that moved, or a mistake worth avoiding. No daily drip, no recycled news.

One short email when a build or a price is worth your time. Unsubscribe in one click.