How to use SMBus (I2C peripheral)
This page describes how to use the SMBus interface.
To enable the update, be sure to set smbus-enable to 1 with “bms set smbus-enable 1”. If this is enabled, one can use the BMS as an I2C peripheral device to get the information. Use the J18 connector (I2C/SMBUS) on the BMS, hook up your I2C initiator device with pull-ups to this connector. The SMBus information is based on the SBS1.1 specification. These are the supported messages:
Table 1. SMBus variable list
Parameter
Unit
Datatype
Description
I2C Address
temperature
K
uint16_t
The temperature of the external battery
temperature sensor, 0 otherwise.
0x08
voltage
mV
uint16_t
The voltage of the battery.
0x09
current
mA
uint16_t
The last recorded current of the battery.
0x0A
average_current
mA
uint16_t
The average current since the last
measurement (period t-meas (default 1s)).
0x0B
max_error
%
uint16_t
Just set to 5%. Not tracked.
0x0C
relative_state_of_charge
%
uint16_t
Set to the state of charge value.
0x0D
absolute_state_of_charge
%
uint16_t
Set to the state of charge value.
0x0E
remaining_capacity
mAh
uint16_t
The remaining capacity of the battery.
0x0F
full_charge_capacity
mAh
uint16_t
The full charge capacity of the battery.
0x10
run_time_to_empty
min
uint16_t
Calculated time to empty based on
current and remaining_capacity.
0x11
average_time_to_empty
min
uint16_t
Calculated the time to empty based on
average_current and remaining_capacity.
0x12
cycle_count
cycle
uint16_t
Set to the n-charges value.
0x17
design_capacity
mAh
uint16_t
Set to the factory capacity.
0x18
design_voltage
mV
uint16_t
Set to the cell overvoltage value.
0x19
manufacture_date
-
uint16_t
Set to the defines in the code. Not actual
manufacturer dates.
(year-1980)*512 + month*32 + day
0x1B
serial_number
-
uint16_t
Set to the battery id (batt-id).
0x1C
manufacturer_name
-
char *
Set to “NXP”.
0x20
device_name
-
char *
Set to "RDDRONE-BMS772"
0x21
device_chemistry
-
char *
This is a 3 letter battery device chemistry
"LiP", "LFP" or "LFY" (LiPo, LiFePo4,
LiFeYPo4).
0x22
manufacturer_data
-
uint8_t *
Set to 0x0. (length 1).
0x23
cell1_voltage
mV
uint16_t
Cell voltage of cell1.
0x3A
cell2_voltage
mV
uint16_t
Cell voltage of cell2.
0x3B
cell3_voltage
mV
uint16_t
Cell voltage of cell3.
0x3C
cell4_voltage
mV
uint16_t
Cell voltage of cell4.
0x3D
cell5_voltage
mV
uint16_t
Cell voltage of cell5.
0x3E
cell6_voltage
mV
uint16_t
Cell voltage of cell6.
0x3F
Last updated