Skip to content

Multiple batteries #15

Answered by rlogiacco
rlogiacco asked this question in Q&A
Discussion options

You must be logged in to vote

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:

// 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, &…

Replies: 2 comments

Comment options

rlogiacco
Nov 16, 2018
Maintainer Author

You must be logged in to vote
0 replies
Comment options

rlogiacco
Nov 16, 2018
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by rlogiacco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #15 on December 17, 2020 13:31.