This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

bq34z100-G1 i2c commands python smbus

Other Parts Discussed in Thread: BQ34Z100-G1

I'm trying to read the voltage registers of the bq34z100-G1 but i am confused about the command sequence.

I am using SMBus in Python. It should be simple but there is something "simple" I don't undersatnd

so far i2cdetect shows the chip.I have as a code the following guess

import smbus

b=smbus.SMBus(1)

# Command format i think is;  write_byte_data(Device address,Register,Command)

DEVADR=0x55

write_byte_data(DEVADR,0xAA,0x08)     # This fails with io error and still need to write the next byte command

# Could try a block write - what should it be

# Need to write second byte how is this done?

b.read_i2c_Block_data(DEVADR,0xAB,32)

#this produces value but not sure what

Can someone suggest what it might be?

  • The Voltage parameter is a standard I2C command, so you just read 2 bytes from 08. The bytes will be in hex and reversed. 24FC = 9468mV.

  • Thank for your reply.

    Okay that is simple I can try that when i get home but I am still confused.

    What about the other battery voltages? How do you read them. does sequential reads autoincrement the register?
    Why is there detail in the bq34z100-G1 spec sheet that say you need to do a write first?

    If I wish to get say, battery levels, then I need to issue a different command but my write command gives errors.

    I should be just two lines of code. Can I get an SMBus example please.

  • The I2C interface does offer auto-increment. I am not sure which other voltages you are referring to. The gauge does not monitor the internal cell voltages in the stack.
  • I had a mis communication with our engineer. There is a bank of cells being monitored by another serial device, and as you say there is only one battery to be queried.

    Nevertheless it would be really good to get  a SMBus command example that accesses one of the features by sending a two byte command and then reading to get the reply. We are using Python on a Raspberry Pi because we need to drive other robotic functions based on  on the results form the chip.

    Google reveals other people trying to come to grips with the commands although mostly using C.

  • Here are some examples of communicating with the bq34z100-G1 to read parameters.

    bq34z100-G1 DF access.pdf