esp32 thing plus c - max17048 fuel gauge - occasionally reads 256%

Hi All,

I’m using the SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library with a esp32 thing plus c and I’m seeing some strange behaviour.

If I have another i2c device connected to the qwiic connector the reported battery percentage is consistently correct. However if I disconnect the i2c device the fuel gauge occasionally reports a value of 256%.

Has anyone else experienced this?

The i2c device I have connected in this case happens to be a piicodev motion sensor.

Regards,

Brian

Hi Brian,

You’re not the first person to notice this: https://github.com/sparkfun/SparkFun_MA … y/issues/3

At the moment we don’t understand why this happens, but we suspect it is an I2C bus error - not the MAX17048 returning ‘bad’ data. Thank you for letting us know that the errors go away when you have another device connected. That’s really useful to know and makes me think that I2C pull-ups may be responsible. Do you have the pull-up resistors connected / enabled on both the fuel gauge and your motion sensor? And which fuel gauge board are you using: our SparkX (Black) Qwiic Fuel Gauge, or the SparkFun (Red) LiPo Fuel Gauge?

Best wishes,

Paul

Hi PaulZC,

I am using the on board max17048 included on the ESP32 Thing Plus C board (spark x product) not a external fuel guage board.

I haven’t added any pull up resistors myself or specifically enabled anything on the motion sensor board.

I have connected it directly to the qwiic connector with no modifications.

Maybe this will help…

https://core-electronics.com.au/piicode … -6050.html

Cheers,

Brian

Hi Brian,

That’s helpful - thanks!

The PiicoDev board uses 4K7 pull-up resistors. The Thing Plus C does not have separate pull-up resistors, instead it uses the pull-ups internal to the ESP32 processor. My theory is:

  • the internal pull-ups in the ESP32 are approx. 45 kOhms and might be too high - on their own - for the MAX17048 and so introduce occasional I2C bus errors

  • when you add the PiicoDev board, the additional resistors improve the signal edges and the errors go away.

Thanks again for pointing this out. I will pass this along to the team.

Very best wishes,

Paul

No problem, i’m glad it was helpful