LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices


Reply
  Search this Thread
Old 07-15-2019, 09:13 AM   #1
forestcreature
LQ Newbie
 
Registered: Jan 2012
Posts: 9

Rep: Reputation: Disabled
Simple lifepo4wered UPS install on slackware arm


Here are the steps that I took to get a LiFePO4wered UPS battery module working on Pi B+ with Slackware 14.2 arm.

It's a rough slackification of the supplied install script but might save somebody a minute or two. Instructions based on the LiFePO4wered/Pi unit, but other versions are available for later hardware and the process might be similar.

The task is to build the supplied library, daemon, and CLI tool, for power management, UPS functionality, user-definable boot behaviour, low-voltage clean shutdown, wake-timer, &c.

Get and build supplied software

Code:
git clone https://github.com/xorbit/LiFePO4wered*Pi.git
cd LiFePO4wered-Pi
python ./build.py
Install library, daemon, and CLI util

Code:
su
install -p build/SO/liblifepo4wered.so /usr/lib
install -s -p build/CLI/lifepo4wered-cli /usr/bin
install -s -p build/DAEMON/lifepo4wered-daemon /usr/sbin
Set up an init script for the daemon

Put the following into an init script called /etc/rc.d/rc.lifepo4wered:

Code:
#!/bin/sh
# Start/stop/restart lifepo4wered daemon.

# Start lifepo4wered daemon:
lifepo4wered_start() {
  if pidof lifepo4wered-daemon $2 > /dev/null; then
    killall lifepo4wered-daemon
  fi
  if [ -x /usr/sbin/lifepo4wered-daemon ]; then
    /usr/sbin/lifepo4wered-daemon $2 > /dev/null &
  fi
}

# Stop lifepo4wered daemon:
lifepo4wered_stop() {
  if pidof lifepo4wered-daemon $2 > /dev/null; then
    killall lifepo4wered-daemon
  fi
}

# Restart lifepo4wered:
lifepo4wered_restart() {
  lifepo4wered_stop
  sleep 2
  lifepo4wered_start
}

case "$1" in
'start')
  lifepo4wered_start
  ;;
'stop')
  lifepo4wered_stop
  ;;
'restart')
  lifepo4wered_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
Make the script executable!

Code:
chmod +x /etc/rc.d/rc.lifepo4wered
Add the following lines to /etc/rc.d/rc.local to start the daemon on boot:

Code:
# start lifepo4wered daemon
if [ -x /etc/rc.d/rc.lifepo4wered ]; then
 /bin/sh /etc/rc.d/rc.lifepo4wered start
fi
Enable I2C and UART in boot config

This assumes that you're using device tree. Check that the following lines are somewhere in /boot/config.txt and uncommented:

Code:
dtparam=i2c1=on
dtparam=i2c_arm=on
enable_uart=1
Done, reboot!

When you reboot you should be able to read and set various variables with the lifepo4wered-cli tool, shut down cleanly by touching and holding the touch switch on the module, enjoy sane UPS-type behaviour (with automatic shutdowns on low battery) or whatever else you set up the module to do.

Sorry that these steps assume you are familiar with things like /etc/rc.d, I'd be happy to answer questions about anything I haven't made explicit.

As for the battery module itself, it seems pretty cool so far. It's performed well as a UPS with DC supply permanently connected. I am hoping it'll give a useable runtime with a pitft and some peripherals connected for a holiday computer for (very!) light use. One cool thing is that I've had the UPS module lollygagging around unused for a couple of years, and the battery behaves fine---a function of the LiFePO4 chemistry I guess.

Last edited by forestcreature; 07-15-2019 at 09:41 AM.
 
Old 07-15-2019, 07:49 PM   #2
glorsplitz
Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 752

Rep: Reputation: 162Reputation: 162
This is interesting, thanks for sharing. I've not investigated this yet, how does it get charged, when do you know it's fully charged?

Self powered webcam first thing I thought of.

You thinking of programming holiday lighting?
 
Old 07-16-2019, 06:38 PM   #3
forestcreature
LQ Newbie
 
Registered: Jan 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by glorsplitz View Post
how does it get charged, when do you know it's fully charged?
The model that I have charges from 5V on its own usb micro-b socket, limited to 480mA charging current---but I guess the newer model for Pi3, 4 &c. has beefier numbers.

There's a charging LED and another programmable LED, and all the voltages are readable in userspace.

Quote:
Originally Posted by glorsplitz View Post
Self powered webcam first thing I thought of.
Yeah!

Quote:
Originally Posted by glorsplitz View Post
You thinking of programming holiday lighting?
You mean Christmas lighting or going-away on holiday lighting? No I wanted a pocket computer that I might have dreamed about in the year 2001. Stuff like looking up holiday bus times via lynx. I know people have smart-phones but I love how easy it is to live yesterday's fantasies today!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ups not able to communicate with ups software beopen Linux - Software 2 09-15-2014 03:22 AM
APC UPS backup-ups ES RJ-45 augurseer Linux - Hardware 3 11-18-2009 11:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM

All times are GMT -5. The time now is 12:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration