I'm building a laptop with a custom battery pack. I know that the pack has to communicate through an I2C/SM port on the motherboard, but I don't know how to make the bios/os recognize it. Is there a particular I2C address and standard protocol on top of I2C for battery state information exchange? If there is - where can I find the documentation for it? If no - is the protocol just proprietary to the bios manufacturer and then the OS reads it from the bios? I will be bitbanging I2C from the microcontroller that regulates the battery so I can do whatever is needed.
2 Answers
Since you already know about the SMBus, why not look into the Smart Battery Data Specification or the Smart Battery Charger Specification, as this is what you'll have to simulate. Yet, this won't describe if the System Management chip has some additional features which are undocumented ;-)

- 7,969
- 1
- 19
- 34
There is no real standard. [Edit: I'm wrong on that - see other answer]
However, most battery are manufactured in more or less the same way: They have some I2C EEPROM chip (often an industry-standard one) that contains all the static information about the battery (model, serial number, manufacturing date, capacity, etc...), and another chip named "battery gas gauge" or "battery fuel gauge" that monitors the actual charge level and all dynamic stuff.
TI has a whole range of battery gauge chips available: http://www.ti.com/lsds/ti/power-management/battery-fuel-gauge-overview.page. Chances are the battery of your laptop contains such a chip.
So, basically, only the laptop manufacturer knows exactly how to communicate with the battery, but everything is usually based on widely available, documented, chips (well, there might also be some additional MCU with proprietary firmware that take care of extra stuff, eventually). So if you must reverse-engineer a battery, you may have some chance to actually be successful. Here is a document that provides interesting information: Battery Firmware Hacking
Now, regarding the software part: indeed, the company that makes the BIOS, based on the information provided by the laptop/battery manufacturer, includes all relevant I2C messaging in the BIOS itself and the OS asks the BIOS when it needs to know.

- 15,845
- 3
- 39
- 84
-
Thanks, It looks like Ill have to do some reverse engineering on a laptop battery to figure out what packets it actually sends, but at least I can be fairly confident that it will work with any bios since the chips are standard – Oct 25 '16 at 14:24
-
Im not using a standard laptop battery that would already have those chips – Oct 25 '16 at 14:26
-
It seems I wasn't really right. Tom L found some real spec I wasn't aware of. You'd better accept his answer instead of mine, he deserves it better. – dim Oct 25 '16 at 14:30
-
yeah i was just skimming through the spec a little to make sure it actually had what I was looking for. – Oct 25 '16 at 14:33
-
Don't worry; in fact you're partially right. Many real-world packs come with the mentioned specification, BUT the specification also specified some "manufacturer" data block ... unless you specify it yourself this could be about everything - starting from a simple string to some encrypted data block. – Tom L. Oct 25 '16 at 17:01