Raspberry Pi Battery Power

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

What is safer to leave unattended connected to your Pi, a Li-Po or Lead Acid battery?

πŸ‘οΈŽ︎ 15 πŸ‘€οΈŽ︎ u/N3oj4ck πŸ“…οΈŽ︎ May 02 2021 πŸ—«︎ replies

I would redo the test with the buck converter output to 3v3 and power the pi on the 3v3 pins.

Going 12v to 5v, then feeding the usb and converting again to 3v3 on the pi isn't the best for efficiency

πŸ‘οΈŽ︎ 10 πŸ‘€οΈŽ︎ u/benjistone πŸ“…οΈŽ︎ May 03 2021 πŸ—«︎ replies

Can I get a TL;DW?

πŸ‘οΈŽ︎ 10 πŸ‘€οΈŽ︎ u/eecue πŸ“…οΈŽ︎ May 02 2021 πŸ—«︎ replies

You shouldn't pick a battery chemistry based on capacity because you can scale most batteries up and down to manage capacity.

What really matters is the voltage droop over a discharge cycle and whether the battery is designed to be shallow or deep cycle.

Draining a lead acid battery fully is bad for it; they're shallow cycle batteries and designed to be discharged a little before being recharged, thus their application in UPS systems, cars, and as the backup for submarines.

LiPo batteries to contrast are deep cycle and are designed to be discharged completely before being recharged.

Either way the choice of battery should be for some engineering reasons and not arbitrary based on cheapest mAh/dollar or expected vs actual battery performance. The battery tech should fit its intended use and for most applications what matters is size, weight, capacity and DESIGN CYCLE. If you don't consider deep vs shallow cycle you can quickly ruin the battery you're using.

πŸ‘οΈŽ︎ 3 πŸ‘€οΈŽ︎ u/DerryDoberman πŸ“…οΈŽ︎ May 03 2021 πŸ—«︎ replies

Once you know the duration of the battery life by this test e.g. 187 hours, you can put in a cronjob (sudo crontab -e) the following command:

@reboot shutdown -P +9000

to run on boot up.

Machine will then run for 150 hours (9000 mins) and then shutdown correctly, corresponding to a 80% discharge. This should protect the battery.

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/jakethepeg111 πŸ“…οΈŽ︎ May 03 2021 πŸ—«︎ replies

I crossposted this to r/raspberry_pi and where it was well received. However, the discussions are quite different in the two subs. Here it is a lot more technical. There it is more chatty and lighthearted. Both are interesting though.

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/jakethepeg111 πŸ“…οΈŽ︎ May 03 2021 πŸ—«︎ replies

You missed the opportunity to call this

Raspberry Pi and acid

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/matsonfamily πŸ“…οΈŽ︎ May 02 2021 πŸ—«︎ replies

That looks stupidly overkill for something that can easily stay on 24/7 with any 10k mAh battery.

Sure, testing stuff is fun and all that, but... anyone knows that the pi zero has a "closer to nothing" energy consumption.

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/GustavoM πŸ“…οΈŽ︎ May 02 2021 πŸ—«︎ replies

looks like a makeshift bomb to me

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/CureSociety πŸ“…οΈŽ︎ May 03 2021 πŸ—«︎ replies
Captions
[Music] welcome to another video from explaining computers this time i'm going to focus on running a raspberry pi on batteries which raspberry pi i hear you cry well i'm going to be looking at a range of models from the raspberry pi zero up to the raspberry pi 4. and i'm going to be using usb power banks to power the pies but also a larger 12 volt lead acid battery with an associated converter and of course i'll be considering the issue of battery life expectancy so let's go and get started greetings here we have the five raspberry pies which are going to take part in this video and specifically we've got a raspberry pi 4 2 gigabyte model a raspberry pi 3b plus an absolutely classic pie a raspberry pi 3 a plus a much underrated pi a raspberry pi zero to which i've soldered a gpio header and finally a raspberry pi zero w which is just like the raspberry pi zero except it's got wi-fi and bluetooth via this little shiny chip down here and all of these boards require a 5 volt power supply actually a 5.1 volt power supply which can be connected either via a usb connector by micro usb on most of these pies or usbc on the pi 4 or you can power them via their 5 volt and ground gpio pins before we start testing these boards out on batteries it will be useful to know their power consumption and this will of course depend on what the pies are doing what applications they're running and also what is connected to their gpio pins and their usb ports however very helpfully as a guide the raspberry pi foundation provides this web page which indicates the typical bare board active current consumption for all pi models as well as the maximum total usb peripheral current draw and of course i'll give you the link to this page in the video description anyway what i thought we'd do is to take the typical billboard active current consumption for the pi models we've got here and to put the figures in the first row of a table and with this done let's go in search of a battery and see how long it can run each of our raspberry pi's guess what here i've got a usb power bank the kind of thing you might use to provide extra power for a smartphone or a camera and specifically this is a belkin pocket power 10k which is a 10 000 milliamp hour unit that i recently purchased for 20 pounds which is about 28 dollars and batteries like this are potentially great for powering a raspberry pi as they've got usb outputs we've got two type a usb outputs on this unit as well as a micro usb input for charging the thing up it is however worth noting that some usb power banks don't work well with single board computers as they cut off if the power draw is too low and therefore when selecting usb power bank you need to get one if you want to use it with a raspberry pi that is operated via a switch like we've got here this one is turned on by pressing the unit there it's not turned on automatically when you plug in a load and that should allow the unit to work properly with a raspberry pi it's also worth noting that you're going to need a power bank which has got an appropriate rating for the pi you're using and in theory that is 1.2 amps for a pi zero 2.5 amps for pi 3a or pi 3b and three amps for a pi 4. however this belkin unit is rated at 2.4 amps and i've found this powers all raspberry pi models including the pi 4 with no problems so you cry how long will a 10 000 milliamp hour battery like this power our raspberry pi's well in theory we can just divide the capacity of the power bank in milliamp hours by the typical current consumption in milliamps for each pi to get a figure in hours however in practice the usable capacity of any rechargeable battery is less than its rated or notional capacity and the valencian polymer or lithium ion batteries we find in the usb power bank like this usable capacity is typically about 75 percent of the rated capacity so if we return to our table we can calculate that our 10 000 milliamp hour power bank should run a bare board raspberry pi 4 for 12.5 hours this figure being obtained by dividing 10 000 by 600 and then multiplying by 0.75 based on the 75 percent usable capacity doing the same calculation for the other pi models we get up to a theoretical bareboard battery life of 75 hours running our pi zero on the 10 000 milliamp hour power bank and if you have a power bank of say 5 000 billion power capacity it'll be half of this and so on anyway that's the theory but what i want to do now are some practical battery tests right here i am back again and i've got the pi 3a plus all connected up and running i thought we'd give it a starring role in this video and if we go across to its desktop you'll see i've written some python code and the idea here is to test the battery life of the pi when it's running headlessly with a minimal load and just performing occasional activities as would be the case if it was for example monitoring sensors running something like the weather station i built on the channel earlier in 2021 so let's just look at what this code does for start it import some libraries the time library the gpio library and also the open pi xl library which is a library in python for working with spreadsheets and before you can import this into a piece of code you must have opened up a terminal and done a sudo pip install open pi excel to install the open pi excel library back in the code i'm setting up gpio to have gpo pin 7 as an output because as you might have noticed i've taken an led and soldered on a current limiting resistor and a header so i could put it on the pi and we can use this to monitor the pi's activity whilst it's running the test next down in the code we're finding out start time start times of variable is going to be set to time.time which is the current time in seconds and then we're going to load in a spreadsheet and that spreadsheet is up here it's a very simple spreadsheet it's completely blank at the moment but what we're going to be doing is across this test writing the uptime of the pi into the spreadsheet so that when the pi runs out of battery power we can look back at the spreadsheet and see how long the battery lasted so back with the code we're going to do that inside three loops first of all there's a while true loop an infinite loop which will keep running until the pi's battery power runs out and then inside that we've got a couple more loops which accomplish what it says here we're going to flash the led five times every 30 seconds and then every five minutes write the uptime of the pi to the spreadsheet so we've basically got a couple of counters going on here called counter a and a counter bb the inner loop here basically says well counter b b is less than five turn the led onto half a second off for a house a second add to the counter keep going around until that's happened five times that flashes the led and then the outer loop here is going to run ten times over it'll run the inner loop it'll then wait for 25 seconds which will give us a total time here of 30 seconds it'll then increment the counter and we'll run the whole thing there for five minutes across this whole outer loop we're then going to calculate the current uptime for the pi uptime is going to be the current time minus the start time that'll give us a figure in seconds so if we divide by 3600 or 60 times 60 we'll get a figure in hours and then we're going to add that data to the spreadsheet as you can see and then finally we're going to save the spreadsheet first of all to where it's initially located in document we're also going to save a second copy to a backup directory because we know the pi is not going to close down neatly it's going to close down by having its battery power running out and therefore that might corrupt a file open at the time and therefore i think i've got less chance of having a corrupted spreadsheet if i save two copies in different locations to make all this work with the pi running headlessly i need the pi to auto run this code and i'm achieving that with a little a bash script over here which basically runs that piece of code and that is a put into the pisa auto start file it's relatively tricky getting a pi auto starting i have covered how you do it though in other videos so i won't go into too much detail of how i'm achieving it right here anyway that's what we're doing so let's set things up to run our first test and here we are with the power bank and the pi and i've discovered that whilst this power bank does have an off switch it very very annoyingly auto activates the first time you plug something in which i find intensely annoying but there we are that's what it does but the pi 38 plus is now booting up and hopefully in a second or maybe just to speed on through to get to the point there we are it's led is flashing hopefully you can see that on camera and the test has started and so this will now run for many many hours until the pi runs out of power and then we can look at its spreadsheet and see how long the battery lasted and here we are some considerable time later the power bank has been exhausted and i've rebooted the pi 3 a plus with a power adapter and if we go into libreoffice calc we can look at the spreadsheet this is very exciting i have not looked at this yet i'm assuming everything is okay because the pi booted up again so we didn't corrupt the microsd card when the pi ran out of battery power but there's our spreadsheet and yes all of these uptime figures are there and if we keep scrolling on down this we can hopefully see when did it finish there we are the final uptime recorded was 27.74 hours so that's how long the pi 3a plus lasted running on the power bank so i'm now going to repeat the test on the raspberry pi 4 which i put in a heatsink case as you can see and where we've got some results here in fact the first spreadsheet the one in documents did get corrupted but the one in backup didn't and as you can see we've got a final result over 15 hours for the raspberry pi 4 on the power bank so let's now repeat the test for the raspberry pi zero which i put in a pibo case here i am a few days later with a spreadsheet of results for the raspberry pi zero and if i scroll on down frantically going down on the scroll wheel here the pi zero struggles a bit running libreoffice calc and a spreadsheet of any size but as you can see we've got results and hopefully in a second you'll see there we are almost went past it an uptime of 58.5 hours running on minimal load test on the 10 000 milliamp hour power bank so let's put all of our results onto the table where we can see that the pi 4 and pi 3 a plus have performed ahead of expectations while the pi 0 ran fewer hours than i predicted and my guess at what's going on here is that the pi4 and pi 3a plus are using less power in my minimal load test than the typical bear board figure provided by the raspberry pi foundation and that the usable capacity of the power bank is less with a very low current draw so reducing the runtime of the raspberry pi zero and as you've probably noticed i've decided not to test the raspberry pi 3b plus and the raspberry pi zero w purely because if i did so this video could still be in production when the universe comes to an end right we're now going to test out a rechargeable lead acid battery and specifically this np7 12 volt model which i purchased for 17 pounds 99 with similar batteries priced from about 24 in the united states and i also purchased this little charger so i could charge it up this charged it in about 12 hours now as you probably know 12 volt batteries are very common indeed 12 volt lead acid batteries because they're used in cars and boats and things like that and therefore over the years many people have asked me about running a raspberry pi on a battery like this and to make it work we need to convert the 12 volt power we get out of the battery down to 5 volts for a raspberry pi and here i'm going to do that using this which is a packet of magic beans no it isn't a packet of magic beans it's a book converter and if we bring in mr scissors here he is he can get us into this little packet like that there we are get out the book converter and as you can see this is a rather handy little unit let's give you a closer shot of it and i purchased this for five pounds 99 it's rated at 5 amps and it accepts 12 volt input at this end using either a barrel jack or terminals and it outputs 5 volts at the other end using either terminals or a type a usb connector and the big advantage of using a buck converter like this to do our power conversion is that bug converters are very efficient indeed it's about 90 efficient when you convert power from one voltage to the other using a bug converter returning to our mp7 we can see that its rated capacity is 7 amp hours which is 7 000 milliamp hours at 12 volts so stepping down to 5 volts using our buck converter will give us a rated capacity at 5 volts of 7 000 times 12 divided by 5 and multiplied by 0.9 to account for the 90 efficiency of the book converter which gives us a final figure of 15 120 milliamp hours however as previously with our usb power bank a lead acid battery's usable capacity will be considerably less than its rated capacity and it can indeed be down to just 50 percent of what the battery is rated at however a 50 usable capacity for a lead acid battery is typically in situations with a very high current drain which will not be the case when we're using this to power a raspberry pi and so here i'm going to assume a usable capacity of 65 which gives us a final figure of 9828 milliamp hours at 5 volts so if we go across to another table that reminds us of a typical bear board power drain of different pie models we can calculate theoretical bareboard battery life expectancies as in this second row however as previously with our power bank what we really want are some actual test results and so we'll now connect up the mp7 and book converter to our raspberry pi 4 and start our minimal load battery life test and here i am back again many many hours later with a spreadsheet of test results for the raspberry pi 4 and these results are bemusing me because as you'll see if i scroll down i have to keep scrolling a very very long way because the pi 4 ran for an extraordinary amount of time on the lead acid battery there we are a total up time of 40.1 hours if we round to one decimal place which is massively more than i anticipated over twice what i calculated and i guess we know from the power bank test that the raspberry pi 4 is using less current in my test here than in the raspberry pi foundation's bareboard notional figure and it has to be the case that our led acid battery has got a significantly greater usable capacity than 65 running on the low current drain as we've got in this test but even so this is a spectacular result anyway i think i'm now going to move on to test out the raspberry pi 3 a plus on the lead acid battery and i'll come back to you in a few days during which time i'm sure i'll be musing on the raspberry pi 4 result and here we are with the results of the raspberry pi 3 a plus on the lead acid battery it has run a considerable period of time we get to the end here you'll see there we are it's run just over three days 72.1 hours and so without further ado we'll move on to our final test the raspberry pi zero on with that acid battery a test which will take the best part of a week to conduct and here i am back again with the raspberry pi zeros lead acid battery test results and guess what i was wrong the test ran for more than a week it wouldn't complete in a whole week some extraordinary results here i'm scrolling down on the pi zero trying to get to the bottom without losing everything off the screen almost going down there let's slow down a little bit and show you the final result guess what it is i'm as amazed at these results as hopefully some of you are as well the final result is here and it is look 187 hours i'm staggered we've managed to run the raspberry pi zero for well over a week on one charge of battery but i'm also equally staggered that the raspberry pi zero has remained stable over that period of time to be writing result to a spreadsheet every five minutes for an extraordinary number of hours so let's put this result into our lead acid battery test table and we can see there again massively exceeding our expectations of what the results would be and that's also now put the results into a table where we can see the results from both the power bank and lead acid battery tests and we could draw all sorts of conclusions from this data but i will highlight just two things here firstly i think i've proved the importance of running real-world battery life tests and secondly running these tests has given me a renewed respect for lead acid battery technology these days we spend a lot of time using devices that use lithium-ion or lithium polymer batteries which are small they're lightweight they charge quickly that acid batteries are large and very heavy and they charge very slowly but as we can see here performance from lead acid really can be very good indeed and given that the batteries i've been testing are about the same price it is clear if you want to get the best battery life for what you're paying it's certainly worth considering a lead acid battery to power a raspberry pi running a raspberry pi on batteries opens up all kinds of possibilities for mobile and remote applications and indeed in my next raspberry pi projects video i'm going to be putting a raspberry pi into my greenhouse so that it can water the plants and that greenhouse is distant from mains power and so the pie will be running on the lead acid battery we've looked at in this video but now that's it for this video if you've enjoyed you've seen it please press that like button if you haven't subscribed please subscribe and i hope to talk to you again very soon [Music] you
Info
Channel: ExplainingComputers
Views: 180,134
Rating: 4.9690208 out of 5
Keywords: Running a Raspberry Pi on batteries, Raspberry Pi batteries, Raspberry Pi battery, Raspberry Pi 12v battery, Raspberry Pi 12 volts, Raspberry Pi power bank, Raspberry Pi battery life, Raspberry Pi 4 battery, Raspberry Pi Zero battery, Christopher Barnatt, Barnatt, Raspberry Pi, buck converter, 12 volt buck converter, battery power, power bank, USB power bank, Belkin USB power bank, Belkin 10K
Id: lPyDtuzYE5s
Channel Id: undefined
Length: 20min 33sec (1233 seconds)
Published: Sun May 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.