I created a git repository for the code I wrote to automate the management of my solar-powered web server. It’s available at Codeberg here: SolarPi.
I’ve included a schematic of the connections between the ATmega328P microcontroller and the other components in the system.
The microcontroller does a few things:
- Monitors the charge status of the battery
- Based on battery charge, sends shutdown or boot commands to the Raspberry Pi web server
- Controls the power to the web server
So a typical cycle would be:
- Check battery charge level
- Battery charge is low, send shutdown command to Raspberry Pi web server
- Wait for Raspberry Pi to shut down
- Cut off power to the Raspberry Pi
- Check battery charge level… when high enough reverse the cycle: turn on power, send boot signal to Pi
- Enter sleep mode when not receiving any signal, to save energy
The ATmega328P may not be the latest and greatest thing… I bought a couple of ‘bare-bones’ Arduino kits some years ago exactly for projects like this. I used one of them straight away for another small solar project which I will write about another time. The other one sat around until this project was ready to exist. Since I bought the kits, the seller has gone of out of business, so their documentation is now only available via archive.org, here and here.
If you have any questions, feel free to ask me on Fediverse.