Using I2C for SMBus device communications


You may want to look in these threads

[SOLVED] I2C requestFrom() - how to read > 32 bytes?
I2C - Increasing buffer size to 258 compilation error


Thanks! Not sure why I didn’t search this forum first and assumed I was the first to have this problem :confused:


Hello can some body tell is it possible to reset bq20z45 using arudino.i want to clear the Flags,mosfet status,capacity,current,cycle count,…
here i found software which does it but in my country related hardware is not available.
any help is appreciated


It’s possible but you need the register map and maybe SMBus formatting to get it to work.

To make life easier just source the TI EV2300 or EV2400 adapter somehow.


thank you for replay but i know only soldering no programming .also sourcing TI EV2300 or EV2400 to bhutan will cost around $350 which is way expensive to me afford…

can you guide any way to do…this will help alot…
thank you…!


You would need the Datasheet for the TI chip your trying to read and then create some code to read and write those registers you need to change using a Microcontroller of your choice.


hey i got datasheet with registers can you create an example code how to read and write those registers…?


I do not have time to help you with this.

You’re going to have to learn this yourself or search the web for Arduino code that is already written for this line of BQ devices. Search for the BQ40z50 and see if anything comes up, its a popular chip.


Hello RWB!!!

Great fault finding so far :slight_smile:
I am working on the same project.But i need to pass battery voltage and current data from BMU to my arduino.My bmu has the BQ40z50. Im little bit lost… Can you repost your working code or give some basic example as reference point?

Thank you


There will be plenty of examples out there like this but also others for other processors. You should also be able to get some ideas by looking at Particles code for their PMIC, or samples for other TI devices, many of them are similar.

For non-arduino style systems they won’t have the convenience of the Wire library so will implement I2C at quite a low level, the Wire library hides a lot of complexity.
If you find a full library it will include methods for every feature on the device, however (presumably) you only want a few select figures and you can get those with a few select commands.

I would recommend reading how to use and experiment with reading some of the values off the chip. Once you can do that the only thing left is probably some maths to turn the values into numbers you can read.
Lastly I can also tell you that Linear BMU/PMICs typically have what they call “Linduino” libraries for their products in with their documentation, they need a little tweaking to work on a photon as they re-implement some I2C stuff for no apparent reason .


Could you access to the bq with a valid response? if so, is the source code accessible?