Charger & Gauge How To - Geowissenschaften/EXCISS GitHub Wiki
Charger documentation: http://www.ti.com/lit/ds/symlink/bq25700a.pdf
Example code to read a value from the charger:
Wire.beginTransmission(0x09); // charger adress in 7bit
Wire.write(0x14); // command to read/write charg current
error = Wire.endTransmission(true);
Wire.requestFrom(0x09, 2); // read 2 bytes. Note: the return values byte order is little endian
while(Wire.available())
{
char c = Wire.read();
Serial.print(" ");
Serial.print(c,HEX);
}
Example code to write a 2 byte value (important! low byte first):
Wire.beginTransmission(0x09); // charger adress in 7bit
Wire.write(0x14); // command to read/write charg current
// example gauge write charge current to 320mAh
Wire.write(0x00); // 0x40 Lower byte
Wire.write(0x00); // 0x01 Higher byte
error = Wire.endTransmission(true);
Serial.println("get chemID error:");
Serial.println(error);
Gauge documentation: http://www.ti.com/lit/ug/sluubc1d/sluubc1d.pdf
Example code to read a 20 byte long string:
Wire.beginTransmission(0x0B); // gauge adress in 7bit
Wire.write(0x22); // command to read the device chemistry as a string
error = Wire.endTransmission(true);
Serial.println("get chemID error:");
Serial.println(error);
Wire.requestFrom(0x0B, 5); // read 5 bytes. The first byte returns the string length
char c = Wire.read();
Serial.print(c,HEX); // string length in byte
while(Wire.available())
{
c = Wire.read();
Serial.print(c);
}
Gauge exciss settings
BatteryMode (0x03) set to 0x6081