Solar Powering your Raspberry Pi!
David from cottonpickersplace.co.uk is a good friend of DesignSpark, here he gives us a run down on how to make your Raspberry Pi portable and keep it powered up for longer!
Most people run their Pi from a standard 5V USB socket, but you may be pleased to hear that it will actually run happily off a wider range of voltages, opening up some interesting options.
Officially it should be powered from any supply that puts out between (4.75V- 5.25V at 1A). The original FAQ confirmed it could be run from 4xAA batteries (so around 6V), in tests I’ve successfully run various Pi’s down to 4V and up to 6V. As with many manufacturers, these parameters include a reasonable margin for variance so there is some leeway from the official conservative numbers. In this article, we’ll stick within the recommended range but the brave can experiment a little further. Be aware that the amp rating is a ‘minimum’ rather than a maximum. You can happily offer the Pi from 5 or even 10 amps at 5V and it will just take the current it needs – its high volts that will damage the Pi.
The simplest and one of the most efficient alternate power sources for the Pi is actually just 4xAA rechargeable NiMH batteries .They are labelled with a ‘Nominal’ value of 1.2V but their voltage will range from around 1.1V when empty to about 1.4V when full –as you can see this fits pretty much perfectly with the voltage requirements when they are connected together in series (4.4V-5.6V). They are quite capable of supplying the 1A the Pi may call upon under load with a bunch of accessories connected to it. In most cases though a more modest 400ma (less than half an amp) is the likely demand on them. This power option is really efficient as there are no regulators or other power-sapping circuits in between the power source and the load.
Typical power usage from a Raspberry Pi ‘B’ model. Pi3 is about the same. Model A Raspberry Pi’s require about half this current.
The quickest way to wire it up is to pick up a 4xAA battery box like this one and cut a micro USB lead in half wiring the Red positive leads and Black negative leads together (red to red ; black to black) and insulate the wires to prevent them touching each other. The remaining USB wires (usually Green and White) are data wires that the Pi does not use so you can happily cut these and leave them unconnected.
A neater solution is to wire up the battery box to a USB socket. No doubt, like me, you will find many uses for this handy portable USB power supply. A few devices (such as iPhones) query the data lines before they will accept the power so you can’t use it without some further work, but for many devices, it does the trick nicely.
Depending on the model you can run a Pi for between 3 hours (Model B) to over 7 hours (Model A+) which makes for a great portable power option for many users.
You can easily move up from the AA batteries to some larger D sized batteries further increasing runtime by as much as a factor of 5 but if you are looking towards a 24-hour solution you may want to consider larger scale options...
Running the Pi from Lead Acid
For extended run-time over 10 hours, you should likely look to a 6V or 12V lead acid battery and drop the voltage a little. Both are very viable and can store significantly more energy than smaller retail cells, albeit not so portable.
The most accurate way to see how long a battery will power your Pi is to compare their Watt Hour (Wh) ratings. Mathematically this is the Voltage X Ah. As the Pi uses around 2 watts an hour, every Wh will give around half an hour of Pi Time. A quicker rule of thumb is to simply look at the weight and size of the battery. That heavy 12v Car battery will have significantly more power than a small 6V 7Ah battery.
Just like AA NiMH you need to be aware of the batteries nominal or ‘sticker’ voltage. In reality, a 6V lead acid battery will actually range from around 6V (flat) to around 7.2V (fully charged), as you can see, this is outside of the voltage range that the Pi can officially accept. Clearly, the 12V is even further wide of the mark! At these voltage levels, we need to introduce a voltage Regulator to bring the voltage down to an acceptable level. There’s plenty of options here but my favourite is the LM2940T, it’s a nice low voltage drop regulator capable of taking a wide range of voltages and bringing it down reliably to 5V. I like it because it doesn’t waste precious volts which as you’ll see later I value dearly! And it can accept a really wide voltage range (from just over 6V all the way to 25V) I like to use a couple of small capacitors to smooth the power supply and a heatsink but you can likely skip these for testing.
If you go this route you might want to put some alligator clips on the end of the wire and a USB port on the other to give you a nice portable socket that can let you run many USB devices from lots of power sources.
Batteries can only hold so much power
No matter what size battery you use it will run out of power eventually, so you need to consider how to charge it back up again. Of course, you could just use a standard wall socket charger but I love to use Solar instead as it makes the Pi very portable and of course much more ecological. It also opens up the world of off-grid independent operation where you can use them for time lapse photography or remote monitoring and control.
“Amazingly over 25% of the world’s electricity is now produced by renewables so it’s only fitting to take a look at how you can run your Pi in an eco-friendly way and potentially free yourself of the wall charger.”
Running a Pi solely from a solar panel is not really feasible for any length of time. The current produced by a solar panel fluctuates based on the amount of sunlight that hits the panel and won’t be able to consistently offer 1A continuously. When the sun goes behind a cloud current will drop by as much as 90% which will lead to restarts of the Pi and possible SD card corruption. For this reason, you should look at an intermediate energy store for the suns energy. Balancing the size of the panel and battery is a fun game that will help you optimise the pair for your usage and weight. The quick way to determine what you need is again to look at how many Watts the panel can supply and look at how many Watt Hours the batteries can store. A Pi uses around 2 watts an hour, so if you want to run the pi for 10 hours you need at least 20 watt hours over that period. A large 20Wh battery with no solar is one way to achieve this or a smaller 10Wh battery and a panel large enough to generate the remaining 10Wh over a 10 hour period would meet the same criteria. On a sunny day, you could use a 3 watt solar panel and cover that gap quite nicely. The advantage with solar is that you aren’t paying for the power to top it back up. If you are looking for 24 x 7 operation the math is the same, you just need to consider how many days without the sun you may need to cater for and how quickly you need to top that battery back up again. There are some nice charts available to predict the amount of sun you can expect wherever you are in the world.
If you want a nice cheap, basic way to utilise solar you can do this really easily – just connect pretty much any small 6V-9V solar panel to your 4xNiMH rechargeable cells – One that can put out between 100ma and 200ma would be would be perfect. Unlike Li-ion and lead acid, rechargeable NiMH batteries are pretty forgiving and can handle being overcharged a little – they will warm up when full just like they do when you charge them from a home charger. I recommend up to 200ma as this is about a tenth of their capacity rating - and is the current many old commercial chargers used to keep cells ‘ready for use’ after finishing their higher charge rate. Solar has a great property that the voltage will ‘meet’ the battery at the voltage it needs so you could even connect a 12V, 100ma solar panel to the batteries without issue.
I always put a diode on the positive wire between panel and battery so that it prevents the batteries losing energy at night through the panel. A 1A 40V Schottky Diode is perfect, as Schottkys have a low voltage drop (around 0.3V) and those ratings are more than it needs to handle the situation.
If you plan to use a 12V Battery rather than NiMH batteries you should use a commercial 3 or 4 stage charge controller to protect the battery from overcharge.
My perfect Solar Pi
I’ve combined much of the above learnings and advice into my Cottonpickers Solar Pi Case. It integrates a small (1.25 watt) Solar panel with a NiMH battery holder in a neat, compact, rugged 3D printed case. I wanted to be able to charge the batteries inside the case either from a standard USB wall charger or from the built-in solar panel. I use an efficient step-up voltage converter to achieve this. When charged up and in the sun you can run the Pi for over 7 hours – which for me was the perfect combination of runtime and portability. To really take the Pi anywhere you can add one of the many TFT displays, and amazingly it is still quite happy to run off this Solar and NiMH combination for a few hours.
If you are interested in purchasing one of Cottonpickers cases you can head over to his website here, alternatively, why not have a go yourself!
Thanks to David for this great article! There is plenty more to see and some great solar powered projects that can be found on the Cottonpickers website.
CommentsAdd a comment
The LM2940 is ok for use with 6V input but not 12V if you want maximum efficency and life from your batteries. The LM2940 is a linear device and hence uses an internal transistor to reduce the voltage from input to required output, this generates heat and with a 12V battery wastes approx 58% of the power in the battery as heat. If you are wanting maximum run time from your battery a switching regulator is much better, although significantly more expensive than a 2940. A good switching regulator would give you almost twice the run time out of a 12V battery, and significantly less heat to worry about in a small enclosure.