So, I built this simple circuit for measuring voltage from a battery pack to an Arduino.
The thing is, I want to measure the first cell and then the voltage from the whole battery pack: using two transistors for changing the voltage divider input (check the image so that you know what I mean.)
I do not want to apply a constant load to the battery, that's why I'm using transistors to turn on and off the voltage divider circuit.
Here's the circuit:
I'm using a simple calculation when reading from pin A0: 0-1023 (analog range) reading to 0-25 volts (as the voltage divider is at a 5:1 ratio.)
My question isn't about the code. Here's the situation:
When both transistors are off, I get a 0 Volts reading (as it should).
When the first transistor is on, and the second is off, I get a ~4.2v reading (as it should.)
The problem is when the second transistor is on (and the first is off). I get the SAME reading (~4.2v) instead of 8.4v (the whole battery pack voltage.)
Adding diodes between each collector and the voltage divider for protection didn't alter my results.
I'm really confused about this.
UPDATE Note: Each battery cell is rated at 4.2v.