Solar Pi
• ~600 words • 3 minute read
This weekend I cobbled together all the pieces to debut a truly MVP version of what I'm dubbing Solar Pi:
It's a solar-powered website! Please give it a spin.
There's not a lot there at the moment. It's quite meta, mostly reporting on how it's doing, the current weather and speculating about how well it's going to fare over the coming week.
You might be wondering where I'm hosting this. Some forward-thinking, renewable-energy focused colocation startup in Brooklyn perhaps?
Oh my goodness, no.
The machine is just a Raspberry Pi Zero sitting outside on my terrace, shielded from the elements inside a cute little potting table, connected to a portable charger which is being kept alive by a small solar panel.
I was inspired by Low-tech Magazine many years ago and finally got around to taking my own crack at the idea.
Here are some fun details about how it works:
- The server is Caddy and I'm using a Cloudflare Tunnel to connect it to my domain and expose it to the internet.
- The page is generated by a bash script that makes several vcgencmd calls (among others) to try and get a read on the health of the system.
- I'm using the National Weather Service API to pull forecast and recent data from the closet weather station to me. This was kind of fun!
- I have another little computer hanging around that's periodically pinging the site to make sure it's still around. This is where the uptime metric is coming from.
- It's a bit of a gimmick, but I couldn't resist piping the diagnostic and weather data into a could of LLM calls to generate a high-level summary of how it's faring and likely to fare. Yes, even my garden computer is not safe from AI.
- The whole web page is generated from a single bash script that outputs Markdown and pipes it into pandoc, of all things. I've been on a real pandoc kick lately.
Here are some ideas about what I'd like to do next:
- Figure out a more sophisticated battery situation.
- The current setup works, but I have no way of knowing how low the battery is short of walking out there and checking or noticing that the Solar Pi is starting to throttle.
- It's actually a little dangerous for the Pi. Although I've pulled the power cable directly out of my Pis enough times to feel comfortable with the risk, gracefully powering the thing down is safer.
- There are a lot of options here: I could buy a fancier power bank possibly with Bluetooth connectivity that would let me programmatically monitor the battery status. I could also buy a cheap USB multimeter or a battery gauge. I haven't quite decided yet.
- If I can build something that monitors the battery health I can power cycle the Solar Pi to try and conserve energy.
- Think about how to hyper-optimize the content being served to further reduce energy consumption. Is it more energy-efficient to serve a Brotli-compressed 1kb page or an uncompressed 2kb page? I know which one is faster but does that always translate to energy efficiency? I'm not sure!
- Setup fun little sensors to build my own little weather station right outside my door. Or maybe take a photo of the sunsets over downtow Brooklyn?
- Build a cold frame greenhouse next to the table, buy more sensors and have the machine monitor my little outdoor garden?
- Further inspired by the Low-tech Magazine, maybe I write content and post it there, but in a way that's distinctly separate from my blog.
- Make it more of an interactive art project, encouraging people to post or share things there, but not back anything up and lean?
I'll try to write a follow-up soon that's more instructional and include photos and code!