Bystroushaak's blog / English section / Hardware / SolarPi experiment 1: The PiJuice Fiasco

SolarPi experiment 1: The PiJuice Fiasco

*Sigh*. It’s not a good practice to start blogs with sighs, but this blog really required one.

Anyway, some time ago, I wondered how hard it would be to build a solar-powered server. I did some basic exploration, people seemed to do that; slap together a few Raspberry Pi components, and you are done. My curiosity was satisfied.

⚠️
This blogpost was written during a long span of time. It took me at least nine months to finish it, so it may contain plenty of inconsistencies when it comes to time. For example, in one part, I am writing about summer in present tense, in the other about winter. Sorry.

Fast-forward several months. War in Ukraine, dependency of the Czech Republic on Russian gas and oil and economic sanctions were just a few of the things which contributed to the price of electricity here in the Czech Republic doing this:

(It actually started way before the war with the crash of some energy companies)

I’ve bought my old server , when the 1 MWh cost something like 29.5 CZK. Since then, it costs 1433% more. Our government is now passing laws which will restrict the temperature people can use to warm their houses during the winter, and they are asking us, citizens, to lower our consumption of electricity. In expectation of shortages (both electricity and components), I’ve decided to be proactive, and revisit the idea of the solar-powered Raspberry Pi now, while I can still get the components. And so, this journey started sometime in July 2022.

Requirements for new server

Replacing my old server with a Raspberry Pi is good even without the solar power because it consumes roughly 1/8 of electricity, while providing similar compute power. It is also much smaller, and it doesn’t make noise (which my old server does).

My requirements were:

  1. Microserver that consumes much less electricity.
  1. At least 1 TB of storage space, ideally using SSD. I have a ton of bad experiences with SD cards and flash disks.
  1. 8 GiB of RAM.
  1. Solar power, ideally in non-invasive and temporary form (you can pack it and take with you into the new apartment, it doesn’t take a lot of space, doesn’t require special mounting points).

The university where I’ve studied did some experiments with solar back in the 200x. They did measurements, compiled a map of the usability of solar power through the Czech Republic, regarding weather, seasons, elevation, and other relevant things. What they got was quite depressive, as it was obvious, that we are not the best part of the world for solar power.

With that in mind, I wasn’t expecting that I could power the server from the solar panel for the whole day and night. Just some kind of offset, something like 6–10 hours from solar, will be good enough.

Components

After some exploration, I’ve decided to use PiJuice Hat as the main driver for battery & solar power. This is a circuit board which you put on top of the Raspberry, and it handles stuff like charging of your battery, powering the Raspberry, switching between power supplies and so on.

A couple of my friends asked me why I didn’t use some kind of Powerbank. There are a couple of reasons:

  1. Handling the power from solar. I need circuitry which is fine with power being strong at one moment, weak at the next and nonexistent in another. I wouldn’t bet on powerbanks being designed to work with solar power. The circuitry is probably designed with a constant supply of current in mind.
  1. Ability to provide power while charging. See Note: Potential Issues of Using a USB Powerbank as a UPS for details.
  1. 24/7 use in mind.
  1. Ability to switch between different power sources. I want to charge it from solar and to switch to the grid if there is not enough sun.
  1. Watchdog. If your battery is low, the server should know about it.

While it is entirely possible that you could just slap powerbank to the Raspberry, and it would work fine, I was not willing to make that bet and I wanted something that was designed for this use.

Component table

Component Price CZK Price $ Price €
Raspberry Pi 4.8GB RAM CZK 4,556.48 188.674120082816 185.072298943948
PiJuice Solar Panel - 40W CZK 4,145.00 171.635610766046 168.359057676686
Verbatim VI560 S3 1TB M.2 SSD CZK 2,179.00 90.227743271222 88.505280259951
PiJuice HAT + CZK 2,052.00 84.968944099379 83.346872461413
Li-Pol PiJuice 12000mAh 1S 3,7V CZK 842.00 34.865424430642 34.199837530463
Suptronics X862 M.2 NGFF SATA SSD Shield CZK 799.00 33.084886128364 32.453290008123
rPI power source CZK 289.00 11.966873706004 11.738424045491
Raspberry Pi RB-Heatsink CZK 82.00 3.395445134576 3.330625507717


Getting most of the components was relatively easy, except for the Raspberry Pi itself, which was sold out here in the Czech Republic in the 8 GB variant (I literally couldn’t find a single eshop which would have them on stock). In the end, I’ve ordered it from German Amazon and paid double the usual price still listed on local eshops. Apparently, there is already a shortage.

Notice, that I’ve also bought a 40W PiJuice solar panel, even though it’s not cheap and the Raspberry Pi consumes only something like 5W. My line of reasoning was simple; I want to overdo the solar part; the bigger, the better. As I mentioned, the Czech Republic doesn’t get much of the sun, and maybe with the bigger panel, it may run the whole night.

<ominous_foreshadowing>Also, the solar panel is sold as a PiJuice component, so it should work as intended, right?</ominous_foreshadowing>

PiJuice comes with a tiny 1820mAh battery, and since the beginning, it was clear that this is not good enough, so I’ve bought the biggest battery I could find (12000mAh). The default battery could theoretically provide roughly 6.7Wh (~1.3 hour of runtime), the one I bought could in theory provide 44.4Wh (~8 hours of runtime).

Assembly

Nothing really complicated, just put things into things until you have one big thing.

Fully assembled with battery, eink display & metalic hex spacers instead of plastic ones which are part of the PiJuice kit.
Test installation to get some measurements.

Ok, so I assembled it, turned it on, and it started running from the battery. Nice. I then formatted the SSD with ext3, assigned it to /home, configured network to static IP address, and installed PiJuice utilities:

sudo apt-get install pijuice-gui pijuice-base

I’ve set it to use micro-USB on the PiJuice hat with higher priority than GPIO, which is connected to the default USB-C input of the Raspberry.

The first disappointment came when I tried to power the solar panel from the lights in my apartment. That didn’t work whatsoever. I decided to wait until the morning and try it again with sun power.

Just for context; it was the middle of summer. The temperatures attacked 35 °C, and it was probably the peak sunlight I could get here.

I was quite surprised when I saw this output from pijuice-cli. This was during the time when the sun was sending deadly lasers into my apartment and I had to run the air-conditioning unit the whole day:

USB Micro power input: BAD? Furthermore, the temperature for the battery is wrong, as I took out the infrared thermometer and found out, that the Raspberry is running at 42 °C and the battery is at 27.8 °C.

The power input status sometimes changes to WEAK, but still, not what I would expect, when the sun is shining directly on the solar panel, in the middle of summer.

Anyway, I’ve ordered a watt meter and did some measurements. This is after approximately 24h and a few minutes (the time on the watt meter actually resets the time counter after one day *facepalm*), with the solar panel connected:

Approximately 100Wh. Okay. And this is after 12 hours with the solar panel disconnected (sadly the picture after 24h was so blurry, I couldn’t use it):

The power consumption is the same with or without solar panel. This is clearly not what I want. Just to confirm it, I decided to first get more measurements:

Comsumption with solar cells

From To kWh Avg power consumption (Wh) Title
0.11 5.084745762712 Untitled
0.033 5.051020408163 Untitled
0.126 5.09777478085 Untitled
0.162 5.129287598945 Untitled


Comsumption without solar cells

From To kWh Avg power consumption (Wh) Title
0.152 5.143824027073 Untitled
0.194 5.107503290917 Untitled
0.526 5.068251164285 Untitled


What. Average 5.09 W with solar cells and 5.1 without them? Something is not right here.

Investigation

I had a few theories:

  1. Solar panels actually don’t provide enough power for PiJuice, so it is deciding it won’t use them.
  1. Some other shenanigans with the solar panels. They have two USB outputs, and one 19V DC jack output. Maybe I am using the wrong USB output? Or I need to use both?
  1. PiJuice is actually ignoring the microUSB input when connected to a GPIO power source (via USB-C on the raspberry).
  1. Some other problems with the PiJuice. Since I’ve upgraded the firmware, it stopped showing the battery temperature correctly, and I wasn’t the only one who had the same issue.

Investigation: Solar panels and the sunlight

Since all I could see in the pijuice_cli was “BAD” and “WEAK” status, I’ve decided that the simplest part of debugging will be just to bring the solar panels outside. Perhaps there is a massive loss because they are inside, and the window glass is blocking most of the power of the sun? Or maybe the angle is wrong and there is some kind of shadow on the panel?

So, I sacrificed one old USB cable and connected it to my multimeter:

It was quite a cloudy, rainy autumn day. The measurement was still clear. If I stay with the solar panel behind glass doors, I get 0.05A (no matter how close I stand behind the glass), if I open the doors and stay directly in the sunlight, I get 0.38A.

So, I fixed the solar panel to the balcony doors at the optimal height, where it is not blocked by the balcony itself.

I could see one change immediately:

USB Micro power input: PRESENT even in late evening. Great. Then I’ve spent a few days by waiting, to gather data points for some more measurements.

Consumption with solar cells outside

From To kWh Avg power consumption (Wh) Note
0.115 4.742268041237 Untitled
0.076 4.338725023787 Untitled
0.041 4.248704663212 During the day.
0.059 4.275362318841 During the night.
0.039 4.341372912801 During the day. Switched back to 2.5A limit.
0.073 4.786885245902 During the night.
0.06 5.157593123209 Untitled


Okay, that seems somewhat promising, but still quite random. For example, sometimes the power consumption is higher during the day than during the night, even though the raspberry was in idle the whole time.

When I saw the randomness of it all, I started to play with other settings in the PiJuice, but it still felt like the solar panels were not working properly.

Investigation 2: Two USB ports on the panel

Meanwhile, I also built a Y cable with two USB male sockets joining the power from the solar panel to one micro USB output:

This works, but since the autumn began here, I didn’t really have the use case. The solar panel is not going above 2A most of the time, and the PiJuice is limiting the power draw to 2.5A anyway.

Investigation 3: PiJuice and power source

Maybe the PiJuice is always using the stronger power source? Even though I’ve manually selected that GPIO input should be disabled, and set Inputs precedence to USB_MICRO.

I’ve decided to see what would happen if I manually disconnected the power source during the day. I had this old power timer device lying around, so I’ve decided to set it to cut the power from 7:00 to 16:00. The battery should hold the rest of the time and the solar panel should have a chance to power the device.

At this point, the stack of power devices (Schuko socket convertor (watt meter is using German standard), watt meter, power timer and adapter) was getting quite bizarre:

One thing I’ve noticed while playing with this is that the GPIO input enable option in the PiJuice basically means “charge battery from USB-C (GPIO)”. Good to know.

Here is some data:

Consumption with solar panel and timer

From To kWh Avg power consumption (Wh) Note
0.087 3.551020408163 Untitled
0.377 4.933478735005 Untitled


As you can see from the first line, in the short term, it seems like it is working. The second line shows that later, when the USB charger goes online and starts charging the battery, it averages out to more or less the same numbers as if it would run without the timer. Charging of the battery took something like 14W. And while the battery was recharging from the sun, it never really got full and the best I’ve seen was something like 70%, after I’ve changed the blackout period from 8:00 to 17:00. It also has a disadvantage, that it wears out the battery.

This means that the theory that the PiJuice is using the power only when the GPIO (USB-C power in) is disconnected is not true because the numbers are on average more or less the same.

Investigation 4: PiJuice

At this point, I was quite convinced that the problem was most probably in the PiJuice itself. So, I’ve decided to dig into the issues on GitHub:

Investigation 5: Solar panel controller

As the #863 hints, there may be a problem with the solar panel controller. It is trying to be smart, and maybe it is deadlocking and not letting the power flow properly when it should.

I wrote a simple script (Github link with .deb package) to monitor the status of the solar panel using the PiJuice API because I wanted to see how the status changes in the long term. Most of the days, it looked like this:

This was somewhat expected. It was the end of December, and the sun was mostly hidden behind the clouds.

I was surprised when I was toying with USB watt meter, connecting and disconnecting various cables, not really finding anything interesting. But when I plugged everything back in, I saw this:

Which shows that the solar was providing enough power for half an hour without any other change than just unplugging and plugging in the cables back.

Conclusion

After all this, I’ve let it run for a few months. Most if not all days looked like this:

Then one day, when I was on home office, I disconnected and connected the solar panels and then disconnected the battery for the rest of the day, and it looked like this:

And this was after a week of the same weather and quite sunny days. So, the conclusion, hmm.

  1. It needs to be restarted. Manually. By disconnecting the cable, and also by shielding the solar panel from the sunlight.
  1. It doesn’t really do what I want it to do (use solar panel as the primary and grid power only when needed).
  1. While it may work sporadically, it's everything but reliable.

It was about time to acknowledge what should have been obvious months ago;

The PiJuice or the solar panel is a piece of 💩, and I am wasting my time, money and life.

This is partially my mistake, but only partially. Sure, it may be that the whole PiJuice is just designed in a way that doesn’t fit my use case. But the whole marketing (especially in eshops where it is sold) is really leading you to believe that it should work. I think the solar panel would be usable for things like temporary charging during a trip, but it doesn’t truly work for continuous operation.

I’ve decided to look into more .. professional solution, not based on the raspberry shields and not using toy 5V USB solar panels, so you can expect another blogpost in a few months. Think 12/24V solar panels, MPPT charge controllers and bigger batteries.

You can read about it in the next blogpost: SolarPi experiment 2: Finally something that works.

Relevant discussions

Become a Patron