Managing solar power systems with SunAir boards

Lead Image © Kristaps Eberlins,

Follow the Sun

A successful solar power project requires data analysis and the ability to modify the system to take advantage of prevailing weather conditions.

Unplugging computers from the power grid has been one of my goals for years. In 2013, I started building Project Curaçao, a solar-powered Raspberry Pi/Arduino system designed to gather information and pictures from the tropical island of Curaçao [1] in the Caribbean (Figure 1).

Figure 1: Project Curaçao in paradise

While designing and building Project Curaçao [2] [3], I learned a lot about solar cells, solar power controllers, and especially the kind of data I wanted to gather to understand the behavior and performance of the system. Reliability issues with connections and sensors in the power systems led me to design a new board to manage power. The SunAir and SunAirPlus boards were the result.

The key to making a solar power project work for a long time in a variety of environments (e.g., clouds, rain, wind, and varying power consumption) is to gather data and then write software to modify the behavior of the project based on that data. Of course, the data is useful for designing other projects, too. Behavior matters! For example, running the Raspberry Pi camera to make a video makes current consumption climb.

You can use the SunAir boards to control and power solar cell projects. To generate even more power from the cells for little cost, a servo or stepper motor can track the sun using photoresistors. Tracking the sun can increase solar power generation by 20% to 30%.

The SunAir and SunAirPlus boards are customizable with software and hardware. The software is open source and will be available on GitHub [4].

Sizing Your Solar System

When designing a solar-powered system, the first consideration is to determine the power requirements for your design, because goals and budget will influence your hardware choices. My main criterion is that the Raspberry Pi run all day and at least three hours before sunrise and three hours after sunset.

At first, I will assume a design based on the Raspberry Pi Model A. Lithium polymer (LiPo) batteries will store 6,600mAh (milliamp hours), which theoretically means the Rasp Pi can consume 100mA for 66 hours. On average, you will not be able to get more than about 80% of that, depending on your battery. How fast you discharge batteries also makes a big difference. For comparison, an AA battery will hold about 1,000mAh [5] and a D battery will hold about 10,000mAh [6].

In a system like this, it is best to charge your LiPo batteries completely and then hook up the computer and see how long it takes to discharge the battery and die. (Sounds like a good SwitchDoc Labs Column.)

For the Raspberry Pi Model A, I assume:

  • Two solar cells; 3.4W, 6V/530mA (total of 6.8W)
  • Eight hours of sun on the cells at 70% of max (at least)
  • Delivery of current to the Raspberry Pi at 85% efficiency
  • 280mA on average (Rasp Pi with the wireless USB dongle)
  • Raspberry Pi running 14 hours per day
  • 6,600mAh LiPo batteries

Given these parameters, I can calculate the Raspberry Pi Model A run time during a typical day:


PiRunTime =

  [(8 hours x 70% x 1,060mA)

   x 85%]/280mA = 18 hours


Table 1 contains estimated power consumption for Raspberry Pi models, including a wireless USB dongle. I am assuming in each of these that the HDMI port is off, which saves ~20mA. Model A and B values are measured, and the A+ and B+ are estimated from various sources on the web.

Table 1

Rasp Pi Consumption (with Wireless)


Model A

Model A+

Model B

Model B+

Current (mA)





My goal was 14 hours, so it looks like the system will work. Running the Rasp Pi Model A for six hours on batteries alone will take


(280mA/85%)6 hours

= 2,466mAh


which is comfortably less than the 6,600mAh that the batteries can store. The WiFi dongle added about 60mA on average and was enabled the entire time the Raspberry Pi was on. No effort was made to minimize power consumed by the dongle. The results for other projects will depend on what other loads the system is driving, such as other USB devices, GPIO loads, I2C devices, and so on.

Note that during the day, on average, the solar cells are putting about 6,000mAh into the battery. Running the Raspberry Pi Model A for 14 hours would use about


(280mA/85%)14 hours = 4,600mAh


This means the system should (on average) be able to stay up 14 hours per day.

Of course, some days will be cloudy and rainy, which means that the system will have to adjust for the lower amount of incoming power. This is one reason why, on Project Curaçao, I have a low-power Arduino that turns the Pi on and off depending on the amount of sun and the amount of power left in the battery [7].

Table 2 contains some Arduino power consumption numbers. Remember that these are estimates and the current consumption on other projects will vary depending on what devices and loads are connected to the Arduino. For example, adding a USB WiFi dongle would require an additional 60mA. Using sleep modes reduces the power used by the Arduino. However, you can use sleep modes only if you don't use the processor. Because the Arduino has a software-based internal clock, and shutting it down in most of the power modes stops or resets the internal clock, I also need to use a real-time clock [8] in this project.

Table 2

Arduino Current Consumption




Mega 2560

Current (mA)




In production, you do not want to let the Raspberry Pi just run out of power because you could corrupt the SD card; instead, you need orderly shutdown and startup procedures. The Arduino is less susceptible to corruption when the software is properly designed, but it is still a good idea not to let the computer run when the power supply is lower than the specified values (usually 5V±5%), because strange things can happen. The Arduino can run on 7-20V from the barrel connector, but only 5V±5% from the USB port.

SunAir, the solar power charging system described next can be used to turn the Raspberry Pi on when the battery charge looks good; then, the Raspberry Pi can measure the battery voltage (using the SunAirPlus data gathering system) and decide when to turn itself off. This, coupled with an external watchdog timer [9], will result in a reliable hardware system. Your software is another matter entirely.

SunAir Design

SunAir [10] is a solar power controller/sun tracker/power supply system developed by SwitchDoc Labs to power Arduino- and Raspberry Pi-based systems (Figures 2 and 3). Internally, it is not a simple system, but it is designed to be simple to use.

Figure 2: SunAir block diagram.
Figure 3: The SunAir assembled board.

This project was funded by a successful Kickstarter campaign. The whole process of running a successful Kickstarter campaign for a technical product will be the subject of an upcoming SwitchDoc Labs column. SwitchDoc Labs fully funded its Kickstarter in just 16 days out of 30 days allowed. Pretty good for the first try!

The solar charge controller on SunAir is based around a CN3065 lithium ion charge controller [11] that runs the charging sequence for the batteries. This chip does a pretty good job of approximating the MPPT (maximum power transfer tracking), the purpose of which is to sample the output of the solar cells and apply the proper resistance (load) to obtain the maximum power for any given battery and temperature conditions.

Although the fully charged battery pack voltage might be close to the solar cell maximum power point voltage, this is unlikely to be true at sunrise when the battery has been partially discharged. Charging could begin at a voltage considerably below the solar panel maximum power point voltage.

When the batteries are fully charged and the solar power production exceeds the load of the computer, the CN3065 can no longer operate the panel at its maximum power point, because the excess power has no load to absorb it. The CN3065 must then shift the solar power operating point away from the peak power point until production exactly matches demand.

The CN3065 is set in SunAir to deliver a maximum of 1,000mA instantaneously to the connected LiPo batteries. Now note, that doesn't mean you can't use more than 6W of solar panels (6V cells x 1,000mA). The 6W solar panels won't be delivering 1,000mA most of the time. In Project Curaçao, I used three 3.4W solar panels (10.2W total) to get enough power to charge the batteries completely most days.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content