Level up your Raspberry Pi power management knowledge while learning how to run a Raspberry Ri using only solar energy. In this tutorial, you’ll learn how to make a solar-powered raspberry pi.

The Raspberry Pi is a portable computer the size of a credit card. It features configurable GPIO pins, USB ports, an Ethernet port, a 3.5mm audio jack, and even wireless connectivity. It opens up a lot of possibilities in DIY electronics, especially when powered with a battery. But this setup can still be improved by connecting the batteries to a solar panel.

Solar panels convert sunlight into direct current electricity. Utilizing solar energy means you won’t have to disconnect and recharge your batteries every time it discharges. It makes your setup self-maintaining.

In this tutorial, you will not only learn how to make a solar-powered Raspberry Pi. You will also learn the best practices in Pi power management. These topics work hand-in-hand to achieve the same objective: efficiently making a self-sustaining power solution.

The first thing you need to do is to choose the correct Raspberry Pi.

## Raspberry Pi

The Raspberry Pi 4 is the latest model of the Raspberry Pi brand. It has a quad-core processor, a gigabit Ethernet port, USB3, which supports two 4k displays, but consumes a whopping 6.25Wh.

The Pi 4 is excellent with heavy-hitting applications, but if you’re using a limited power source such as solar-powered batteries, the Raspberry Pi Zero is the more logical choice. See the table below.

Table 1: Power consumption between Raspberry Pi 4B and Raspberry Pi Zero

The Raspberry Pi Zero consumes approximately seven times less power than the Raspberry Pi 4B. To demonstrate, let’s convert these current ratings in terms of battery life.

Suppose I have a single cylindrical 18650 lithium battery with 2200 mAh capacity. How much time would a Raspberry Pi 4B last?

To get the battery life, divide 2200mAh with the rated amperage of the Raspberry Pi 4B.

An hour and forty-five minutes of operating time are definitely not suitable for a portable device. However, if you use Raspberry Pi Zero, the results improve significantly.

This example only uses a single lithium battery, so improvements are still possible. You can add batteries in parallel to prolong battery life. Also, the rated current is the mean from the datasheet. The actual current readings may differ depending on your Raspberry Pi’s activity and peripherals. If you want to know the actual readings, you can use a current tester.

## Battery Size

Choosing the battery size for your setup is also important. Using the calculations above, we can formulate a rough estimate of our device’s battery life. For instance, if you have a 1000mAh battery, your device with a rated current of 1000mA will be up for an hour. Similarly, if you have a 40,000 mAh power bank, which is essentially lithium batteries in parallel, your 4A device will be up for an hour or a 1A device for 40 hours. Make it, so you have enough capacity to run your raspberry pi overnight without shutting down. This also largely depends on the solar panel you’ll use for your setup.

## Solar Panel

The right solar panel must output at least 5V. As long as it is rated at least 5V, it will work with a Raspberry Pi. Wattage and current ratings determine the maximum charge rate of the solar panel. This means a 2W solar panel can charge a battery two times faster than a 1W panel. You should also check if the solar panel is decently weathered-proof. An IP65 rating is enough to withstand common rain, but if your location often snows or has storms, you should choose a better one.

## Battery Charge Controller

Charge controllers, sometimes called BMS (battery management system), regulate incoming current and voltage to your batteries. They are also used to prevent overcharging, features under-voltage lockout, automatic recharge, etc. Simply put, they allow you to charge your lithium batteries safely. These are required for solar power setups as sunlight intensity constantly changes. Variations of sunlight intensity are directly proportional to solar power output, and these fluctuations can destroy your device. Charge controllers prevent that from happening by ensuring a constant output every time.

## Possible Setups

Now that you are familiar with the required components of a solar-powered pi let us move on to the nitty-gritty. Below are three possible setups I have tried using solar panels and raspberry pi.

The first setup is minimal. Connect a TP4056 charge controller to a battery. Then, connect the charge controller’s output to the 5V pin and ground of the Raspberry Pi Zero. Lastly, connect the power and ground lines of the solar panel to the charge controller. Since the Pi operates at 3.3V, the 5V rail already has an onboard voltage regulator that creates this voltage using any input between 3.3V and 5.25V.

This setup is great for testing—best for trying your system out for a few minutes and observing if it is working. However, I don’t recommend using this as a permanent solution. It’s because you’re basically connecting 3.7V to the 5V pin.

The solution to this is our second setup. You need to add a DC/DC converter that raises your 3.7V to standard 5V. Take the output from the charge controller. Connect it to the converter’s input and connect the output to the 5V pin of the Pi. With this setup, you don’t have to worry about not making the most of your batteries.

The last setup uses a power boost module from Adafruit. This module works like a battery charge controller and a DC/DC converter in one. No need to have separate connections. Just connect a 3.7V LiIon/LiPoly battery, and you’ll have constant 5V output.

The only downside of this setup is the cost. It costs as much as six times the price of both TP4056 and MT3608 combined.