Battery PCB Overview
This PCB accompanies the controller PCB as part of the haptic fabric project I worked on at 0102.io. It is a single cell lithium polymer (LiPo) protection PCB that can also display its state of charge with a button press.
This board uses the same protection circuit (a battery management IC and a pair of mosfets) as most off-the-shelf lipo packs (this one, for example).
I also added a microcontroller to let users check the battery pack state of charge with an on-board button (like a USB battery bank). The microcontroller monitors the cell’s charge using a fuel gauge IC. The fuel gauge is configured with I2C, and it has an alert pin that generates an interrupt for the microcontroller when the state of charge (SOC) changes.
The PCB also serves as the bottom face of the battery pack. This was a functional decision to make the pack thinner and remove some mechanical play from having a separate lid, and it looks nice too! The bottom face has the output terminals of the protection circuit, a UPDI contact for 1-wire firmware upload, a UART interface for debugging, and a status indicator pin for communication with the charger. The status indicator pin is pulled high when the battery charger is active, and the microcontroller enters a charging animation sequence with the LEDs.
Battery Pack Charger Overview
The battery charger can charge 2 packs simultaneously, so it has two of everything (except the USB port). While the charger IC is active, it pulls the status pin high (or low depending on the configuration), telling the battery pack to display its charging animation.
Charging
The maximum charge current is set using a resistor connected to the PROG pin on the battery charger IC. I set it so that the maximum charge current is 450mA, which is a safe rate for the 450-500mAh lipo cells we chose.
Communication with the Battery Pack
The battery charger IC has a status pin with this output table (Table 5-1 in the datasheet):
The chip’s STAT1 pin is connected to the STAT pogo pin through a logic inverter. When the battery is charging, the status pin is pulled low, so STAT is pulled high by the inverter. This lets the battery pack know that the charger is connected and charging. I’ve also configured this board to pull STAT low optionally if we change the battery pack accordingly, which would be better because then I don’t need the inverters on this board for the future.
Once the cell is fully charged, the status pin is pulled high (STAT is pulled low by the inverter), telling the pack that charging is done. At this point the chip’s STAT2 pin also turns on the charging-complete LED.
Firmware
The battery pack's firmware has a couple of straightforward jobs:
1. Determine the lipo cell's state of charge (SOC) from the fuel gauge IC. This is done once on a reset / power on, and then again for each 1% SOC change.
2. Tell the controller what the the current SOC when it connects, and again for each 1% SOC change as long as it is connected.
3. Display the SOC on the indicator LEDs when the button is pressed.
4. Display the charging status when the battery charger is connected.
This is summarized by this flow chart: