LiFePO4wered is a smart diet that will add to your Raspberry Pi a battery in case of power failure or to make the Raspberry autonomous Pi for mobile applications (project RC, robotics, timelaps…). The LiFePO4wered has its own API which allows to integrate energy management into any project. You can purchase the LiFePO4wered on Tindie for approximately €35 (transport, about € 4).
Presentation of LiFePO4wered
The LiFePO4wered is a power system for Raspberry Pi coming to replace the standard power supply. This new PSU just connect on GPIO Raspberry (first 4 columns). Announced autonomy is between 1 and 3 hours with a LiFePo4 battery of 550mAh. Everything will obviously depend on the use of the Raspberry and used connections (WiFI, Bluetooth, GPIO,…). With the LiFePO4wered in place, used my Raspberry Pi as a laptop. Its use is perfectly transparent, you can leave it plugged in all the time. When we unplug the RPI in the sector, it continues to be powered by the battery.
Here are the main technical specifications
- 3.2V LiFePO4 battery (Lithium iron Phosphate) 550mAh capacity. 2000 charging cycles.
- USB charger with overload protection to feed the Raspberry without interruption in case of disconnection or power failure: function UPS (Uninterruptible Power Supply).
- communication with the Raspberry Pi via the I2C bus. Allows to track the charge level and adjust the operating parameters. The module is capable of detecting a system shutdown.
- soft touch button by using the API. The touch button has a protection of accidental activation, so don’t stop the Raspberry by mistake.
- 2 Led indicators. The Green Led indicates the operating status of the Raspberry. It is also programmable. The Red Led located on the ground floor next to the micro-USB connector indicates the State of charge.
The LiFePO4wered is compatible with the Raspberry Pi Model A+, Model B+, Pi 2, Raspberry Pi 3 and Raspberry Pi Zero. Models A and B (the oldest one) require additional wiring.
Turn off the Raspberry Pi and unplug the USB to power cable. Install the LiFePO4wered module on the GPIO connector and attach it by screwing the white spacer as pictured.
Connect the power cable and press the touch button to turn on the Raspberry.
Installation of the libraries
The library source code is available on GitHub https://github.com/xorbit/LiFePO4wered-Pi
Let’s start by installing the necessary tools (git and build-essential)
sudo apt-get -y install build-essential git
Now we clone the git locally
git clone https://github.com/xorbit/LiFePO4wered-Pi.git
Enter the directory and start the installation
cd LiFePO4wered-Pi python build.py sudo ./INSTALL.sh
The installation script active bus I2C and UART to the GPIO. The I2C bus was already active, the Led is lit green if it flashes. In this case, it is necessary to restart the Raspberry with the command sudo reboot .
After the restart, the Green Led flashes, which means that the service was launched successfully at startup.
Configure the touchpad
The LiFePO4wered incorporates a hover button (touch pad) that allows you to turn on and turn off the Raspberry Pi. To prevent accidental stop, keep the finger on the touch pad 2 seconds. The touch pad is already pre-configured. If however it is not to your taste, it is possible to customize the touch pad settings using the following three parameters:
- TOUCH_CAP_CYCLES: pulse cycle numbers produced by the sensitive sensor. 20 by default
- TOUCH_THRESHOLD: detection threshold of a contact with the sensitive sensor. default 12. Measure combined with hysteresis. The measured current must be between threshold – hysteresis and threshold + hysteresis to determine a contact.
- TOUCH_HYSTERESIS: value added and deducted at the threshold of detection that allows to define the area of the current measurement. 2 by default.
The LiFePO4wered integrated several security mechanisms to protect the Raspberry Pi, especially the SD board. First of all, it allows to properly shut down the Raspberry Pi using the Touch Pad (and turn it on of course). Then the microcontroller constantly monitors the power supply and stop or won’t start the Raspberry Pi in the following cases:
- VIN_MIN: If the battery delivers a voltage lower than 2.85V (factory setting), an immediate stop request is sent to the RPI
- VIN_SHDN: If the battery delivers a voltage lower than 2.95V (factory setting), a stop request is sent to the RPI
- VIN_BOOT : If the battery is not charged enough, at least 3.14V by default, the RPI cannot start. By AUTO_BOOT 1, Raspberry Pi is started automatically when the battery charge is sufficient. By default it must at least delivered 3.15V (factory setting).
- VOUT_MAX: the Raspberry cannot start if the output voltage is greater than 3.5V (factory setting)
All safety thresholds can be changed (under your responsibility) with a little lower this command-line tool. Finally the Raspberry Pi is protected from electrical surges because it is powered by the power supply but by the battery.
Configure theLiFePO4wered with the CLI
To set up the LiFePO4wered, no need to engage in a python program, a small command line program is available lifepo4wered-cli .
We get the State with the function get , and assigned a value with the function set .
For example, if you want to know the current delivered by the battery:
lifepo4wered-cli get wine
to avoid any corruption of the system, the changes are not saved in the flash memory. We can do as many tests as desired. In case of error, simply unplug the power and remove the battery to erase. To make permanent changes, you need Flash memory with the command
Attention. Don’t Flash the configuration only if you be sure of yourself. Changing the factory settings may cause malfunction of the Raspberry Pi.
Here are the main parameters that you can change
|function||Action||read (Get)||write(Set)||Configurable(Save To Flash)|
|AUTO_BOOT||the Raspberry is started automatically when the battery is sufficiently charged (by default 3.15V).||X|
|Mode the Green led indicating the operating state. LED_STATE can take the following values:||X||X|
|TOUCH_STATE||State of the touch pad :||X|
|TOUCH_CAP_CYCLES||number of measuring cycle. 20 by default||X||X|
|TOUCH_THRESHOLD||contact detection threshold. default 12.||X||X|
|TOUCH_HYSTERESIS||value added and deducted at the threshold to determine the area of detection of a contact. 2 by default.||X||X|
|power supply voltage of the battery.||X|
|VOUT||output voltage of the battery (power of the Raspberry)||X|
|VIN_MIN||minimum output voltage of the battery before an immediate stop of the system. Default 2.85V.||X||X|
|VIN_SHDN||minimum output voltage of the battery prior to a system shutdown. Default 2.95V.||X||X|
|VIN_BOOT||deliberate battery minimum voltage to start the Raspberry. 3.15V default||X||X|
|AUTO_BOOT||automatically starts the Raspberry Pi when the battery is sufficiently charged.||X||X|
|WAKE_TIME||stop the Raspberry Pi during a stated (approximate) duration in minutes||X||X|
|SHDN_DELAY||time left in the system to stop seconds before the power stopped. default 65.||X||X|
|PI_RUNNING||State of the Raspberry. 0 if stopped. If started 1. Triggers the stop of the system if set to 0 manually.||X|
|CFG_WRITE||triggers the saving settings when moving the setting to 1. Attention. It is not possible to cancel the operation. Bad parameters can deteriorate and make it unusable material||X|
The LiFePO4wered brings a food secure to the Raspberry Pi as well as a reliable off-button. The SD board so sensitive to the accidental disconnection of the USB cable are finally protected. In the event of power failure, the Raspberry will be stopped “clean” If you are away from home. LiFePO4wered is a good solution for developing mobile applications or robotics. However, we regret the monopolization of several pins (I2C, UART, + 5V…) that may be required for some projects. It will then go through an Arduino. Maybe in a future version it will be compatible with specifications HAT.
The project source Code: https://github.com/xorbit/LiFePO4wered-Pi
The project website: http://lifepo4wered.com
Detailed technical Documentation: http://lifepo4wered.com/files/LiFePO4wered-Pi-Product-Brief.pdf