neonhorizon / lipopi Goto Github PK
View Code? Open in Web Editor NEWGuide to setting up LiPo batteries on the Raspberry Pi
License: GNU General Public License v3.0
Guide to setting up LiPo batteries on the Raspberry Pi
License: GNU General Public License v3.0
Is there a way to have it automatically power on the pi when power is restored?
Basically, have everything powered on and running, lose power and it will continue to run off the battery. When that is depleted, it shutdown the pi. Once power comes back, the pi turns on and everything is happy.
Hi,
Is it neccessary to use UART Tx/Rx pins or is it possible to use any other pins from 25 to 40?
Hi I'd just like to confirm if I can still use USB serial communication on my RPi3 to my Arduino uno. I'm not quite clear if the UART TXD and RXD pins affect the USB Serial comms. Thanks in advance!
Am wanting to use tx uart port on pi zero w for existing bno055 adafruit imu. Looking at lipopi diagram seems to indicate that this pin is only necessary for power up. Could both devices share this pin and not be an issue with compatability?
Hi,
I have an issue with the setup:
Can anyone advise where to look for an error?
If I need to provide more infos please let me know.
Best Regads,
goeste
I have tested 'A Simple Press (no hold) Power Up Version with 100uf capacitor'. Power down and power up with button press works fine.
Auto shutdown if battery is low also works fine but 'lipopi.py' script always call 'lipopi_user_shutdown' instead of 'lipopi_low_battery_shutdown'.
Using same GPIO and PowerBoost 1000.
Using raspberry pi Zero W. 1N4007 (Since 1N4001 wasn't available at the time of testing) and 100uf (50v) capacitor.
I was wondering if something like this will probably work. The goal is to switch the EN to float for some time and then close it (just like Push button NC). This will cause the powerboost to stay on till Pi is booted and automatically switch off once Pi boots down. I often forget to switch it off after shutdown. I tried making this and I faced two problems.
Uart Tx o-----'\/\/\,------o,
R1 'o----------------o EN
Floating -------> o
is it safe to directly connect Adafruit powerboost 1000C LBO Pin to Raspberry Pi Zero W GPIO 15 pin without any register?
In item 4 in the Software section you have:
"If you used a pin other than GPIO 14 for the low battery line"
This should be GPIO 15
...and a very minor one
"Example Implimentation" should be Implementation with an E
While the Powerboost is a great item, you can use others if you're inclined and/or need more current. Over the years, I've collected a variety of DC-DC buck and boost units. Looking up the datasheet of the chip used, more often than not there is an ENABLE pin. Sometimes it's available as a pad on the board, and others it's buried. Even if it's buried, you can carefully lift the pin to get access to it (Don't bother cutting traces, you'll likely find hidden traces will waste a lot of your time. From my personal experience...)
The problem is most of these boards won't have a low voltage detector. They are usually SMT parts, but there are chips available that will allow a low shutdown detection.
I have followed the writing diagram and i have followed the installation of the software but my pi zero keeps shutting down when i let go of the power button. I do press and hold the button for at least 2 seconds.
I have the Pi Zero with the 500 charger board.
Any ideas ?
Do I need to use the UART pins on the raspberry for the LiPoPi to work? I need to access the serial port on my pi zero to communicate between Pi and pc, can I use some other gpio.
@NeonHorizon I'm reading here that you can't connect the LBO directly to one of the GPIO pins:
https://forums.adafruit.com/viewtopic.php?f=8&t=73893 - and in a number of other places people are saying the same thing.
I'm having an issue where I'm trying to emulate this on a different pin other that GPIO15, by running this:
echo 21 > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio21/direction
echo 0 > /sys/class/gpio/gpio21/active_low
But then when I run cat /sys/class/gpio/gpio21/value
with nothing connected I get 0, whereas wen I run cat /sys/class/gpio/gpio15/value
and there's nothing connected, it always reads 1.
Also, if I then plug GPIO 21 into LBO it makes the battery LED come on on the powerboost.
Wondering if you know whether this should be the case?
Many thanks
Anthony
Hey Guys,
Really nice project and guide. I made a simple adaptation of your work which allows the same switch to also be used for a soft power down. It needs a few extra resistors and two transistors, the "battery button" circuit now activates two transistors, one enables the powerboost while the other pulls a GPIO to high. This can then be soft captured as a shutdown signal. Writing this I realise a diode would also work in place of the first transistor, so the second circuit is an untested alternative.
I have used the first circuit and could power on and off the RPI using the same switch. If you want to include this as an alternative config in your guide I have tried to create these figures as close possible to your existing ones.
Cheer,
Duncan
I would like to add a low battery warning reset feature to your code. I have a project that is solar powered and I would like it to be able to reset the low battery shutdown if the battery starts to be charged by the solar panel. I have tried myself but can not get it to work. Please help.
Hello,
first sorry if this is not the right place to ask you question. If this is not, then could you point me to the right forum?
I would like to know if your project could be moded easily to use an ON/OFF switch rather than a push button.
I am building a wifi radio for my mother and that would be much simpler for her to use a conventional ON/OFF.
thanks
I'm trying the Simple Press (no hold) version and the power up and power down options work well. But as soon as I connect the Low Battery pin to GPIO 15 the low battery light turns on and the raspi power off after start.
I also notice that with the raspi not attached if I connect the low battery pin to ground the low battery light also comes on, I don't know if this is the expected behavior or something is wrong in my circuit.
I'm using a Pi Zero W and a power boost 1000C, in the circuit I used 1N4007 diode and 120K resistors instead of the 100K ones.
It seems the raspberry Pi model 3B has a changed internal circuit for the GPIO pin. when console is disabled on the pi, the voltage of the pin drops to around 1.4 volt. with console enabled, this is the correct 3.3 volt.
what to do?
I build this on my model B+ (thanks rpi for the brilliant naming scheme) and this is working fine. But now in "production" on a model 3, this fails.
The low power pin on the powerboost 500c will go as high as the battery-voltage (4.2 Volts). You connect this to the 3.3Volt GPIO directly. In order to protect your GPIO you should drop the voltage and limit the input current. I've done this by using a 1n4148 and a resistor in series.
Hello Daniel
The RPI3 works fine with Rasbian Stretch, it behaves like the othe ones.
I have been inspired by you lipopi project and came out with https://github.com/jeanrocco/Pi_SD_SAVER . If you have some time to spare, would you look at it and tell me what you think...
jrb.
I understand the pins have the special characteristics, but I am trying to run serial hardware on my pi at the same time and was wondering if there was a way to do this without those pins.
Am wanting to use a gpio pin specifically pin 17 on adafruit pitft 2.2" (https://www.adafruit.com/product/2315) . Is this possible? Am also looking into a failsafe switch where user would turn the device over while holding down the button in order to turn the device on or off. Would use tilt switch to detect when device is turned over (https://www.adafruit.com/product/173).
When the push button is pressed, the power up path will pull the GPIO 14 to VBAT minus the diode forward voltage drop (through the 10 k resistor, though). On a 4.2 V lipo, this results in 3.5 V on GPIO 14 while the button is pressed.
Won't that harm the GPIO pin (on power-up until the GPIO 14 is pulled to 3.3 V internally)?
A second diode in series (as in the power down path) would prevent that.
# ./low_bat_shutdown.sh
bash: ./low_bat_shutdown.sh: /bin/bash^M: bad interpreter: No such file or directory
solution:
# sed -i -e 's/\r$//' low_bat_shutdown
I have disabled the serial port, although the raspi-config menu has changed for Raspberry Pi W version 1.1.
Instead of Advanced, you have to use Interfacing Options->Serial.
Testing by leaving EN unconnected and inserting the battery to turn on the Pi W, and with a voltmeter on GPIO 14 ( pin 8), the pin goes to 3.3v as soon as it powers on, but then goes low again after a second or two. So, when the power up/down circuit is implemented as described in the README, it does not latch in the power up state. I'm looking at the meter now, after the Pi has been running for about 5 minutes, and the voltage is .75 volts.
Since I burn my GPIO 14 I found here https://www.raspberrypi.org/documentation/configuration/config-txt/gpio.md that you can set up other pins to start high by adding something like this but with any gpio you chose to the /boot/config.txt file
gpio=12=op,dh
And to make it low when the raspy is off you can modifying the lipopi.py starting the ping in output mode and turning it low before shutdown, something like this
GPIO.setup(12, GPIO.OUT)
GPIO.output(12, False)
The lipopi.py does a GPIO.cleanup() but this still let some voltage in the pin, so turning the pin to low before is needed
For me this works fine, but only works if you power off by using the button or with the low battery signal
I have an Adafruit 3.3v Linear regulator. Can it be used to regulate Vbat for GPIO protection? If yes haw should I modify the circuit for On and Off functionality?
Is is ok to apply 3.3v to the output pin or regulator without connecting anything to the input?
Please forgive the stupid question, but analog circuits aren't my strong suit.
Is it possible to have the Powerboot and RPi power on automatically once external power is applied? Then I'd have the RPi process data and shutdown on either low LiPo or when external power is absent and work is complete.
Thanks
Based on the requirements for bluetooth it would appear this setup wouldn't work with the RedBear IoT pHAT... are there any changes that would accommodate this device?
What I'd like to do is have it so a quick push of the button doesn't do anything, but holding the button in for more than 3 seconds shuts the Pi down. I'm not very good at Python. Is there an easy way to add that function?
Thanks!
Hi
Thanks for this - looks useful!
Would you be able to update this with details of how long the battery lasts with different capacity batteries, based on your experience with it?
Oskar
In your hardware diagram you have both GPIO 14 and GPIO 15 labeled as UART TX
It seems my distro doesn't come with raspi-config. Does anyone know the files that are modified, and what the changes are? Thanks!
Hi, I have a new zero with camera module and have set up the PowerBoost1000c as per the on off version.
Everything works except the Pi will only stay on when holding the button. Even holding the power button in until login but the PB powers off as soon as the button is released.
When powering from Pi USB power off via button works fine with the script running.
Any help massively apreciated.
Mark
Hi there;
First thank you for this wonderful project. I'm very new to electronic but I know that such kind of bundle can help me in my personnal project.
It happens that I m not in possession of a 100K resistor. But I got a 1M resistor. I guess that it is ok, right?
My understanding is that the higher is that resistance the better it is!?
Thank you for confirming.
I use the "Simple Press (no hold) Power Up Version", with one 1N4001 and Power Down connected to GPIO 6.
RPi 3B+, Powerboost 1000c, original charger.
Works fine, but when charging, it seems as if the button would create a short curcuit. There is no graceful shutdown - Pi goes immediately off. Any ideas?
While everything works fine on the Pi Zero W that has the shutdown circuit on it, while testing on an unmodified Zero W it immediately shuts down. Looking at the code, it appears it sets a pulldown on GPIO18, but it appears a pullup is needed at GPIO15. Is there a reason this isn't a good idea?
# setup the low battery check pin
GPIO.setup(lipopi['low_battery_pin'], GPIO.IN)
changed to:
# setup the low battery check pin
GPIO.setup(lipopi['low_battery_pin'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
I was reading the schematics for both the basic and the power-up, power-down version in addition to this article by adafruit: https://learn.adafruit.com/raspberry-pi-wearable-time-lapse-camera?view=all#wiring
I understand the basics of reading a schematic, but is there any reason why the article above wired straight from the powerboost to the pi's GPIO's and you all used Diodes and resistors to step down the voltage?
I suspected it had to do with them using a while loop within their program to check the GPIO signals and you all used systemmd, not sure, would appreciate any info regarding this.
Specifically, I see you had explained it was to step down the voltage, but is their approach to wiring naive or am I missing the difference in the approach?
im new to linux and am having trouble setting up the service with systemd.
my project is a gameboy pi and have retropie in my pi right now and i have set up the python rpi.gpio
i have downloaded the lipopi.py and lipopi.service in my windows computer and using ssh with winSCP software to transfer files to and from my pi. and now need to follow step 2. however theres a error saying permisson denied.
I also dont know what the follow means
Modify the file lipopi.service to point to where your copy of lipopi.py is located, then
$ sudo cp lipopi.service /etc/systemd/system/.
can someone direct me to what i need to do or have directions thats some one thats starting can understand :) .
thank you
I'm not very savvy on electronics, so I wanted to ask if this setup would make sense before I try it and burn something. I'd like to use a two position switch for both booting up my Pi Zero and shutting it down, changing the following from your 'Basic version':
Where the X pin is pulled high when the switch is on the OFF position, triggering a shutdown, and otherwise always on the ON position when the rpi is running.
Maybe it's total nonsense for obvious reasons or maybe you've already tackled this solution, in any case it'd be very useful to know! Thanks in advance
Dear Daniel,
IIUC when RPi0 shuts down, GPIO14 should go low and that should turn Powerboost off.
Then why is wire to GND still needed?
Thank you!
Kind Regards,
Slava.
Just looking for clarification on this version, the readme isn't clear as to what code is required to be installed as it talks about installing 'this' script but then doesn't show any scripts as the normal version does. Looking through the code (my python is very basic) I can't see functionality in the main version to do the power up/power down, unless I'm missing something?
I have followed your instructions and diagrams as closely as I can, but I’m still not getting any power to my RPi 3 B. According to your embedded images, you do not indicate any wiring between the PowerBoost 1000C’s USB power out terminals (where the full-sized USB socket can be soldered) to the RPi 3 B’s micro USB power in ports (if needed, I intended to solder wires directly to the USB test pads on the bottom of the RPi 3 B to fit into a tighter case footprint). I noticed in the original Lipopi project there are wires going from the PowerBoost 100C USB power out to the RPi micro usb power in, but those same wires do not appear in your pictures. Do I need them? Should you update the images to show them? If I don’t need them, then how does the RPi receive 5V power?
I'm trying to configure the simple set up that powers up after a few second of holding the button but the power boost and the pi both shutoff once i release the button...
https://imgur.com/a/k45g19E
this is my set up so far.
help pls
Starting a new issue if you don't mind. I attempted to take your advise on how to wire up a PowerBoost 1000c charger with a Rasperry Pi Zero W so that it will power up when the 1000c gets power, and power off once the pi shuts down from #20 .
As-is, if I wire this up with a battery it stays power off. When I apply power to the 1000c via a usb connector, the 1000c and pi power up. But when I remove power from the usb connector, everything shuts off, instead of running on the battery until the pi shuts down.
Can you take a look at my circuit and see if I wired it up as you suggested, or made a mistake?
teslaCamBuddy.pdf
Hello, I was wondering if there was a specific reason you used the Bat pin to activate the EN pin, and not the Vs pin ?
With the current setup, when no battery is present, the button does not work. Seems legit, no battery=no Bat output
My idea is to use the Vs pin to activate the EN pin instead of the Bat pin, so I can use the button even when only the USB cable is plugged in. It can go as high as the USB voltage, but the diodes should help protecting the GPIO anyway.
Am I wrong somewhere ?
Thank you for your reply.
Ronan
PS: I'm using the power on / power off schematics with a Rapsberry Pi Zero W.
Hello, I don't know if I'm doing this right...
The raspi-config on recent Raspian allows to disable the console with "A8 Serial", but it also sets enable_uart=0 in /boot/config.txt . Switching it back to enable_uart=1 makes GPIO_14 works as your documentation says. I'm on a rpi B+ V1.2. Great work thank's.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.