I am trying to use two voltage sensors connected to an Arduino Uno to measure the individual voltages of two battery cells connected in series.

When I connect a sensor with only one cell, it gives the individual voltage correctly. But when I connect both sensors to their individual cells, I get 0 V reading from one sensor and the combined series voltage of the two cells on the other. I have tried swapping the voltage sensors and batteries but the same thing happens.

Is there a way to measure the individual cell voltages without getting the series voltage? Diagram : Circuit diagram

Here is the code that I am using:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

const int voltageSensor1Pin = A3;          // sensor pin
float vIn1;                                // measured voltage (3.3V = max. 16.5V, 5V = max 25V)
float vOut1;
float voltageSensor1Val;                   // value on pin A3 (0 - 1023)
const int voltageSensor2Pin = A2;          // sensor pin
float vIn2;                                // measured voltage (3.3V = max. 16.5V, 5V = max 25V)
float vOut2;
float voltageSensor2Val;                
const float factor = 5.128;               // reduction factor of the Voltage Sensor shield
const float vCC = 5.00;                   // Arduino input voltage (measurable by voltmeter)

void setup() {
  pinMode(8, OUTPUT);    // sets the digital pin 13 as output
  pinMode(12, OUTPUT);
  lcd.print("Voltage Measurement");
  lcd.print("CELL1: ");
  lcd.print("CELL2: ");


void loop() {
  voltageSensor1Val = analogRead(voltageSensor1Pin);    // read the current sensor value (0 - 1023) 
  vOut1 = (voltageSensor1Val / 1024) * vCC;             // convert the value to the real voltage on the analog pin
  vIn1 =  vOut1 * factor;                               // convert the voltage on the source by multiplying with the factor

  voltageSensor2Val = analogRead(voltageSensor2Pin);    // read the current sensor value (0 - 1023) 
  vOut2 = (voltageSensor2Val / 1024) * vCC;             // convert the value to the real voltage on the analog pin
  vIn2 =  vOut2 * factor;          
  Serial.print("Cell 1 Voltage = ");             


  Serial.print("Cell 2 Voltage = ");             


  • \$\begingroup\$ do you get a similar voltage reading from each battery when it is separated? it seems one battery has a much lager impedance than the other, what is the input impedance of your voltage sensor? \$\endgroup\$
    – Juan
    Nov 1, 2022 at 6:28
  • \$\begingroup\$ @Juan when i measure each cell voltage separately (using a just one voltage sensor) i get the correct readings (around 3.7 V) but when I measure two cells using two sensors, the reading from one sensor is normal, but the other sensor shows the combined voltage of the two cells. This is the problem, i want two cell readings individually but am getting the combined value at one of the sensors. \$\endgroup\$
    – Yasar498
    Nov 1, 2022 at 6:35
  • 1
    \$\begingroup\$ We have no clue what those sensors are and how they work. If they are simple resistor dividers, connecting them incorrectly to the Arduino will short one of the batteries. Please link to sensor schematics and draw how you have connected the sensors to your board. \$\endgroup\$
    – Justme
    Nov 1, 2022 at 6:39
  • \$\begingroup\$ @Justme here is the link to the sensor schamtics: components101.com/sensors/voltage-sensor-module I have already shown in the diagram how i have connected the sensors to the circuit. \$\endgroup\$
    – Yasar498
    Nov 1, 2022 at 8:00
  • 1
    \$\begingroup\$ @Yasar498 is the voltage source the same for both sensors? you might be shorting one of the batteries through ground on that, if you have a hand tester disconnect the batteries, turn off the power supply for both sensors and test for continuity on both ground terminals on the sensors. \$\endgroup\$
    – Juan
    Nov 1, 2022 at 8:03

2 Answers 2


It is possible to measure individual battery cells. According to the circuit diagram, the GND signal of the upper module should not be connected to the Aurdino. enter image description here

First, measure the voltage of the lower battery cell based on 720mV (720mV > 3.6V). The value calculated in this way (3.6V) must be subtracted from the second measured value (4.34-3.6= 740mV). Calculate the voltage of the second battery cell based on 740mV (740mV > 3.7V).

  • \$\begingroup\$ This only works in a narrow range of battery voltages. Consider if V1/V2 is open or short circuit what the outputs would be. \$\endgroup\$ Nov 1, 2022 at 15:20
  • \$\begingroup\$ Yes that is right. It is functional as long as S2 is less than 5V. \$\endgroup\$
    – csabahu
    Nov 1, 2022 at 15:30

Use the negative side as your reference for both sensors. Then measure the first battery, that will give you battery 1 voltage. Then the second, that will give you B1 + B2. Subtract the B1 from Bw to get the voltage of the actual voltage of B2.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.