I have connected the TI-make battery fuel gauge and charger to the I2C port of my raspberry Pi and eventually plan to control them using RPi. I have some minimally working code. However, I found a few drivers, one specifically for the BQ27441 battery fuel gauge that I use. The driver is here. I think the use of driver which provides an API should be preferred as it leads to consistency and avoids incorrect register manipulations.

But I wasn't able to use it. As in, even if I include it or try to modify it, it asks for the included header files, for which I don't know the exact paths.

Can somebody shed some light on how to use these drivers, or a minimal working example of the use of these drivers or any similar drivers that help explain the compile + run process for the same ?

  • Android may be based on Linux but even so I doubt the kernel drivers are compatible. Have you checked to see if there is a kernel driver for Linux?
    – joan
    Commented Nov 25, 2015 at 9:54
  • Then there is a more generic one here : git.ti.com/bms-linux/bms-kernel/blobs/master/drivers/power/… Commented Nov 25, 2015 at 18:33
  • Chintan, I wanted to know if you ever got the BQ27441 drivers to work. I am really lost as to how to get the Raspberry Pi and BQ27441 to work together. I have been able to use i2c-tools to connect with the fuel gauge but that is as far as I have gotten. I can read the registers but not set the device capacity. Sparkfun have made some very nice Arduino libraries but am unsure as to how to implement them on the raspberry pi. Would you be willing to share your knowledge and possibly code? Thank you
    – Jeff Chap
    Commented Aug 30, 2017 at 21:56
  • @JeffChap : I was never able to set the design capacity from outside. Since, I was only interested in voltage and current readings, I didn't fight a lot about that. I think, it can only be programmed through their hardware and not over I2C. Commented Aug 31, 2017 at 22:55

1 Answer 1


Linux 4.4 has an updated driver for the bq27xxx series of fuel gauge IC's. This driver is available in the rpi-4.4.y development branch at the Raspberry Pi Foundation's github which supports the bq27441.

  • And how would I use it ? Any code sample demonstrating its use would be great. Commented Dec 1, 2015 at 23:23
  • 1
    Compile the mentioned kernel with the bq27xxx module enabled as a module. Create a DTS file and compile it to a DTB file see here. I use this DTS for the bq27621: /dts-v1/; /plugin/; /{ compatible = "brcm,bcm2708"; fragment@0 { target = <&i2c1>; __overlay__{ bq27621-battery@55 { compatible = "ti,bq27621"; reg = <0x55>; status = "okay"; }; }; }; }; Add the proper dtoverlay line to your config.txt.
    – mozzwald
    Commented Dec 3, 2015 at 14:47
  • When the module is loaded, access it's parameters in sysfs (/sys/class/power_supply/bq27xxx). You have access to these from sysfs: capacity, capacity_level, charge_full, charge_full_design, charge_now, current_now, manufacturer, present, status, technology, temp, type, voltage_now
    – mozzwald
    Commented Dec 3, 2015 at 14:58
  • Thank you very much for the walk through. Seems like quite a bit of configuration, but the rewards seem worth it, so I will give it a shot, and let you know how it works out. Commented Dec 4, 2015 at 18:08
  • Seems like you have worked on TI gauges before, very quickly could you just give me a heads up if it possible to update the design capacity using code and not by bqStudio ? I had a longer question on e2e, but no replies ...e2e.ti.com/support/power_management/battery_management/f/180/t/… Commented Dec 4, 2015 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.