# How to use SMBus (I2C peripheral)

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](http://smartbattery.org/specs/sbdat110.pdf). These are the supported messages:

Table 1.       SMBus variable list

<table data-header-hidden><thead><tr><th width="249"></th><th width="71"></th><th width="104"></th><th width="240"></th><th></th></tr></thead><tbody><tr><td>Parameter</td><td>Unit</td><td>Datatype</td><td>Description</td><td>I2C Address</td></tr><tr><td>temperature</td><td>K</td><td>uint16_t</td><td><p>The temperature of the external battery</p><p>temperature sensor, 0 otherwise.</p></td><td>0x08</td></tr><tr><td>voltage</td><td>mV</td><td>uint16_t</td><td>The voltage of the battery.</td><td>0x09</td></tr><tr><td>current</td><td>mA</td><td>uint16_t</td><td>The last recorded current of the battery.</td><td>0x0A</td></tr><tr><td>average_current</td><td>mA</td><td>uint16_t</td><td><p>The average current since the last</p><p>measurement (period t-meas (default 1s)).</p></td><td>0x0B</td></tr><tr><td>max_error</td><td>%</td><td>uint16_t</td><td>Just set to 5%. Not tracked.</td><td>0x0C</td></tr><tr><td>relative_state_of_charge</td><td>%</td><td>uint16_t</td><td>Set to the state of charge value.</td><td>0x0D</td></tr><tr><td>absolute_state_of_charge</td><td>%</td><td>uint16_t</td><td>Set to the state of charge value.</td><td>0x0E</td></tr><tr><td>remaining_capacity</td><td>mAh</td><td>uint16_t</td><td>The remaining capacity of the battery.</td><td>0x0F</td></tr><tr><td>full_charge_capacity</td><td>mAh</td><td>uint16_t</td><td>The full charge capacity of the battery.</td><td>0x10</td></tr><tr><td>run_time_to_empty</td><td>min</td><td>uint16_t</td><td><p>Calculated time to empty based on</p><p>current and remaining_capacity.</p></td><td>0x11</td></tr><tr><td>average_time_to_empty</td><td>min</td><td>uint16_t</td><td><p>Calculated the time to empty based on</p><p>average_current and remaining_capacity.</p></td><td>0x12</td></tr><tr><td>cycle_count</td><td>cycle</td><td>uint16_t</td><td>Set to the n-charges value.</td><td>0x17</td></tr><tr><td>design_capacity</td><td>mAh</td><td>uint16_t</td><td>Set to the factory capacity.</td><td>0x18</td></tr><tr><td>design_voltage</td><td>mV</td><td>uint16_t</td><td>Set to the cell overvoltage value.</td><td>0x19</td></tr><tr><td>manufacture_date</td><td>-</td><td>uint16_t</td><td><p>Set to the defines in the code. Not actual</p><p>manufacturer dates.</p><p>(year-1980)*512 + month*32 + day</p></td><td>0x1B</td></tr><tr><td>serial_number</td><td>-</td><td>uint16_t</td><td>Set to the battery id (batt-id).</td><td>0x1C</td></tr><tr><td>manufacturer_name</td><td>-</td><td>char *</td><td>Set to “NXP”.</td><td>0x20</td></tr><tr><td>device_name</td><td>-</td><td>char *</td><td>Set to "RDDRONE-BMS772"</td><td>0x21</td></tr><tr><td>device_chemistry</td><td>-</td><td>char *</td><td><p>This is a 3 letter battery device chemistry</p><p>"LiP", "LFP" or "LFY" (LiPo, LiFePo4,</p><p>LiFeYPo4).</p></td><td>0x22</td></tr><tr><td>manufacturer_data</td><td>-</td><td>uint8_t *</td><td>Set to 0x0. (length 1).</td><td>0x23</td></tr><tr><td>cell1_voltage</td><td>mV</td><td>uint16_t</td><td>Cell voltage of cell1.</td><td>0x3A</td></tr><tr><td>cell2_voltage</td><td>mV</td><td>uint16_t</td><td>Cell voltage of cell2.</td><td>0x3B</td></tr><tr><td>cell3_voltage</td><td>mV</td><td>uint16_t</td><td>Cell voltage of cell3.</td><td>0x3C</td></tr><tr><td>cell4_voltage</td><td>mV</td><td>uint16_t</td><td>Cell voltage of cell4.</td><td>0x3D</td></tr><tr><td>cell5_voltage</td><td>mV</td><td>uint16_t</td><td>Cell voltage of cell5.</td><td>0x3E</td></tr><tr><td>cell6_voltage</td><td>mV</td><td>uint16_t</td><td>Cell voltage of cell6.</td><td>0x3F</td></tr></tbody></table>

&#x20;
