Want to access all that juicy battery data from your BMS without having to use computer software to read the info? Want to display all that data on an Arduino driven LCD or OLED? You have come to the right place.
This is an Arduino library that communicates data from Generic Chinese BMSs. Might work with:
Aka, if your board looks like this:
It is probably going to work. Mine was a 21s so it had two of the 16 pin JST connectors at the base. All cell counts should work. You can always check if the UART protocol matches the protocol linked at the bottom of the page.
Just copy the example code!
#define BMS_RX_PIN 2 //pin the bms is reciving signals on, where we are sending.
#define BMS_TX_PIN 3 //pin the BMS is sending signals to, where we are recieving.
#define NUM_CELLS 21
#define NUM_TEMP_PROBES 4
#include <SoftwareSerial.h>
#include <BMS.h>
SoftwareSerial BMSSerial(BMS_TX_PIN, BMS_RX_PIN);
BMS bms;
void setup() {
Serial.begin(115200);
BMSSerial.begin(9600);
bms.begin(&BMSSerial);
Serial.println("Finished setup");
}
float *getCells() { return cells; }
uint32_t getBalanceState() { return balanceState; }
float getPackVoltage() { return packVoltage; }
float getPackCurrent() { return packCurrent; }
float getCellMaxVoltage() { return cellMax; }
float getCellMinVoltage() { return cellMin; }
float getCellDiff() { return cellDiff; }
byte getNumProbes() { return NUM_TEMP_PROBES; }
float *getProbeData() { return probes; }
MOSFET_STATUS getMOSFETStatus() { return MOSFETStatus; }
Note about using the MOSFETStatus struct: just do "bms.getMOSFETStatus().discharge" to get whether discharge is permitted and "bms.getMOSFETStatus().charge" to get whether charger is permitted.
Sources and Helpful Links