Powering a Raspberry Pi Pico with solar panels and an 18650
Reducing Raspberry Pi Pico W power consumption and a second attempt at using solar panels
Somehow this blog is turning into a “how to power things” diary, and this is not what I intended, but oh well, let’s roll with it.
Introduction
In this article, I will be using the Raspberry Pi Pico Weather Station that I built in the previous parts, but the solution is versatile enough to power any microncontroller or a single board computer. The only limiting factor is that the power consumption of the device should be low enough to allow it survive the night from the battery.
If you know how much your device draws current in miliamps, you can calculate its battery life by dividing the battery’s capacity in miliamphours by the current in miliamps. So for example, if you have a battery that can store 2500mAh, and a device that pulls 100mAh, it theoretically should run for 25 hours. Of course theoretically, because there always factors like losses in the cabling and connectors, or the battery losing capacity with time.
Parts List
- a device you want to power, it can be a Raspberry Pi Pico, an ESP32/8666, basically anything that can take 5V input
- solar panels
- DFRobot Solar Manager
- an 18650 battery with a battery holder
- cables and preferably a stripper/crimping tool
those are not affiliate links, I just like this shop and buy most of my electronics gear from them
Word of caution:
18650 are li-ion batteries, which in contrast to your typical NiMH or NiC batteries can be very dangerous! They can explode or start a fire if handled incorrectly! I am not responsible for any damage you might do to yourself or your surroundings. Sorry.
Solar Panels
You should look for any panels that output 5V of voltage and at least 1W of power. Then again, the ones I got are rated for 1W, but max I got with them in direct sunglight was a quarter for it, so so much for accurate specifications :)
Spoiler: this will lead to problems later.
I got mine from Aliexpress. I bought two of them to provide more power to the board. Both are rated at 5V, 1W.
There are two ways of connecting solar panels with each other. There is the parallel way, and the series way.
In the serial connection, the negative of one panel is connected to positive of the second panel. The positive of the first power is connected to the device, as well as the negative of the second panel. In this connection the voltages of the panels sum up, but the total current produced is as in a single panel. If I connected my panels this way, I would get 1W of power at 10V. The solar manager accepts only 5V, so that would fry it up. Not good.
In the parallel connection, the positives of each panel are connected to each other, and the negatives are also connected to each other. The positive connector of one panel and the negative connector of another panel go to the powered device. The voltage of the system is as the voltage of the single panel, but the current is a sum of the current of particular panels. I connected my panels this way, and I got 2W at 5V, at least theoretically. Perfect!
Here’s some photos from testing the solar panels. In full sunlight, two panels connected in parallel produced ~100mA at 5.6V, which gives about half a watt of power.
18650 Battery
18650 batteries are sold with or without internal safety measures. Those failsafes protect the cell from being overcharged, or discharged too much. Both those scenarios can be destructive to the battery and even dangerous all around. For this project you can use batteries without protection, as the solar power manager we will be using has it’s own protective measures, but if you want to be extra safe, get the protected ones. You will also need a battery holder, if you know how to solder get one without attached cables, they are more universal.
Solar Power Manager
For this project I am using a DFRobot Solar Power Manager 2.0. It is a cheap and useful device that will serve us in several ways at once. First of all, it will work as as a relay of power from the battery to the microcontroller, and secondly, it will charge the battery from the solar panels. What is also very important, it has its own protective measured to charge and discharge the battery in a safe, controlled way. Several input/output connectors are a nice additional touch.
Connecting Stuff
Here’s how everything looks connected together:
Everything should be straightfoward. I started with soldering cables to the solar panels, and connecting them to Manager’s Solar + and - connectors. Then I did the same with the battery holder. Remember to pay double attention to the polarity of connections.
After checking that the connections are good and pluses go to pluses and minuses go to minuses, I connected the Pico using the USB connection. A better way would be to connect the Pico using the pins on the Manager and the ARC connector on the RPi, but for quick tests I went with just using USB.
When the battery was inserted, the Pico came to life! A magical moment <3. If yours does not want to do the same, try pushing the boot button on the Solar Manager, sometimes it needs it to start.
Making a case
As a weather station should work outside, I had to find a case that would accomodate it. The case should be rainproof, but also allow for air circulation. It also should not get too hot so that the readings would not be skewed. As this is a prototype project, I went with what I already had, and I used an IKEA bathroom cosmetics holder.
It does the job quite good, it’s white so it won’t get too hot, it has cutoffs for air circulation, and used upside down it provides protection from the elements.
I superglued the battery holder and the power manager to the bottom. For the Pico, I glued some velcro tapes to one side. This will allow me to replace the Pico with some other device in the future. Finally outside I glued the solar panels to some styrofoam to give them a proper angle to the sun.
Testing
I took the finished case to my balcony, put it in sunglight and plugged the Pico in. The Solar Manager reported that it is charging. The Pico started sending data to the MQTT server.
Power issues
After a few days of testing it turned out that the solar panels do not give enough power to keep the battery charged. While this setup does indeed run a bit longer than running the pico with batteries only, it’s still not enough to keep it running indefinitely. I only got three days at best of run time, after that the battery is depleted. With the long summer days! I will need to look for better, larger solar panels. Another thing I will need to take a look at is reducing the power consumption of the Pi, setting up deep sleep or turning of the wifi when not transmitting. There will be updates at some time in the future, hopefully with solutions.
Thanks for reading, if you have any comments, please drop me a line on email or Twitter. Links at the top of the page.
If you would like to help fund my future projects, please consider to