Adding Rechargeable Battery


This posting is about implementing a rechargeable battery system for the BeagleBone Enhanced. It is simple, safe and very low cost

The power circuitry on the BBE.

The BBE has a built-in power management IC (PMIC) based on the TI TPS65217C device. This device contains multiple switch-mode regulators and LDO regulators to provide all voltage levels needed for the entire board.

The PMIC handles power down and wake-up using the POWER button fitted on the BBE next to the RJ45 connector.

Automatic power-down via the button requires some software to be implemented (to do the equivalent of ‘shutdown now’ from the command line). When the button is pressed, an interrupt is generated and the microprocessor is supposed to query the PMIC (via I2C) to learn that the button was pressed, and kick off the shutdown sequence. In the event of a failure here, the power can be switched off by holding the button down for 8 seconds.

The PMIC also contains built-in battery charging capability, which is what is utilised here to charge a battery.

What type of battery can be used?

Any small Lithium Ion (Li-Ion) or Lithium Polymer (Li-Po) single cell can be used, it is advisable to use one with a built-in protection circuit. If it doesn’t have an in-built circuit, it is highly advisable that one with a built-in thermistor is used.

A cell in the range 700mAH to around 2AH is a good choice. An example cell is one from Olimex part code BATTERY-LIPO1400mAh. It should last around 2 hours on a full charge and should fully charge in around 2 hours.

The Olimex battery is just the right size to fit in between the two rows of headers and is flush so that a cape can still be plugged on top.

The BBE has five test pads on the bottom of the board that are suitable for connecting up the battery.

VBAT   SENSE
+5V    TS
GND

The Olimex Li-Po has a built-in protection circuit, so you can solder a 10k resistor to TS and GND to simulate the thermistor. (You may or may not wish to do this, please study Li-Po and use your own judgement

It is desirable to use a connector for the Li-Po and this can be secured to the bottom of the board with some hot-melt glue or positioned somewhere convenient for your assembly.

The LiPo connector needs to be soldered to pins VBAT and GND via wire, and then  a zero-ohm link between VBAT and SENSE on the underside.

Here is how it was done step-by-step (there are just two steps):

1. Solder the 10k resistor, and a zero-ohm link as shown here in the yellow boxes. These are simple 0603 resistors; use a 1% tolerance resistor or 5% should be fine.

2. Mount the connector in a place of your choice

The connectors are available in straight and right angle connection

JST connector

JST right angle connector

Controlling the PMIC

The TPS65217C PMIC is very programmable; it has dozens of configuration settings specifically for charging and it has safety timer capability. The PMIC is configured upon startup via I2C.

The PMIC is on i2c channel 1 at an address of 24

tps@24 {
 reg = <0x24>;
 compatible = "ti,tps65217";
 ti,pmic-shutdown-controller;
 interrupt-parent = <0x1>;
 interrupts = <0x7>;
 linux,phandle = <0x95>;
 phandle = <0x95>;
 };
};

To control the charger there are system nodes available

debian@beaglebone:/sys/bus/i2c/devices/0-0024$ ls -l
total 0
lrwxrwxrwx 1 root root 0 May 25 13:17 driver -> ../../../../../../bus/i2c/drivers/tps65217
drwxr-xr-x 3 root root 0 Jan 1 2000 input
-r--r--r-- 1 root root 4096 May 25 20:01 modalias
-r--r--r-- 1 root root 4096 May 25 13:17 name
lrwxrwxrwx 1 root root 0 May 25 20:01 of_node -> ../../../../../../firmware/devicetree/base/ocp/i2c@44e0b000/tps@24
drwxr-xr-x 2 root root 0 May 25 13:24 power
drwxr-xr-x 9 root root 0 Jan 1 2000 regulator
lrwxrwxrwx 1 root root 0 Jan 1 2000 subsystem -> ../../../../../../bus/i2c
drwxr-xr-x 3 root root 0 Jan 1 2000 tps65217-bl
drwxr-xr-x 3 root root 0 Jan 1 2000 tps65217-charger
drwxr-xr-x 3 root root 0 Jan 1 2000 tps65217-pmic
-rw-r--r-- 1 root root 4096 Jan 1 2000 uevent
debian@beaglebone:/sys/bus/i2c/devices/0-0024$ cd tps65217-charger/
debian@beaglebone:/sys/bus/i2c/devices/0-0024/tps65217-charger$ ls -l
total 0
-rw-r--r-- 1 root root 4096 May 25 20:01 driver_override
-r--r--r-- 1 root root 4096 May 25 20:01 modalias
drwxr-xr-x 2 root root 0 May 25 13:24 power
lrwxrwxrwx 1 root root 0 Jan 1 2000 subsystem -> ../../../../../../../bus/platform
-rw-r--r-- 1 root root 4096 Jan 1 2000 uevent
debian@beaglebone:/sys/bus/i2c/devices/0-0024/tps65217-charger$ cd power/
debian@beaglebone:/sys/bus/i2c/devices/0-0024/tps65217-charger/power$ ls -l
total 0
-rw-r--r-- 1 root root 4096 May 25 20:02 async
-rw-r--r-- 1 root root 4096 May 25 20:02 autosuspend_delay_ms
-rw-r--r-- 1 root root 4096 May 25 20:02 control
-r--r--r-- 1 root root 4096 May 25 20:02 runtime_active_kids
-r--r--r-- 1 root root 4096 May 25 20:02 runtime_active_time
-r--r--r-- 1 root root 4096 May 25 20:02 runtime_enabled
-r--r--r-- 1 root root 4096 May 25 20:02 runtime_status
-r--r--r-- 1 root root 4096 May 25 20:02 runtime_suspended_time
-r--r--r-- 1 root root 4096 May 25 20:02 runtime_usage