Basics · 12 min read

Connecting Batteries in Series and Parallel: Voltage and Arduino

Series adds voltage, parallel adds capacity. See AA, 9 V and 18650 examples, how to choose a battery holder, and the right battery pack for Arduino, ESP32 and Pico.

Connecting batteries in series means joining the positive end of one to the negative end of the next so the voltages add up: four 1.5 V AA batteries in series give you 6 V, but the capacity stays the same as a single cell. In parallel, all the positives are joined together and all the negatives are joined together; the voltage stays the same, but the capacity and the current you can draw add up. When you want to take your Arduino, ESP32 or Raspberry Pi Pico project off the wall outlet and make it portable, knowing how many of which battery to use and how to connect them decides whether your project runs for hours or only a few minutes.

In this post you'll see with formulas how series and parallel connections change voltage and capacity. We walk step by step through real examples with AA, 9 V and 18650 batteries, why mixing different batteries is dangerous, how to choose the right battery holder and how to find the right combination for your board. At the end there's ready-to-use code that measures battery level with a voltage divider on Arduino, ESP32 and Pico.

AA battery 1.5 V
AA battery: the alkaline type gives 1.5 V and the rechargeable NiMH type gives 1.2 V; capacity is between 2000 and 2800 mAh depending on brand and current draw.

What is a series battery connection and how does it work?

In a series connection you line the batteries up end to end like a chain: the positive of the first goes to the negative of the second, the positive of the second to the negative of the third, and the free first negative and last positive become the ends of the pack. Because the current passes through all the batteries one after another, every cell carries the same current and the voltages add up: V_total = V1 + V2 + … + Vn. Capacity doesn't add up; four 2500 mAh batteries in series still make a 2500 mAh pack, because every cell discharges the same charge at the same time. For example, four alkaline AAs give 4 × 1.5 = 6 V, and two 18650 cells give 2 × 3.7 = 7.4 V. In electronics the number of series cells is written with the letter "S": 2S means two cells in series, 3S means three.

Parallel connection: same voltage, more capacity

In a parallel connection all the positive terminals meet at one point and all the negative terminals at another. The voltage stays the same as a single battery's, but the capacity adds up: C_total = C1 + C2 + … + Cn. Because the load current is shared among the cells, each one is stressed less, the pack lasts longer and it can deliver higher current easily. The number of parallel cells is written with "P"; 2S2P is a pack of four cells in which two series groups are connected in parallel, and with 2500 mAh 18650s it gives 7.4 V and 5000 mAh. To see how much energy a pack really holds, look at watt-hours: E (Wh) = V × Ah. Whether you connect four 1.5 V 2.5 Ah batteries in series (6 V × 2.5 Ah) or in parallel (1.5 V × 10 Ah), the total energy is 15 Wh; the connection changes not the energy but the voltage and current at which that energy is delivered.

FeatureSeriesParallelSeries-parallel (2S2P)
ConnectionPositive to the next battery's negativePositives together, negatives togetherTwo series groups connected in parallel
VoltageAdds up (n × V)Unchanged (V)2 × V
Capacity (mAh)Unchanged (C)Adds up (n × C)2 × C
Current capabilitySame as a single cellMultiplied by nDoubled
Example with 4 × AA (1.5 V, 2500 mAh)6 V, 2500 mAh1.5 V, 10,000 mAh3 V, 5000 mAh
Total energy15 Wh15 Wh15 Wh

Battery types: AA, 9 V and 18650 compared

BatteryNominal voltageFull / empty voltageTypical capacityRechargeable?
AA alkaline1.5 V1.6 V / 0.9–1.0 V2000–2800 mAhNo
AA NiMH1.2 V1.4 V / 1.0 V1900–2500 mAhYes
9 V alkaline9 V9.5 V / about 6 V400–550 mAhNo
9 V NiMH8.4 Vabout 9.8 V / 7 V170–300 mAhYes
18650 Li-ion3.6–3.7 V4.2 V / 2.5–3.0 V2000–3500 mAhYes (with a dedicated charging circuit)
18650 Li-Ion battery 3.7 V
18650 Li-ion cell: 18 mm diameter, 65 mm long; 3.7 V nominal, 4.2 V when fully charged. A single cell is ideal for ESP32 and Pico, and two cells in series (2S) for Arduino Uno.

Ready-made examples: which combination gives how many volts?

CombinationVoltageCapacityWhere it fits
2 × AA series3 V (NiMH: 2.4 V)about 2500 mAhLED circuits, simple 3 V circuits
3 × AA series4.5 Vabout 2500 mAhPico VSYS, Arduino 5V pin (weakens as the batteries drain)
4 × AA NiMH series4.8 Vabout 2000 mAhArduino 5V pin, servo motors
4 × AA alkaline series6 V (6.4 V when fresh)about 2500 mAhServo and DC motors; don't connect directly to the Uno's 5V pin
6 × AA series9 Vabout 2500 mAhArduino VIN or DC jack, L298N motor supply
1 × 9 V9 Vabout 500 mAhShort Arduino experiments, low-current circuits
1S 186503.7 V (4.2 V full)2000–3500 mAhESP32 (via an LDO), Pico VSYS
2S 18650 series7.4 V (8.4 V full)2000–3500 mAhArduino Uno / Nano VIN, robot car
1S2P 186503.7 V4000–7000 mAhLong-running ESP32 and Pico projects

The risk of mixing different batteries

In a series pack all the cells carry the same current, so the weakest cell runs out first. The others are still full and keep forcing current through the dead cell, which gets charged in reverse (cell reversal). The result is heating, gas release and, with alkaline batteries, a white, corrosive leak that eats the holder's springs and the board's copper traces. In a parallel connection the danger is different: the cell with the higher voltage pushes current straight into the lower one. Because batteries have very low internal resistance (around 20–50 mΩ for an 18650), even a 0.3 V difference between two cells means an uncontrolled current of several amps, which heats the cells. Mixing new with old, alkaline with NiMH, or 2000 mAh with 3000 mAh cells therefore both wastes capacity and creates a safety risk.

  • Same chemistry: Never put alkaline, NiMH and Li-ion cells in the same pack; their voltages and discharge curves are different.
  • Same brand, model and capacity: Keep the cells' internal resistances close; the lower-capacity cell always runs out early.
  • Same age and charge level: Replace all the batteries in the pack together; swapping just one for a new one unbalances the pack.
  • Equalise voltage before paralleling Li-ion cells: Keep the difference between cells under 0.05 V; measure with a multimeter and charge the cells separately if needed.
  • Use a BMS on series Li-ion packs: 2S or 3S packs should be used with a balancing protection board (BMS) that guards the cells against overcharge, over-discharge and short circuits.
  • Fuse against short circuits: On packs that can deliver high current, a small fuse or polyfuse on the positive line reduces the fire risk considerably.
The TP4056 charging module is for a single Li-ion cell (1S, 4.2 V) only. Since its output is limited to 4.2 V it can't charge two 18650s in series, and connecting the module to just one cell of a series pack leaves the cells unbalanced. Charge 2S packs with an 8.4 V 2S charger and a BMS. Short-circuiting an unprotected Li-ion cell can cause a fire.

How do you choose a battery holder?

AA battery holder wired in series
AA battery holders are wired in series internally: a 2-cell holder gives 3 V, a 4-cell holder 6 V and a 6-cell holder 9 V. The red wire is positive and the black wire is negative.
  • The number of slots sets the voltage: Ready-made AA and AAA holders are almost always wired in series internally; choose the voltage you need by the number of slots.
  • Models with a switch and a cover: A holder with an on-off switch lets you cut the circuit without removing the batteries; a covered holder keeps the batteries from flying out in moving robots.
  • Check the wiring of 18650 holders: Some dual 18650 holders are wired in series (7.4 V) and some in parallel (3.7 V). Insert the cells and measure the output leads with a multimeter before connecting to the circuit.
  • Current capability: The springs and thin wires of cheap holders cause a noticeable voltage drop at a few hundred milliamps. For robots with DC motors, choose holders with thick wires and sturdy springs.
  • Clip for a 9 V battery: A 9 V battery connects to the Arduino's power input with a snap clip and an optional DC jack adapter; if the exposed ends of the clip touch each other, the battery is short-circuited.
  • Protected cell length: 18650 cells with a protection circuit can reach 67–70 mm and may not fit short holders; check the length your holder accepts before you buy.

The right combination for Arduino, ESP32 and Pico

BoardPower inputAccepted rangeRecommended battery
Arduino Uno / NanoVIN pin or DC jack (Uno)7–12 V recommended2S 18650 (7.4 V) or 6 × AA (9 V)
Arduino Uno / Nano5V pinRegulated 5 V (5.5 V at most)4 × AA NiMH (4.8 V) or a regulated pack
ESP32 development board5V / VIN pin5 V (goes to the on-board 3.3 V regulator)1S 18650 + 5 V boost converter or 4 × AA NiMH
ESP32 development board3V3 pin3.0–3.6 V1S 18650 + low-dropout (LDO) 3.3 V regulator
Raspberry Pi PicoVSYS pin1.8–5.5 V1S 18650, 3 × AA alkaline or 3 × AA NiMH

You can estimate how long a battery will last with this formula: time (hours) = capacity (mAh) / average current (mA) × 0.8. The 0.8 factor is a margin for regulator losses, temperature and the battery not being fully dischargeable. An Arduino Uno on its own draws about 45–50 mA, and reaches 60 mA with a few sensors and LEDs. With a 2500 mAh 2S 18650 pack it runs for 2500 / 60 × 0.8 ≈ 33 hours. The same circuit on a 500 mAh 9 V battery lasts only 500 / 60 × 0.8 ≈ 6.5 hours, and because a 9 V battery's voltage drops quickly under load, the real time is even shorter. An ESP32 with Wi-Fi on draws 80–120 mA on average and up to 250 mA in short peaks; that's why in ESP32 projects an 18650 or a 1S2P pack, used together with deep sleep, can run for days or even weeks. If you don't want to do the calculation by hand, you can use the battery life calculator.

Measuring battery voltage: the voltage divider connection

The easiest way to tell how full a battery is is to measure its voltage. But the 8.4 V of a 2S pack is higher than the 5 V an Arduino analog input can handle, and the 4.2 V of a 1S cell is higher than the 3.3 V limit of the ESP32 and Pico. So you build a voltage divider from two resistors: V_out = V_bat × R2 / (R1 + R2). Two equal resistors cut the voltage exactly in half; 8.4 V becomes 4.2 V and 4.2 V becomes 2.1 V. Because the divider draws current continuously, use 100 kΩ resistors on the ESP32 and Pico to preserve battery life; on the Uno, 10 kΩ is enough for a stable ADC reading and uses only 0.42 mA at 8.4 V. You can adjust the values for your own pack with the voltage divider calculator.

ConnectionArduino Uno (2S 18650)ESP32 (1S 18650)Raspberry Pi Pico (1S 18650)
Battery plus (+)Top of R1 and VINTop of R1 and LDO inputTop of R1 and VSYS
R1 – R2 midpointA0GPIO 34GP26 (ADC0)
Bottom of R2GNDGNDGND
Battery minus (−)GNDGNDGND
Resistor valuesR1 = R2 = 10 kΩR1 = R2 = 100 kΩR1 = R2 = 100 kΩ
Highest voltage at the pin4.2 V2.1 V2.1 V
If the battery voltage is higher than the board's operating voltage, never connect it directly to an analog pin: feeding 8.4 V to the Uno's A0 pin or 4.2 V to an ESP32 GPIO permanently damages the input stage. Also, the battery's negative and the board's GND must be common; without a common ground the measured value is meaningless.

Battery level indicator with Arduino

  1. Insert two 18650 cells into the dual holder wired in series and confirm with a multimeter that the output is between 7.4 and 8.4 V.
  2. Connect the holder's positive wire to the Uno's VIN pin (or to a DC jack adapter) and the negative wire to GND.
  3. Connect two 10 kΩ resistors in series from battery positive to GND; take the point where the two resistors meet to A0.
  4. You'll use the on-board LED (pin 13) as the low battery warning; no extra part is needed.
  5. Upload the code, open the Serial Monitor at 9600 baud and compare the voltage on screen with what the multimeter shows.
C++ (Arduino IDE)
1const int BAT_PIN = A0;          // bölücü orta noktası / divider midpoint
2const int LED_PIN = 13;          // düşük pil uyarısı / low battery warning
3const float R1 = 10000.0;        // üst direnç / top resistor
4const float R2 = 10000.0;        // alt direnç / bottom resistor
5const float VREF = 5.0;          // ADC referansı / ADC reference
6const float V_EMPTY = 6.4;       // 2S boş (2 x 3,2 V) / 2S empty
7const float V_FULL = 8.4;        // 2S dolu (2 x 4,2 V) / 2S full
8const float V_LOW = 6.8;         // uyarı eşiği / warning threshold
9
10void setup() {
11  Serial.begin(9600);
12  pinMode(LED_PIN, OUTPUT);
13}
14
15void loop() {
16  long sum = 0;
17  for (int i = 0; i < 16; i++) {          // 16 ölçümün ortalaması / average of 16 samples
18    sum += analogRead(BAT_PIN);
19    delay(2);
20  }
21  float raw = sum / 16.0;
22  float vPin = raw * VREF / 1023.0;        // pindeki gerilim / voltage at the pin
23  float vBat = vPin * (R1 + R2) / R2;      // pil gerilimi / battery voltage
24  int pct = (int)((vBat - V_EMPTY) / (V_FULL - V_EMPTY) * 100.0);
25  pct = constrain(pct, 0, 100);            // 0-100 aralığında tut / keep within 0-100
26
27  Serial.print(F("Pil / Battery: "));
28  Serial.print(vBat, 2);
29  Serial.print(F(" V  %"));
30  Serial.println(pct);
31
32  digitalWrite(LED_PIN, vBat < V_LOW ? HIGH : LOW);   // pil zayıfsa LED yanar / LED on when battery is low
33  delay(1000);
34}

To reduce noise, the code takes 16 readings from A0 and averages them. The raw value is in the 0–1023 range; it's multiplied by the 5 V reference and divided by 1023 to get the voltage at the pin, then multiplied by the divider ratio (R1 + R2) / R2 = 2 to get the battery voltage. The percentage calculation treats 6.4 V (3.2 V per cell) as empty and 8.4 V as full. Because the Li-ion discharge curve isn't linear, this percentage is a rough estimate: the cell spends most of its time between 3.6 and 3.9 V and then drops quickly at the end. When the voltage falls below 6.8 V the on-board LED lights up to tell you it's time to charge the battery. Since the measurement uses the board's 5 V rail as the reference, a low rail such as 4.8 V when powered over USB can shift the reading by a few percent; for a more precise result, replace the VREF constant with the real value you measure on the 5V pin.

Battery measurement with ESP32 and Raspberry Pi Pico

A single 18650 cell is the most practical power source for the ESP32 and Pico. On the ESP32, connect the divider midpoint to GPIO 34; this pin is on an ADC1 channel and can be read even when Wi-Fi is on (ADC2 pins conflict with Wi-Fi). The analogReadMilliVolts() function, available in versions 2.x and 3.x of the Arduino core, returns millivolts directly using the board's factory calibration, so you don't have to deal with the non-linear behaviour of the ESP32 ADC. On the Pico you can connect the cell straight to the VSYS pin, because the on-board buck-boost converter turns an input of 1.8–5.5 V into 3.3 V. Connect the divider output to GP26; in MicroPython read_u16() returns a value between 0 and 65535. On a standard Pico, VSYS/3 is already wired internally to GP29 and can be read with ADC(29) without an external resistor; on the Pico W this pin is shared with the wireless chip, so an external divider is safer.

C++ (Arduino IDE)
1const int BAT_PIN = 34;          // bölücü orta noktası (ADC1) / divider midpoint (ADC1)
2const float DIVIDER = 2.0;       // (R1 + R2) / R2, 100k + 100k
3const float V_EMPTY = 3.2;       // boş hücre / empty cell
4const float V_FULL = 4.2;        // dolu hücre / full cell
5
6void setup() {
7  Serial.begin(115200);
8  analogReadResolution(12);      // 12 bit çözünürlük / 12-bit resolution
9}
10
11void loop() {
12  uint32_t sum = 0;
13  for (int i = 0; i < 16; i++) {
14    sum += analogReadMilliVolts(BAT_PIN);   // kalibre mV / calibrated mV
15    delay(2);
16  }
17  float vBat = (sum / 16.0) / 1000.0 * DIVIDER;   // pil gerilimi / battery voltage
18  int pct = (int)((vBat - V_EMPTY) / (V_FULL - V_EMPTY) * 100.0);
19  pct = constrain(pct, 0, 100);
20  Serial.printf("Pil / Battery: %.2f V  %%%d\n", vBat, pct);
21  delay(2000);
22}
MicroPython
1from machine import ADC
2import time
3
4adc = ADC(26)        # GP26 = ADC0, bölücü orta noktası / divider midpoint
5DIVIDER = 2.0        # 100k + 100k bölücü / 100k + 100k divider
6V_EMPTY = 3.2        # boş hücre / empty cell
7V_FULL = 4.2         # dolu hücre / full cell
8
9while True:
10    total = 0
11    for _ in range(16):                  # 16 ölçümün ortalaması / average of 16 samples
12        total += adc.read_u16()
13        time.sleep_ms(2)
14    v_bat = total / 16 * 3.3 / 65535 * DIVIDER   # pil gerilimi / battery voltage
15    pct = (v_bat - V_EMPTY) / (V_FULL - V_EMPTY) * 100
16    pct = max(0, min(100, pct))          # 0-100 aralığında tut / keep within 0-100
17    print("Pil / Battery: {:.2f} V  %{:.0f}".format(v_bat, pct))
18    time.sleep(2)

Battery-powered project ideas

  • Robot car: power both the Arduino and the motor driver from a 2S 18650 pack; details are in the building a robot car post.
  • Battery tester: build a measuring device with a voltage divider and an LCD that shows how full batteries are; the Arduino voltmeter post is a good starting point.
  • Long-life sensor station: an ESP32 running from a single 18650 can take a measurement, go into deep sleep and keep sending data for weeks.
  • Rechargeable torch or night light: build a portable lamp that charges over USB with a 1S 18650, a TP4056 charging module and a few LEDs.
  • Portable Pico game console: a Pico powered from VSYS by 3 × AA becomes a pocket game with a small display and a few buttons.
  • Low battery alarm: a small warning circuit that sounds a buzzer when the pack voltage drops below a threshold is the cheapest way to protect your rechargeable batteries from over-discharge.

Common mistakes and how to fix them

SymptomLikely causeFix
Arduino keeps resettingA 9 V battery can't supply the motor or servo currentConnect the motors to a separate pack, use a 2S 18650 or 6 × AA, join the GNDs
The pack gives half the expected voltageThe holder is wired in parallel or a battery is inserted backwardsCheck the direction of each battery, measure the output with a multimeter
One of the batteries heats up or leaksOld and new or different types of batteries were mixedReplace all the batteries in the pack with new ones of the same type
The Uno's regulator gets very hotMore than 12 V is applied to VIN (e.g. two 9 V in series = 18 V)Stay in the 7–12 V range or use an external buck converter
ESP32 shuts down while connecting to Wi-FiWeak battery or thin wire; the voltage collapses at the 250 mA peakUse thick wire and a full cell, add a 470 µF capacitor on the 3V3 line
Battery reading fluctuatesHigh-resistance divider and electrical noiseTake an average, put a 100 nF capacitor between the ADC pin and GND
Battery heats up with USB plugged into the PicoNo protection between the battery and VSYS; USB voltage pushes current into the batteryAdd a Schottky diode between the battery and VSYS
Every time, before connecting a battery pack to the circuit, measure the voltage and polarity with a multimeter. This five-second check catches a reversed pack that would fry your board or a wrongly wired holder that gives half voltage. You'll find step-by-step DC voltage measurement in the how to use a multimeter post.

In short: if you need voltage, connect batteries in series; if you need run time and current, connect them in parallel; if you need both, build series-parallel packs like 2S2P, and always use batteries of the same type and age. A 2S 18650 for Arduino, and a single 18650 or 3 × AA for ESP32 and Pico, is the most balanced choice for most projects. For more detail on ways to power your board, take a look at the Arduino power supply post. In the BlueGrays app you'll find many projects, from LED circuits to robot cars and battery-saving ESP32 projects, with step-by-step circuit diagrams and code, so you can try your new battery pack in a project right away.

Frequently asked questions

What happens when you connect batteries in series?

In a series connection the battery voltages add up while the capacity stays the same as a single battery's. For example, connecting four 1.5 V 2500 mAh AA batteries in series gives you a 6 V, 2500 mAh pack. Because every battery carries the same current, the batteries must be the same type and charge level.

Does the voltage increase if batteries are connected in parallel?

No, in a parallel connection the voltage stays the same as a single battery's. What increases is the capacity and the current you can draw; two 3.7 V 3000 mAh 18650s in parallel make 3.7 V and 6000 mAh. You need to equalise the voltages of Li-ion cells before connecting them in parallel.

How long does an Arduino run on a 9 V battery?

A standard alkaline 9 V battery has about 500 mAh and can run an Arduino Uno drawing 45–50 mA on its own for 6–8 hours at most. As you add sensors, LEDs or motors, that drops to a few hours. For long-running projects, a 2S 18650 or 6 × AA pack gives much better results.

Can old and new batteries be used together?

They shouldn't be. In a series connection the weak old battery runs out first and is charged in reverse by the others, which causes heating and leakage. Always replace all the batteries in the pack together, with new ones of the same brand and type.

Can I power an Arduino with 4 AA batteries?

Four alkaline AA batteries give 6.4 V when fresh, which is too much for the 5V pin and too little for the VIN input, so it's not the right choice. Four rechargeable NiMH batteries give 4.8 V, so they can be connected to the 5V pin. If you want to use VIN or the DC jack, choose 6 × AA (9 V) or a 2S 18650 (7.4 V).

How do you charge 18650 batteries connected in series?

A 2S pack made of two series 18650s is charged with an 8.4 V 2S charger and a BMS protection board that balances the cells. Single-cell modules like the TP4056 only charge up to 4.2 V, so they're not suitable for a 2S pack. Alternatively, you can take the cells out of the holder and charge them one by one.

See all projects
LED Blink
AR-1Beginner

LED Blink

The very first hello of electronics: switching a single LED on and off. The Arduino turns the LED on and off at short intervals, so the light blinks quickly.

4.6(200)
1246
Traffic Light
AR-3Beginner

Traffic Light

A tiny copy of the traffic light you see on the road every day. Red stays on for two seconds, yellow flashes for a moment, green stays on for two seconds, then it goes back to red through yellow…

4.8(137)
440
LED Blink with ESP32
ES-1Beginner

LED Blink with ESP32

Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

4.7(37)
108
Raspberry Pi Pico Onboard LED Blink (Pico and Pico W)
PI-1Beginner

Raspberry Pi Pico Onboard LED Blink (Pico and Pico W)

The opening project of the Raspberry Pi Pico series! We blink the Pico's green built-in LED to confirm the board works, the classic "Hello World" first experiment. No external parts needed, just the Pico and a USB cable. The code is written in MicroPython, the language officially supported by the Raspberry Pi Foundation.

5.0(1)
10
Digital Voltmeter with LCD Display
AR-56Intermediate
Premium

Digital Voltmeter with LCD Display

Find out how much voltage a battery or power adapter gives with a meter you built yourself.

4.5(27)
36
Bluetooth Controlled Car with L298N
AR-80Advanced
Premium

Bluetooth Controlled Car with L298N

Turn your phone into a remote and drive your own robot car. The Arduino receives commands from a remote-control app on your phone through a Bluetooth module and spins the wheels with a motor driver…

5.0(39)
66
Obstacle Avoidance Robot
AR-81Advanced
Premium

Obstacle Avoidance Robot

How about building a smart vehicle that finds its own way? The Obstacle Avoidance Robot constantly scans its surroundings thanks to the ultrasonic sensor in front of it.

5.0(38)
49
ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)
ES-33Advanced
Premium

ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)

The ESP32's Deep Sleep mode shuts down the CPU and most peripherals, cutting current draw to about 10µA, which is vital for battery-powered IoT devices. This project uses three wake-up sources: a timer (15 s), an external pin (EXT0, the button on GPIO 33) and a touch pin (T0/GPIO 4). Counters marked with RTC_DATA_ATTR survive deep sleep.

4.3(10)
16