craic / pi_power Goto Github PK
View Code? Open in Web Editor NEWPower management for portable Raspberry Pi projects
License: MIT License
Power management for portable Raspberry Pi projects
License: MIT License
Using powerboost 1000C, Raspberry pi Zero W, Adafruit(PKCELL) LIPO 2500mAh.
Everything works fine, the only issue is green LED next to the microUSB connector on powerboost for battery full never switches on!!
Last few entries of my CSV file
Timestamp Sec Vbat Vusb Frac src
2018-10-21 21:57:19.881281,3180,4.146,4.818,1.000,usb,
2018-10-21 21:58:19.941360,3240,4.146,4.818,1.000,usb,
2018-10-21 21:59:20.019280,3300,4.146,4.823,1.000,usb,
2018-10-21 22:00:20.061397,3360,4.146,4.823,1.000,usb,
2018-10-21 22:01:20.101538,3420,4.146,4.818,1.000,usb,
2018-10-21 22:02:20.151421,3480,4.146,4.829,1.000,usb,
2018-10-21 22:03:20.229610,3540,4.146,4.834,1.000,usb,
2018-10-21 22:04:20.288072,3600,4.146,4.829,1.000,usb,
2018-10-21 22:05:20.342071,3660,4.146,4.839,1.000,usb,
2018-10-21 22:06:20.402465,3720,4.151,4.839,1.000,usb,
2018-10-21 22:07:20.432968,3780,4.146,4.839,1.000,usb,
2018-10-21 22:08:20.511040,3840,4.146,4.839,1.000,usb,
2018-10-21 22:09:20.581744,3900,4.146,4.850,1.000,usb,
2018-10-21 22:10:20.654158,3960,4.151,4.845,1.000,usb,
2018-10-21 22:11:20.721347,4020,4.151,4.850,1.000,usb,
2018-10-21 22:12:20.781373,4080,4.146,4.845,1.000,usb,
2018-10-21 22:13:20.841361,4140,4.151,4.850,1.000,usb,
2018-10-21 22:14:20.901402,4200,4.146,4.861,1.000,usb,
2018-10-21 22:15:20.957996,4260,4.146,4.850,1.000,usb,
2018-10-21 22:16:21.042319,4320,4.151,4.850,1.000,usb,
2018-10-21 22:17:21.139013,4380,4.151,4.850,1.000,usb,
2018-10-21 22:18:21.216985,4440,4.146,4.850,1.000,usb,
2018-10-21 22:19:21.294799,4500,4.151,4.867,1.000,usb,
2018-10-21 22:20:21.373166,4560,4.151,4.867,1.000,usb,
2018-10-21 22:21:21.401380,4620,4.146,4.861,1.000,usb,
2018-10-21 22:22:21.479480,4680,4.146,4.867,1.000,usb,
2018-10-21 22:23:21.519379,4740,4.151,4.867,1.000,usb,
2018-10-21 22:24:21.597532,4800,4.151,4.872,1.000,usb,
2018-10-21 22:25:21.623120,4860,4.146,4.872,1.000,usb,
2018-10-21 22:26:21.672836,4920,4.151,4.856,1.000,usb,
2018-10-21 22:27:21.750776,4980,4.151,4.872,1.000,usb,
2018-10-21 22:28:21.828692,5040,4.151,4.867,1.000,usb,
2018-10-21 22:29:21.901203,5100,4.151,4.877,1.000,usb,
2018-10-21 22:30:21.937832,5160,4.151,4.877,1.000,usb,
2018-10-21 22:31:22.015926,5220,4.151,4.867,1.000,usb,
2018-10-21 22:32:22.086466,5280,4.151,4.883,1.000,usb,
2018-10-21 22:33:22.151498,5340,4.151,4.872,1.000,usb,
2018-10-21 22:34:22.229556,5400,4.151,4.872,1.000,usb,
2018-10-21 22:35:22.279278,5460,4.151,4.883,1.000,usb,
2018-10-21 22:36:22.357359,5520,4.151,4.877,1.000,usb,
2018-10-21 22:37:22.401214,5580,4.151,4.883,1.000,usb,
2018-10-21 22:38:22.421364,5640,4.146,4.877,1.000,usb,
2018-10-21 22:39:22.499315,5700,4.151,4.883,1.000,usb,
2018-10-21 22:40:22.577593,5760,4.151,4.883,1.000,usb,
2018-10-21 22:41:22.651378,5820,4.151,4.877,1.000,usb,
2018-10-21 22:42:22.729431,5880,4.151,4.883,1.000,usb,
2018-10-21 22:43:22.807454,5940,4.151,4.877,1.000,usb,
2018-10-21 22:44:22.885327,6000,4.151,4.872,1.000,usb,
2018-10-21 22:45:22.963471,6060,4.151,4.877,1.000,usb,
2018-10-21 22:46:23.037275,6120,4.151,4.894,1.000,usb,
2018-10-21 22:47:23.096817,6180,4.151,4.883,1.000,usb,
2018-10-21 22:48:23.151383,6240,4.151,4.877,1.000,usb,
2018-10-21 22:49:23.234163,6300,4.151,4.877,1.000,usb,
2018-10-21 22:50:23.271401,6360,4.151,4.888,1.000,usb,
2018-10-21 22:51:23.331350,6420,4.146,4.883,1.000,usb,
2018-10-21 22:52:23.352160,6480,4.146,4.883,1.000,usb,
2018-10-21 22:53:23.401355,6540,4.151,4.888,1.000,usb,
2018-10-21 22:54:23.479415,6600,4.151,4.883,1.000,usb,
2018-10-21 22:55:23.557611,6660,4.151,4.883,1.000,usb,
2018-10-21 22:56:23.631350,6720,4.151,4.888,1.000,usb,
2018-10-21 22:57:23.651388,6780,4.151,4.888,1.000,usb,
2018-10-21 22:58:23.729370,6840,4.151,4.894,1.000,usb,
2018-10-21 22:59:23.761372,6900,4.151,4.883,1.000,usb,
2018-10-21 23:00:23.781577,6960,4.151,4.888,1.000,usb,
2018-10-21 23:01:23.859598,7020,4.151,4.888,1.000,usb,
2018-10-21 23:02:23.901427,7080,4.151,4.888,1.000,usb,
2018-10-21 23:03:23.989194,7140,4.151,4.888,1.000,usb,
2018-10-21 23:04:24.021567,7200,4.151,4.883,1.000,usb,
2018-10-21 23:05:24.100018,7260,4.151,4.894,1.000,usb,
2018-10-21 23:06:24.156870,7320,4.151,4.888,1.000,usb,
2018-10-21 23:07:24.186661,7380,4.151,4.888,1.000,usb,
2018-10-21 23:08:24.261602,7440,4.151,4.883,1.000,usb,
2018-10-21 23:09:24.310049,7500,4.151,4.888,1.000,usb,
2018-10-21 23:10:24.342088,7560,4.151,4.894,1.000,usb,
2018-10-21 23:11:24.402825,7620,4.151,4.899,1.000,usb,
2018-10-21 23:12:24.480786,7680,4.151,4.888,1.000,usb,
2018-10-21 23:13:24.558852,7740,4.151,4.894,1.000,usb,
2018-10-21 23:14:24.636952,7800,4.151,4.899,1.000,usb,
Below are the detailed logs of the voltage reading from analog pins..
when source is battery 'frac_v_bat' value is '1.0' and 'frac_v_usb' is '0.0'. Same circuit on breadboard works fine...but i am facing this issue only on my perfboard circuit..
2018-10-23 01:29:38,872 [ main ] INFO : main()> voltage_divider= 3.09523809524
2018-10-23 01:29:38,915 [ main ] INFO : main()> gpio_max_voltage= 3.3
2018-10-23 01:29:38,983 [ main ] INFO : main()> usb_max_voltage= 5.2
2018-10-23 01:29:38,990 [ main ] INFO : main()> adc_conversion_factor= 5.544
2018-10-23 01:29:39,059 [ main ] INFO : main()> (analog)frac_v_bat= 1.0
2018-10-23 01:29:39,135 [ main ] INFO : main()> (analog)frac_v_usb= 0.0
2018-10-23 01:29:39,211 [ main ] INFO : main()> (true)v_bat= 5.544
2018-10-23 01:29:39,218 [ main ] INFO : main()> (true)v_usb= 0.0
2018-10-23 01:29:39,289 [ main ] INFO : main()> fraction_battery= 5.98
2018-10-23 01:29:39,339 [ main ] INFO : main-safe()> 2018-10-23 01:29:39.339108,0,5.544,0.000,1.000,battery,
2018-10-23 12:16:23,861 [ main ] INFO : main()> (analog)frac_v_bat= 1.0
2018-10-23 12:16:23,870 [ main ] INFO : main()> (analog)frac_v_usb= 0.0
2018-10-23 12:16:23,879 [ main ] INFO : main()> (true)v_bat= 5.544
2018-10-23 12:16:23,888 [ main ] INFO : main()> (true)v_usb= 0.0
2018-10-23 12:16:23,897 [ main ] INFO : main()> fraction_battery= 5.98
2018-10-23 12:16:23,906 [ main ] INFO : main-safe()> 2018-10-23 12:16:23.905473,60,5.544,0.000,1.000,battery,
Here's the email, contribute away public!
So, I was attempting to use your script and I have two issues.
First, the mcp3008 very intermittently gets voltage data. Not entirely sure why, but I changed your script to not shutdown on that and just poll every second. About 1 in 50 polls gets data. I'm prone to think it's my connections, or a funky chip, but maybe you can't provide insight.
Second, the power switch. I'm going from a powerboost basic, because I have a rpi3, not sure if that matters. I can't get the thing to boot, it just power cycles over and over again. I've tried with and without the power off circuit, with and without capacitors. That one is wired as battery --> switch --> a split between gpio 14 and en pin and then en to ground with the proper resistors and diodes in place. As far as I can tell there's nothing in the script that is needed to power it on with this method, but maybe I'm wrong and that's my issue. I don't think there is enough time for the script to be run before the pi switches off though.
It should probably be noted that first installed back in December, but have since ran the update, upgrade, and dist-upgrade scripts. Currently, I'm not home so I can't verify what versions of Linux and the raspberry pi 3 I have.
Hi, I'm running in to a slight issue.
When running from the battery on a powerboost 1000c everything seems to work.
If I have the powerboost off after a shutdown and then plugin power to charge the battery and then press the button to boot, the pi runs for 10-15 seconds and switches off again. If I unplug the power that is charging the battery and press the button to boot the pi will boot with no problems. Any idea of what may be causing this issue?
I'm running Raspbian stretch. Raspberry Pi Model B+
I also have a IMU9255 sensor running from I2C. Having the I2C sensor unplugged makes no difference to the issue.
If needed I'll happily add photo's of wiring.
EDIT:
I'm going to mark this as closed at I believe this is due to a poor breadboard. I managed to get it working perfectly for days then it randomly occurred again.
Does an electrolytic capacitor have to be used or can a surface mount capacitor be used instead? https://www.digikey.com/short/j05q2p
Can a surface mount diode be used and if so what would be recomended?
Often, GPIO 26 triggers shutdown automatically without pressing power button. How to solve this? Please help me.
Hi there,
As the title states I'm running into a problem where directly after login from boot, just before reaching shell the system automatically shuts off. If I hold down the power button during this interval, I can bypass this and get into the OS.
Any thoughts? Other than this, it's working wonderfully so far
Since 3.7 is nominal voltage and 3.3v is safe discharge voltage can we discharge lipo till 3.3 v instead of 3.75v?
I'm looking to avoid using the Power Boost and just have the battery be monitored with the chip by the Raspberry Pi. Would that be possible?
Am setting up battery monitor with pitft and running into trouble with screen freezing. Should there be conflicts with spi and pitft? Reading about similiar issues from following forums
https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=82598
https://forums.adafruit.com/viewtopic.php?f=19&t=112525
Also am testing using mcp3002 rather than mcp3008. Would any code need to modified for this?
or do you not know?
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.