Test of feeding UPS LiFePO4wered for Raspberry Pi [Exclusive Guide]

12:50 pm October 24, 201610713

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).

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, 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.

LiFePO4wered dessus raspberry pi ups
front view. Fixing in place

LiFePO4wered dessus
rear view

connect the power cable and press the touch button to turn on the Raspberry. [

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 install build-essential git y 

now we clone the git locally

repository

 git clone https://github.com/xorbit/LiFePO4wered-Pi.git 

we enter the directory and start the installation

 cd LiFePO4wered-ft 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.

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 card. 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.

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

X

X

X

X

X

WINE

X

X

X

X

X

X

X

X

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:

  • 0 x 00 (Led) Off: Raspberry stopped
  • 0x01 (Led On): Raspberry Pi powered and running
  • 0x02 (Led flashes): starting or stopping
  • 0x03 (Led flashes quickly): available for user
X X
TOUCH_STATE State of the touch pad :

  • 0x00: is not affected
  • 0 x 01: the touch pad comes to be affected
  • 0x0E: contact with the touch pad has just been released
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 card 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 .

links

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