Hi
I am trying to use the bms library of furtrader (
https://github.com/FurTrader/Overkill-Solar-BMS_2-Arduino-Library) but get a problem. When I run one of the examples for instance to get the pack voltage it is not consequent. It alternates between zero volt as packvoltage then one or two times the real packvoltage of 13.34 volt then some times zero and so on. I cannot see why this happens. When I call the debug() routine it gives the same behavior. It alternates between giving the right data like Voltage, current and temp and just zero's.
I use a 150 A jdb-bms with a nodemcu esp8266. Can this be caused by the nodemcu instead of an Arduino mega?. Anny suggestions how to solve this?
Maybe a link to a ino that does work on an esp8266.?
This is my code:
#include "bms2.h"
#include <SoftwareSerial.h>
SoftwareSerial MySoftSerial(2, 4); // RX (d2 wit), TX (d4 -geel), gnd op gnd//Serial voor de BMS
#define Serial2 MySoftSerial
OverkillSolarBms2 bms = OverkillSolarBms2();
//global variables
uint32_t last_update;
float celvoltage=0;
uint32_t timestamp_1000ms = 0;
void setup() {
Serial.begin(115200);
Serial2.begin(9600);
bms.begin(&Serial2);
while (!Serial) { // Wait for the debug serial port to initialize
}
while (!Serial2) { // Wait for the BMS serial port to initialize
}
while(1) {
bms.main_task(true);
if (millis() >= 1000) {
break;
}
delay(10);
}
}
void loop() {
// bms.main_task(true);
bms.query_0x03_basic_info();
float voltage= bms.get_voltage();
delay(100);
Serial.print("voltage pack :");
Serial.println(voltage);
// delay(100);
bms.query_0x04_cell_voltages();
delay(600);
for (int i = 0; i <= 3; i++) {
float cellvoltage=(bms.get_cell_voltage(i) *1000);
if (cellvoltage > 0){
Serial.print(i);
Serial.print(" :");
Serial.print((bms.get_cell_voltage(i) *1000), 0);
Serial.println(" :");
cellvoltage=0;
} else {
Serial.println(" * ");
}
}
delay(100);
// bms.debug();
}
This is the output for Voltage Pack and Cell voltage:
voltage pack :13.33
*
*
*
*
voltage pack :0.00
*
*
*
*
voltage pack :13.33
0 :3335 :
1 :3333 :
2 :3333 :
3 :3334 :
voltage pack :13.33
*
*
*
*
voltage pack :0.00
*
etc.etc.