Hello everyone,
I am an engineer working on a tracking system for a smart battery, used in Light Electric Vehicles.
We are using this equipment:
- Neo 6m GPS
- JBD smart BMS 10s
- both Arduino Mega 2560 pro mini and Arduino Nano
I used this library for BMS; regarding GPS, I can use both TinyGPS++ and NeoGPS
This is the test code I adopted
#include <TinyGPS++.h>
#include "JbdBms.hpp"
JbdBms myBms(17, 16 ); // RX, TX
TinyGPSPlus gps;
void setup()
{
Serial.begin(9600);
Serial.println("JBD bms driver");
Serial1.begin(9600);
myBms.begin();
}
void loop()
{
//myBms.available();
if (myBms.readBmsData1() == true)
{
Serial.print("This capacity: "); Serial.println(myBms.getChargePercentage()/100);
Serial.print("This current: "); Serial.println(myBms.getCurrent());
Serial.print("Protection state: "); Serial.println(myBms.getProtectionState());
Serial.print("Voltage: "); Serial.println(myBms.getVoltage()/100);
Serial.print("Cycle: "); Serial.println(myBms.getCycle());
Serial.print("Temp1: "); Serial.println(myBms.getTempa()/10);
Serial.print("Temp2: "); Serial.println(myBms.getTempb()/10);
Serial.println();
} else {
Serial.println("Communication error");
}
delay(1000);
if (myBms.readBmsData2() == true)
{
Serial.print("Cell: "); Serial.println(myBms.getCell1()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell2()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell3()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell4()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell5()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell6()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell7()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell8()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell9()/1000);
Serial.print("Cell: "); Serial.println(myBms.getCell10()/1000);
Serial.println();
} else {
Serial.println("Communication error");
}
delay(1000);
if (myBms.readBmsData3() == true)
{
Serial.print(myBms.getcar1());
Serial.print(myBms.getcar2());
Serial.print(myBms.getcar3());
Serial.print(myBms.getcar4());
Serial.print(myBms.getcar5());
Serial.print(myBms.getcar6());
Serial.print(myBms.getcar7());
Serial.print(myBms.getcar8());
Serial.print(myBms.getcar9());
Serial.print(myBms.getcar10());
Serial.print(myBms.getcar11());
Serial.print(myBms.getcar12());
Serial.print(myBms.getcar13());
Serial.println();
} else {
Serial.println("Communication error");
}
delay(1000);
Serial1.available();
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
Serial.println();
}
delay(1000);
}
In this code the part about GPS is substituted with Serial1 direct read, in order to see what Arduino could read. The serial monitor shows me that it reads only 1 character each cycle; the problem is that I cannot obtain information from GPS when I include the part about BMS
Does anyone know why this happens?
If you need more information I will be happy to share with you
Thank in advance for all the answers!