-
On behalf of a user: I have a challenging circuit. From a battery point of view it looks like
And
Both batteries are The problem (or challenge) is caused by the fact that the minus of the top battery A is the same as the plus of the bottom battery B. To measure the voltage for the bottom battery is easy and straight forward ratio But what are the parameters to define the Top Battery ? You can not put a ground to the minus of the top battery. Because that would cause that both ends of the bottom battery are grounded. In that case I do not anything to measure the voltage. It will always be zero. Another setup I tried is
And
Now the ground is to the top battery. And I switched the resistors on the bottom battery. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
First of all, Arduino cannot read negative voltages, so your Arduino Second point, what you are trying to do is to measure the voltage of a 2S battery pack (2 in series) composed of Before going on, unless you have a particular need I can't see, if the two batteries in the pack are used evenly and the two cells have comparable age and manufacturing process, measuring the cells separately might be overkill... If possible, simply consider the two batteries as one |
Beta Was this translation helpful? Give feedback.
-
Starting with version // lead acid 12V batteries range between 16V and 11V
// battery A is top cell, battery B is bottom cell
Battery battA = Battery(11000, 16000, A0);
Battery battB = Battery(11000, 16000, A1);
uint8_t multiCell(uint16_t voltage, uint16_t minVoltage, uint16_t maxVoltage) {
return linear(voltage - battB.voltage(), minVoltage, maxVoltage);
}
#define RA1 47.0
#define RA2 6.8
#define RB1 25.0
#define RB2 10.0
void setup() {
Serial.setup(9600);
battA.begin(5000, (RA1 + RA2) / RA2, &multiCell);
battB.begin(5000, (RB1 + RB2) / RB2);
}
void loop() {
Serial.print("Battery pack voltage is ");
Serial.println(battA.voltage()); // battA voltage is the pack voltage
Serial.print("Battery A charge ");
Serial.print(battA.level());
Serial.print("% with voltage ");
Serial.println(battA.voltage() - battB.voltage()); // the voltage of battery A is the difference
Serial.print("Battery B charge ");
Serial.print(battB.level());
Serial.print("% with voltage ");
Serial.println(battB.voltage());
delay(1000);
} You can find a simulation of the circuit I'm figuring at this link. |
Beta Was this translation helpful? Give feedback.
Starting with version
1.1.1
you can also provide a mapping function of your choice: in your case the mapping function for battery A will have to take into account the voltage level measured on battery B, like: