<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Raspberry Pi</title>
    <description>Dries Buytaert on Raspberry Pi.</description>
    <link>https://dri.es/tag/raspberry-pi</link>
    <atom:link href="https://dri.es/tag/raspberry-pi/rss.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>My website is snowed in</title>
      <link>https://dri.es/my-website-is-snowed-in</link>
      <guid>https://dri.es/my-website-is-snowed-in</guid>
      <pubDate>Sun, 28 Dec 2025 05:53:49 -0500</pubDate>
      <description><![CDATA[<p>My <a href="https://dri.es/my-solar-powered-and-self-hosted-website">solar-powered website</a> just crossed 500 days of uptime. It took the biggest snowstorm in nearly three years to put that streak at risk.</p>
<p>Winter storm Devin is burying the Northeast of the United States right now. There is over five inches of snow in Boston. Thousands of flights are cancelled, thousands more delayed.</p>
<p>I'm writing this from Schiphol airport in Amsterdam, my own flight home delayed. I can't see whether the solar panel on our roof deck is buried in snow or still catching a little light. All I can do is watch <a href="https://dri.es/sensors/solar">my solar dashboard</a> from across the ocean and wait.</p>
<figure><img src="https://dri.es/files/images/blog/snowed-in-website.png" alt="A grid of hourly battery levels shows green squares fading to red over recent days." width="1184" height="732" />
<figcaption>The view from Schiphol airport.</figcaption>
</figure>
<p>The dashboard says the battery is below 15%. It's still night in Boston and well below freezing. Even when the sun comes up, the charge controller won't recharge the battery if it is too cold.</p>
<p>When I <a href="https://dri.es/my-solar-powered-and-self-hosted-website">started this experiment</a>, I wrote that some downtime for some websites should be acceptable. I questioned why we obsess over 99.9% uptime for personal websites that don't need it.</p>
<p>The irony isn't lost on me: I wrote that downtime is fine, but I've refreshed the dashboard three times while writing this.</p>
<p>My website might go down, or it might stay up. Either way, I love that it will come back on its own whenever the sun breaks through. Both of us waiting for the weather to clear. Me at the airport and the Raspberry Pi under a snowy roof in Boston.</p>
<p><strong>Update, December 30:</strong>  The bad weather won. After more than 500 days of uptime, the battery drained, and my solar-powered website went offline. Friends noticed before I did and began sending jokes and memes. My favorite was a fake newspaper calling my solar panel one of the great disasters of 2025.</p>
<p>But this morning, the sun came back and so did my site. It is oddly satisfying to see something fail gracefully and recover on its own. That was the point of the experiment. The audience was a nice bonus.</p>
]]></description>
    </item>
    <item>
      <title>Keeping your Raspberry Pi online with watchdogs</title>
      <link>https://dri.es/keeping-your-raspberry-pi-online-with-watchdogs</link>
      <guid>https://dri.es/keeping-your-raspberry-pi-online-with-watchdogs</guid>
      <pubDate>Wed, 05 Mar 2025 16:48:25 -0500</pubDate>
      <description><![CDATA[<p>A while back, I built a <a href="https://dri.es/my-solar-powered-and-self-hosted-website">solar-powered, self-hosted website</a>. Running a website entirely on renewable energy felt like a win, until my Raspberry Pi Zero 2 W started <em>ghosting</em> me.</p>
<figure><img src="https://dri.es/files/cache/miscellaneous-2024/solar-panel-on-roofdeck-1280w.jpg" alt="A solar panel on a rooftop during sunset with a city skyline in the background." width="1280" height="850" />
<figcaption>My solar panel and Raspberry Pi Zero 2 are set up on our rooftop deck for testing.</figcaption>
</figure>
<p>Every few weeks, it just disappears from the network: no ping, no SSH. Completely unreachable, yet the power LED stays on. The SD card has plenty of free space.</p>
<p>The solar panel and battery aren't the problem either. In fact, <a href="https://dri.es/sensors/solar">my solar dashboard</a> shows they've been running for 215 days straight. Not a glitch.</p>
<p>Every time my Raspberry Pi goes offline, I have to go through the same frustrating ritual: get on the roof, open the waterproof enclosure, disconnect the Pi, pull the SD card, go to my office, reformat it, reinstall the OS and reconfigure everything. Then climb back up and put everything back together.</p>
<figure><img src="https://dri.es/files/cache/blog/raspberry-pi-4-enclosure-1280w.jpg" alt="A Raspberry Pi 4 with an RS485 CAN HAT in a waterproof enclosure, surrounded by cables, screws and components." width="1280" height="850" />
<figcaption>A Raspberry Pi 4 with an attached RS485 CAN HAT module is being installed in a waterproof enclosure.</figcaption>
</figure>
<p>A month ago, I was back on the roof deck, battling Boston winter. My fingers were numb, struggling with tiny screws and connectors. This had to stop.</p>
<p>The Raspberry Pi Zero 2 W is a great device for IoT projects, but only if it can run unattended for years.</p>
<h2>Watchdogs: a safety net for when things go wrong</h2>
<p>Enter <strong>watchdogs</strong>: tools that detect failures and trigger automatic reboots. There are two types:</p>
<ol>
<li><strong>Hardware watchdog</strong> – Recovers from <strong>system-wide freezes</strong> like kernel panics or hardware lockups, by forcing a low-level reset.</li>
<li><strong>Software watchdog</strong> – Detects and fixes <strong>service-level failures</strong>, such as lost network connectivity, high CPU load or excessive RAM usage.</li>
</ol>
<p>Running both ensures the Raspberry Pi can recover from minor issues (like a dropped connection) and system crashes (where everything becomes unresponsive).</p>
<h2>Hardware watchdog</h2>
<p>The hardware watchdog is a timer built into the Raspberry Pi's Broadcom chip. The operating system must reset or <em>pet</em> the timer regularly. If it fails to do so within a set interval, the watchdog assumes the system has frozen and forces a reboot.</p>
<p>Since support for the hardware watchdog is built into the Raspberry Pi's Linux kernel, it simply needs to be enabled.</p>
<p>Edit <code>/etc/systemd/system.conf</code> and add:</p>
<pre><code class="language-shell"> RuntimeWatchdogSec=10s
ShutdownWatchdogSec=10min
</code></pre>
<ul>
<li><code>RuntimeWatchdogSec</code> – Defines how often the watchdog must be reset. On the Raspberry Pi, this must be less than 15–20 seconds due to hardware constraints.</li>
<li><code>ShutdownWatchdogSec</code> – Keeps the watchdog active during shutdown to detect hangs.</li>
</ul>
<p>Restart <code>systemd</code> to activate the watchdog:</p>
<pre><code class="language-shell"> $ sudo systemctl daemon-reexec
</code></pre>
<p>Once restarted, <code>systemd</code> starts petting the hardware watchdog timer. If it ever fails, the Raspberry Pi will reboot.</p>
<p>To ensure full recovery, set all critical services to restart automatically. For example, my web server starts by itself, bringing <a href="https://solar.dri.es/">my solar-powered website</a> back online without any manual work.</p>
<h2>Software watchdog</h2>
<p>The hardware watchdog catches complete system freezes, while the software watchdog monitors network connectivity, CPU load and other metrics.</p>
<p>To install the software watchdog:</p>
<pre><code class="language-shell">$ sudo apt update
$ sudo apt install watchdog
</code></pre>
<p>Next, edit <code>/etc/watchdog.conf</code> and add the following settings:</p>
<pre><code class="language-shell"># Network monitoring
ping = 8.8.8.8
ping = 1.1.1.1
ping-count = 5

# Interface monitoring
interface = wlan0

# Basic settings
watchdog-device = none
retry-timeout = 180
realtime = yes
interval = 20
</code></pre>
<p>What this does:</p>
<ul>
<li><code>ping = 8.8.8.8 / ping = 1.1.1.1</code> – Checks that the Pi can reach Google (8.8.8.8) and Cloudflare (1.1.1.1).</li>
<li><code>interface = wlan0</code> – Ensures the Wi-Fi interface is active.</li>
<li><code>retry-timeout = 180</code> – Reboots the Pi if these checks fail for 180 seconds.</li>
<li><code>interval = 20</code> – Performs checks every 20 seconds.</li>
<li><code>watchdog-device = none</code> – Instead of using the hardware watchdog, the daemon monitors failures and triggers a software reboot through the operating system.</li>
</ul>
<p>While I'm just monitoring the network, you can also configure the watchdog to check CPU usage, RAM or other system health metrics.</p>
<p>Once configured, enable and start the watchdog service:</p>
<pre><code class="language-shell">$ sudo systemctl enable watchdog
$ sudo systemctl start watchdog
</code></pre>
<p><em>Enabling</em> the watchdog makes sure it launches automatically on every boot, while <em>starting</em> it activates it immediately without requiring a restart.</p>
<h2>Debugging watchdog reboots</h2>
<p>When a watchdog triggers a reboot, system logs can help uncover what went wrong. To view all recent system boots, run:</p>
<pre><code class="language-shell">$ journalctl --list-boots
</code></pre>
<p>This will display a list of boot sessions, each with an index (e.g. <code>-1</code> for the previous boot, <code>-2</code> for the one before that).</p>
<p>To see all shutdown events and their reason, run:</p>
<pre><code class="language-shell">$ journalctl --no-pager | grep &quot;shutting down the system&quot;
</code></pre>
<p>If you want more details, you can check the logs leading up to a specific reboot. The following command displays the last 50 log entries immediately before the last system shutdown:</p>
<pre><code class="language-shell">$ journalctl -b -1 -n 50 --no-pager
</code></pre>
<ul>
<li><code>-b -1</code> – Retrieves logs from the previous boot.</li>
<li><code>-n 50</code> – Displays the last 50 log entries before that reboot.</li>
<li><code>--no-pager</code> – Prevents logs from being paginated.</li>
</ul>
<h2>Progress, but the mystery remains</h2>
<p>Since installing these watchdogs, my Raspberry Pi has remained accessible. It has not gone offline indefinitely. Fingers crossed it stays that way.</p>
<p>My logs show the software watchdog reboots the system regularly. It always reboots due to lost network connectivity.</p>
<p>While the watchdog is working as intended, the real mystery remains: why does the network keep failing and leave the Raspberry Pi in an unrecoverable state?</p>
<p>Still, this is real progress. I no longer have to climb onto the roof in freezing weather. The system recovers on its own, even when I'm away from home.</p>
]]></description>
    </item>
    <item>
      <title>My solar-powered and self-hosted website</title>
      <link>https://dri.es/my-solar-powered-and-self-hosted-website</link>
      <guid>https://dri.es/my-solar-powered-and-self-hosted-website</guid>
      <pubDate>Tue, 15 Oct 2024 15:43:10 -0400</pubDate>
      <description><![CDATA[<p>I'm excited to share an experiment I've been working on: a solar-powered, self-hosted website running on a Raspberry Pi. The website at <a href="https://solar.dri.es">https://solar.dri.es</a> is powered entirely by a solar panel and battery on our roof deck in Boston.</p>
<figure><img src="https://dri.es/files/cache/miscellaneous-2024/solar-panel-on-roofdeck-1280w.jpg" alt="A solar panel on a rooftop during sunset with a city skyline in the background." width="1280" height="850" />
<figcaption>My solar panel and Raspberry Pi Zero 2 are set up on our rooftop deck for testing.</figcaption>
</figure>
<p>By visiting <a href="https://solar.dri.es">https://solar.dri.es</a>, you can dive into all the technical details and lessons learned – from hardware setup to networking configuration and custom monitoring.</p>
<p>As the content on this solar-powered site is likely to evolve or might even disappear over time, I've included the full article below (with minor edits) to ensure that this information is preserved.</p>
<p>Finally, you can view the real-time status of my solar setup on my <a href="https://dri.es/sensors/solar">solar panel dashboard</a>, hosted on my main website. This dashboard stays online even when my solar-powered setup goes offline.</p>
<h2>Background</h2>
<p>For over two decades, I've been deeply involved in web development. I've worked on everything from simple websites to building and managing some of the internet's largest websites. I've helped create a hosting business that uses thousands of EC2 instances, handling billions of page views every month. This platform includes the latest technology: cloud-native architecture, Kubernetes orchestration, auto-scaling, smart traffic routing, geographic failover, self-healing, and more.</p>
<p>This project is the complete opposite. It's a hobby project focused on sustainable, solar-powered self-hosting. The goal is to use the smallest, most energy-efficient setup possible, even if it means the website goes offline sometimes. Yes, this site may go down on cloudy or cold days. But don't worry! When the sun comes out, the website will be back up, powered by sunshine.</p>
<p>My primary website, <a href="https://dri.es/">https://dri.es</a>, is reliably hosted on <a href="https://www.acquia.com">Acquia</a>, and I'm very happy with it. However, if this solar-powered setup proves stable and efficient, I might consider moving some content to solar hosting. For instance, I could keep the most important pages on traditional hosting while transferring less essential content – like <a href="https://dri.es/photos">my 10,000 photos</a> – to a solar-powered server.</p>
<h2>Why am I doing this?</h2>
<p>This project is driven by my curiosity about making websites and web hosting more environmentally friendly, even on a small scale. It's also a chance to explore a local-first approach: to show that hosting a personal website on your own internet connection at home can often be enough for small sites. This aligns with my commitment to both the <a href="https://dri.es/tag/open-web">Open Web</a> and the <a href="https://indieweb.org/">IndieWeb</a>.</p>
<p>At its heart, this project is about learning and contributing to a conversation on a greener, local-first future for the web. Inspired by solar-powered sites like <a href="https://solar.lowtechmagazine.com/">LowTech Magazine</a>, I hope to spark similar ideas in others. If this experiment inspires even one person in the web community to rethink hosting and sustainability, I'll consider it a success.</p>
<h2>Solar panel and battery</h2>
<p>The heart of my solar setup is a 50-watt panel from <a href="https://voltaicsystems.com/">Voltaic</a>, which captures solar energy and delivers 12-volt output. I store the excess power in an 18 amp-hour Lithium Iron Phosphate (LFP or LiFePO4) battery, also from Voltaic.</p>
<div class="large">
  <figure><img src="https://dri.es/files/cache/miscellaneous-2024/first-solar-panel-test-1280w.jpg" alt="A solar panel being tested on a laundry room floor." width="1280" height="850" />
<figcaption>A solar panel being tested on the floor in our laundry room. Upon connecting it, it started charging a battery right away. It feels truly magical. Of course, it won't stay in the laundry room forever so stay tuned for more ...</figcaption>
</figure>
</div>
<p>I'll never forget the first time I plugged in the solar panel – it felt like pure magic. Seeing the battery spring to life, powered entirely by sunlight, was an exhilarating moment that is hard to put into words. And yes, all this electrifying excitement happened right in our laundry room.</p>
<div class="large">
  <figure><img src="https://dri.es/files/cache/blog/18ah-battery-1280w.jpg" alt="A large battery, the size of a loaf of bread, with a solar panel in the background." width="1280" height="850" />
<figcaption>A 18Ah LFP battery from Voltaic, featuring a waterproof design and integrated MPPT charge controller. The battery is large and heavy, weighing 3kg (6.6lbs), but it can power a Raspberry Pi for days.</figcaption>
</figure>
</div>
<p>Voltaic's battery system includes a built-in charge controller with Maximum Power Point Tracking (MPPT) technology, which regulates the solar panel's output to optimize battery charging. In addition, the MPPT controller protects the battery from overcharging, extreme temperatures, and short circuits.</p>
<p>A key feature of the charge controller is its ability to stop charging when temperatures fall below 0°C (32°F). This preserves battery health, as charging in freezing conditions can damage the battery cells. As I'll discuss in the <a href="#next-steps">Next steps</a> section, this safeguard complicates year-round operation in Boston's harsh winters. I'll likely need a battery that can charge in colder temperatures.</p>
<figure><img src="https://dri.es/files/cache/blog/12v-to-5v-converter-1-1280w.jpg" alt="A 12V to 5V voltage converter in a waterproof metal box the size of a matchbox, placed on a gridded mat." width="1280" height="850" />
<figcaption>The 12V to 5V voltage converter used to convert the 12V output from the solar panel to 5V for the Raspberry Pi.</figcaption>
</figure>
<p>I also encountered a voltage mismatch between the 12-volt solar panel output and the Raspberry Pi's 5-volt input requirement. Fortunately, this problem had a more straightforward solution. I solved this using a <a href="https://en.wikipedia.org/wiki/Buck_converter">buck converter</a> to step down the voltage. While this conversion introduces some energy loss, it allows me to use a more powerful solar panel.</p>
<h2>Raspberry Pi models</h2>
<p>This website is currently hosted on a <a href="https://www.raspberrypi.com/">Raspberry Pi Zero 2 W</a>. The main reason for choosing the Raspberry Pi Zero 2 W is its energy efficiency. Consuming just 0.4 watts at idle and up to 1.3 watts under load, it can run on my battery for about a week. This decision is supported by a mathematical uptime model, detailed in <a href="#sizing-raspberry-pi-zero-2">Appendix 1</a>.</p>
<p>That said, the Raspberry Pi Zero 2 W has limitations. Despite its quad-core 1 GHz processor and 512 MB of RAM, it may still struggle with handling heavier website traffic. For this reason, I also considered the Raspberry Pi 4. With its 1.5 GHz quad-core ARM processor and 4 GB of RAM, the Raspberry Pi 4 can handle more traffic. However, this added performance comes at a cost: the Pi 4 consumes roughly five times the power of the Zero 2 W. As shown in <a href="#sizing-raspberry-pi-4">Appendix 2</a>, my 50W solar panel and 18Ah battery setup are likely insufficient to power the Raspberry Pi 4 through Boston's winter.</p>
<p>With a single-page website now live on <a href="https://solar.dri.es">https://solar.dri.es</a>, I'm actively monitoring the real-world performance and uptime of a solar-powered Raspberry Pi Zero 2 W. For now, I'm using the lightest setup that I have available and will upgrade only when needed.</p>
<h2>Networking</h2>
<p>The Raspberry Pi's built-in Wi-Fi is perfect for our outdoor setup. It wirelessly connects to our home network, so no extra wiring was needed.</p>
<p>I want to call out that my router and Wi-Fi network are not solar-powered; they rely on my existing network setup and conventional power sources. So while the web server itself runs on solar power, other parts of the delivery chain still depend on traditional energy.</p>
<p>Running this website on my home internet connection also means that if my ISP or networking equipment goes down, so does the website – there is no failover in place.</p>
<p>For security reasons, I isolated the Raspberry Pi in its own Virtual Local Area Network (VLAN). This ensures that even if the Pi is compromised, the rest of our home network remains protected.</p>
<p>To make the solar-powered website accessible from the internet, I configured port forwarding on our router. This directs incoming web traffic on port 80 (HTTP) and port 443 (HTTPS) to the Raspberry Pi, enabling external access to the site.</p>
<p>One small challenge was the dynamic nature of our IP address. ISPs typically do not assign fixed IP addresses, meaning our IP address changes from time to time. To keep the website accessible despite these IP address changes, I wrote a small script that looks up our public IP address and updates the DNS record for <code>solar.dri.es</code> on Cloudflare. This script runs every 10 minutes via a cron job.</p>
<p>I use <a href="https://developers.cloudflare.com/dns/manage-dns-records/reference/proxied-dns-records/">Cloudflare's DNS proxy</a>, which handles DNS and offers basic DDoS protection. However, I do <em>not</em> use Cloudflare's caching or CDN features, as that would somewhat defeat the purpose of running this website on solar power and keeping it local-first.</p>
<p>The Raspberry Pi uses <a href="https://caddyserver.com/">Caddy</a> as its web server, which automatically obtains SSL certificates from <a href="https://letsencrypt.org/">Let's Encrypt</a>. This setup ensures secure, encrypted HTTP connections to the website.</p>
<h2>Monitoring and dashboard</h2>
<figure><img src="https://dri.es/files/cache/blog/raspberry-pi-4-and-rs485-can-hat-1280w.jpg" alt="A Raspberry Pi 4 and an RS485 CAN HAT next to each other." width="1280" height="850" />
<figcaption>The Raspberry Pi 4 (on the left) can run a website, while the RS485 CAN HAT (on the right) will communicate with the charge controller for the solar panel and battery.</figcaption>
</figure>
<p>One key feature that influenced my decision to go with the Voltaic battery is its <a href="https://en.wikipedia.org/wiki/RS-485">RS485 interface</a> for the charge controller. This allowed me to add an RS485 CAN HAT (Hardware Attached on Top) to the Raspberry Pi, enabling communication with the charge controller using the <a href="https://en.wikipedia.org/wiki/Modbus">Modbus protocol</a>. In turn, this enabled me to programmatically gather real-time data on the solar panel's output and battery's status.</p>
<p>I collect data such as battery capacity, power output, temperature, uptime, and more. I send this data to my main website via a web service API, where it's displayed on a <a href="https://dri.es/sensors/solar">dashboard</a>. This setup ensures that key information remains accessible, even if the Raspberry Pi goes offline.</p>
<p>My main website runs on <a href="https://www.drupal.org/">Drupal</a>. The dashboard is powered by a custom module I developed. This module adds a web service endpoint to handle authentication, validate incoming JSON data, and store it in a MariaDB database table. Using the historical data stored in MariaDB, the module generates Scalable Vector Graphics (SVGs) for the dashboard graphs. For more details, check out my post on <a href="https://dri.es/building-my-own-temperature-and-humidity-monitor">building a temperature and humidity monitor</a>, which explains a similar setup in much more detail. Sure, I could have used a tool like <a href="https://grafana.com/">Grafana</a>, but sometimes building it yourself is part of the fun.</p>
<figure><img src="https://dri.es/files/cache/blog/raspberry-pi-4-enclosure-1280w.jpg" alt="A Raspberry Pi 4 with an RS485 CAN HAT in a waterproof enclosure, surrounded by cables, screws and components." width="1280" height="850" />
<figcaption>A Raspberry Pi 4 with an attached RS485 CAN HAT module is being installed in a waterproof enclosure.</figcaption>
</figure>
<p>For more details on the charge controller and some of the issues I've observed, please refer to <a href="#lumiax-observations">Appendix 3</a>.</p>
<h2>Energy use, cost savings, and environmental impact</h2>
<p>When I started this solar-powered website project, I wasn't trying to revolutionize sustainable computing or drastically cut my electricity bill. I was driven by curiosity, a desire to have fun, and a hope that my journey might inspire others to explore local-first or solar-powered hosting.</p>
<p>That said, let's break down the energy consumption and cost savings to get a better sense of the project's impact.</p>
<p>The tiny Raspberry Pi Zero 2 W at the heart of this project uses just 1 Watt on average. This translates to 0.024 kWh daily (1W * 24h / 1000 = 0.024 kWh) and approximately 9 kWh annually (0.024 kWh * 365 days = 8.76 kWh). The cost savings? Looking at our last electricity bill, we pay an average of $0.325 per kWh in Boston. This means the savings amount to $2.85 USD per year (8.76 kWh * $0.325/kWh = $2.85). Not exactly something to write home about.</p>
<p>The environmental impact is similarly modest. Saving 9 kWh per year reduces CO2 emissions by roughly 4 kg, which is about the same as driving 16 kilometers (10 miles) by car.</p>
<p>There are two ways to interpret these numbers. The pessimist might say that the impact of my solar setup is negligible, and they wouldn't be wrong. Offsetting the energy use of a Raspberry Pi Zero 2, which only draws 1 Watt, will never be game-changing. The $2.85 USD saved annually won't come close to covering the cost of the solar panel and battery. In terms of efficiency, this setup isn't a win.</p>
<p>But the optimist in me sees it differently. When you compare my solar-powered setup to traditional website hosting, a more compelling case emerges. Using a low-power Raspberry Pi to host a basic website, rather than large servers in energy-hungry data centers, can greatly cut down on both expenses and environmental impact. Consider this: a Raspberry Pi Zero 2 W costs just $15 USD, and I can power it with main power for only $0.50 USD a month. In contrast, traditional hosting might cost around $20 USD a month. Viewed this way, my setup is both more sustainable and economical, showing some merit.</p>
<p>Lastly, it's also important to remember that solar power isn't just about saving money or cutting emissions. In remote areas without grid access or during disaster relief, solar can be the only way to keep communication systems running. In a crisis, a small solar setup could make the difference between isolation and staying connected to essential information and support.</p>
<h2>Why do so many websites need to stay up?</h2>
<p>The reason the energy savings from my solar-powered setup won't offset the equipment costs is that the system is intentionally oversized to keep the website running during extended low-light periods. Once the battery reaches full capacity, any excess energy goes to waste. That is unfortunate as that surplus could be used, and using it would help offset more of the hardware costs.</p>
<p>This inefficiency isn't unique to solar setups – it highlights a bigger issue in web hosting: over-provisioning. The web hosting world is full of mostly idle hardware. Web hosting providers often allocate more resources than necessary to ensure high uptime or failover, and this comes at an environmental cost.</p>
<p>One way to make web hosting more eco-friendly is by allowing <em>non-essential</em> websites to experience more downtime, reducing the need to power as much hardware. Of course, many websites are critical and need to stay up 24/7 – my own work with <a href="https://www.acquia.com/">Acquia</a> is dedicated to ensuring essential sites do just that. But for non-critical websites, allowing some downtime could go a long way in conserving energy.</p>
<p>It may seem unconventional, but I believe it's worth considering: many websites, mine included, aren't mission-critical. The world won't end if they occasionally go offline. That is why I like the idea of hosting <a href="https://dri.es/photos">my 10,000 photos</a> on a solar-powered Raspberry Pi.</p>
<p>And maybe that is the real takeaway from this experiment so far: to question why our websites and hosting solutions have become so resource-intensive and why we're so focused on keeping non-essential websites from going down. Do we really need 99.9% uptime for <em>personal</em> websites? I don't think so.</p>
<p>Perhaps the best way to make the web more sustainable is to accept more downtime for those websites that aren't critical. By embracing occasional downtime and intentionally under-provisioning non-essential websites, we can make the web a greener, more efficient place.</p>
<div class="large">
  <figure><img src="https://dri.es/files/cache/blog/mounted-solar-panel-1280w.jpg" alt="A solar panel and battery mounted securely on a roof deck railing." width="1280" height="850" />
<figcaption>The solar panel and battery mounted on our roof deck.</figcaption>
</figure>
</div>
<h3 id="next-steps">Next steps</h3>
<p>As I continue this experiment, my biggest challenge is the battery's inability to charge in freezing temperatures. As explained, the battery's charge controller includes a safety feature that prevents charging when the temperature drops below freezing. While the Raspberry Pi Zero 2 W can run on my fully charged battery for about six days, this won't be sufficient for Boston winters, where temperatures often remain below freezing for longer.</p>
<p>With winter approaching, I need a solution to charge my battery in extreme cold. Several options to consider include:</p>
<ol>
<li>Adding a battery heating system that uses excess energy during peak sunlight hours.</li>
<li>Applying insulation, though this alone may not suffice since the battery generates minimal heat.</li>
<li>Replacing the battery with one that charges at temperatures as low as -20°C (-4°F), such as Lithium Titanate (LTO) or certain AGM lead-acid batteries. However, it's not as simple as swapping it out – my current battery has a built-in charge controller, so I'd likely need to add an external charge controller, which would require rewiring the solar panel and updating my monitoring code.</li>
</ol>
<p>Each solution has trade-offs in cost, safety, and complexity. I'll need to research the different options carefully to ensure safety and reliability.</p>
<p>The last quarter of the year is filled with travel and other commitments, so I may not have time to implement a fix before freezing temperatures hit. With some luck, the current setup might make it through winter. I'll keep monitoring performance and uptime – and, as mentioned, a bit of downtime is acceptable and even part of the fun! That said, the website may go offline for a few weeks and restart after the harshest part of winter. Meanwhile, I can focus on other aspects of the project.</p>
<p>For example, I plan to expand this single-page site into one with hundreds or even thousands of pages. Here are a few things I'd like to explore:</p>
<ol>
<li><strong>Testing Drupal on a Raspberry Pi Zero 2 W:</strong> As the founder and project lead of <a href="https://drupal.org/">Drupal</a>, my main website runs on Drupal. I'm curious to see if Drupal can actually run on a Raspberry Pi Zero 2 W. The answer might be &quot;probably not&quot;, but I'm eager to try.</li>
<li><strong>Upgrading to a Raspberry Pi 4 or 5:</strong> I'd like to experiment with upgrading to a Raspberry Pi 4 or 5, as I know it could run Drupal. As noted in <a href="#sizing-raspberry-pi-4">Appendix 2</a>, this might push the limits of my solar panel and battery. There are some optimization options to explore though, like disabling CPU cores, lowering the RAM clock speed, and dynamically adjusting features based on sunlight and battery levels.</li>
<li><strong>Creating a static version of my site:</strong> I'm interested in experimenting with a static version of <a href="https://dri.es">https://dri.es</a>. A static site doesn't require PHP or MySQL, which would likely reduce resource demands and make it easier to run on a Raspberry Pi Zero 2 W. However, dynamic features like <a href="https://dri.es/sensors/solar">my solar dashboard</a> depend on PHP and MySQL, so I'd potentially need alternative solutions for those. Tools like <a href="https://www.drupal.org/project/tome">Tome</a> and <a href="https://www.drupal.org/project/quantcdn">QuantCDN</a> offer ways to generate static versions of Drupal sites, but I've never tested these myself. Although I prefer keeping my site dynamic, creating a static version also aligns with my interests in digital preservation and archiving, offering me a chance to delve deeper into these concepts.</li>
</ol>
<p>Either way, it looks like I'll have some fun ahead. I can explore these ideas from my office while the Raspberry Pi Zero 2 W continues running on the roof deck. I'm open to suggestions and happy to share notes with others interested in similar projects. If you'd like to stay updated on my progress, you can <a href="https://dri.es/subscribe">sign up to receive new posts by email</a> or <a href="https://dri.es/rss.xml">subscribe via RSS</a>. Feel free to email me at <a href="mailto:dries@buytaert.net">dries@buytaert.net</a>. Your ideas, input, and curiosity are always welcome.</p>
<h2>Appendix</h2>
<h3 id="sizing-raspberry-pi-zero-2">Appendix 1: Sizing a solar panel and battery for a Raspberry Pi Zero 2 W</h3>
<p>To keep the Raspberry Pi Zero 2 W running in various weather conditions, we need to estimate the ideal solar panel and battery size. We'll base this on factors like power consumption, available sunlight, and desired uptime.</p>
<p>The Raspberry Pi Zero 2 W is very energy-efficient, consuming only 0.4W at idle and up to 1.3W under load. For simplicity, we'll assume an average power consumption of 1W, which totals 24Wh per day (1W * 24 hours).</p>
<p>We also need to account for energy losses due to inefficiencies in the solar panel, charge controller, battery, and inverter. Assuming a total loss of 30%, our estimated daily energy requirement is 24Wh / 0.7 ≈ 34.3Wh.</p>
<p>In Boston, <em>peak sunlight</em> varies throughout the year, averaging 5-6 hours per day in summer (June-August) and only 2-3 hours per day in winter (December-February). Peak sunlight refers to the strongest, most direct sunlight hours. Basing the design on peak sunlight hours rather than total daylight hours provides a margin of safety.</p>
<p>To produce 34.3Wh in the winter, with only 2 hours of peak sunlight, the solar panel should generate about 17.15W (34.3Wh / 2 hours ≈ 17.15W). As mentioned, my current setup includes a 50W solar panel, which provides well above the estimated 17.15W requirement.</p>
<p>Now, let's look at battery sizing. As explained, I have an 18Ah battery, which provides about 216Wh of capacity (18Ah * 12V = 216Wh). If there were no sunlight at all, this battery could power the Raspberry Pi Zero 2 W for roughly 6 days (216Wh / 34.3Wh per day ≈ 6.3 days), ensuring continuous operation even on snowy winter days.</p>
<p>These estimates suggest that I could halve both my 50W solar panel and 18Ah battery to a 25W panel and a 9Ah battery, and still meet the Raspberry Pi Zero 2 W's power needs during Boston winters. However, I chose the 50W panel and larger battery for flexibility, in case I need to upgrade to a more powerful board with higher energy requirements.</p>
<h3 id="sizing-raspberry-pi-4">Appendix 2: Sizing a solar panel and battery for a Raspberry Pi 4</h3>
<p>If I need to switch to a Raspberry Pi 4 to handle increased website traffic, the power requirements will rise significantly. The Raspberry Pi 4 consumes around 3.4W at idle and up to 7.6W under load. For estimation purposes, I'll assume an average consumption of 4.5W, which totals 108Wh per day (4.5W * 24 hours = 108Wh).</p>
<p>Factoring in a 30% loss due to system inefficiencies, the adjusted daily energy requirement increases to approximately 154.3Wh (108Wh / 0.7 ≈ 154.3Wh). To meet this demand during winter, with only 2 hours of peak sunlight, the solar panel would need to produce about 77.15W (154.3Wh / 2 hours ≈ 77.15W).</p>
<p>While some margin of safety is built into my calculations, this likely means my current 50W solar panel and 216Wh battery are insufficient to power a Raspberry Pi 4 during a Boston winter.</p>
<p>For example, with an average power draw of 4.5W, the Raspberry Pi 4 requires 108Wh daily. In winter, if the solar panel generates only 70 to 105Wh per day, there would be a shortfall of 3 to 38Wh each day, which the battery would need to cover. And with no sunlight at all, a fully charged 216Wh battery would keep the system running for about 2 days (216Wh / 108Wh per day ≈ 2 days) before depleting.</p>
<p>To ensure reliable operation, a 100W solar panel, capable of generating enough power with just 2 hours of winter sunlight, paired with a 35Ah battery providing 420Wh, could be better. This setup, roughly double my current capacity, would offer sufficient backup to keep the Raspberry Pi 4 running for 3-4 days without sunlight.</p>
<h3 id="lumiax-observations">Appendix 3: Observations on the Lumiax charge controller</h3>
<p>As I mentioned earlier, my battery has a built-in charge controller. The brand of the controller is <a href="https://www.lumiax.com/">Lumiax</a>, and I can access its data programmatically. While the controller excels at managing charging, its metering capabilities feel less robust. Here are a few observations:</p>
<ol>
<li>I reviewed the charge controller's manual to clarify how it defines and measures different currents, but the information provided was insufficient.</li>
</ol>
<ul>
<li>The charge controller allows monitoring of the &quot;solar current&quot; (register <code>12367</code>). I expected this to measure the current flowing from the solar panel to the charge controller, but it actually measures the current flowing from the charge controller to the battery. In other words, it tracks the &quot;useful current&quot; – the current from the solar panel used to charge the battery or power the load. The problem with this is that when the battery is fully charged, the controller reduces the current from the solar panel to prevent overcharging, even though the panel could produce more. As a result, I can't accurately measure the maximum power output of the solar panel. For example, in full sunlight with a fully charged battery, the calculated power output could be as low as 2W, even though the solar panel is capable of producing 50W.</li>
<li>The controller also reports the &quot;battery current&quot; (register <code>12359</code>), which appears to represent the current flowing from the battery to the Raspberry Pi. I believe this to be the case because the &quot;battery current&quot; turns negative at night, indicating discharge.</li>
<li>Additionally, the controller reports the &quot;load current&quot; (register <code>12362</code>), which, in my case, consistently reads zero. This is odd because my Raspberry Pi Zero 2 typically draws between 0.1-0.3A. Even with a Raspberry Pi 4, drawing between 0.6-1.3A, the controller still reports 0A. This could be a bug or suggest that the charge controller lacks sufficient accuracy.</li>
</ul>
<ol start="2">
<li>When the battery discharges and the low voltage protection activates, it shuts down the Raspberry Pi as expected. However, if there isn't enough sunlight to recharge the battery within a certain timeframe, the Raspberry Pi does not automatically reboot. Instead, I must perform a manual 'factory reset' of the charge controller. This involves connecting my laptop to the controller – a cumbersome process that requires me to disconnect the Raspberry Pi, open its waterproof enclosure, detach the RS485 hat wires, connect them to a USB-to-RS485 adapter for my laptop, and run a custom Python script. Afterward, I have to reverse the entire process. This procedure can't be performed while traveling as it requires physical access.</li>
<li>The charge controller has two temperature sensors: one for the environment and one for the controller itself. However, the controller's temperature readings often seem inaccurate. For example, while the environment temperature might correctly register at 24°C, the controller could display a reading as low as 14°C. This seems questionable though there might be an explanation that I'm overlooking.</li>
<li>The battery's charge and discharge patterns are non-linear, meaning the charge level may drop rapidly at first, then stay steady for hours. For example, I've seen it drop from 100% to 65% within an hour but remain at 65% for over six hours. This is common for LFP batteries due to their voltage characteristics. Some advanced charge controllers use look-up tables, algorithms, or coulomb counting to more accurately predict the state of charge based on the battery type and usage patterns. The Lumiax doesn't support this, but I might be able to implement coulomb counting myself by tracking the current flow to improve charge level estimates.</li>
</ol>
<h3>Appendix 4: When size matters (but it's best not to mention it)</h3>
<p>When buying a solar panel, sometimes it's easier to beg for forgiveness than to ask for permission.</p>
<p>One day, I casually mentioned to my wife, &quot;Oh, by the way, I bought something. It will arrive in a few days.&quot;</p>
<p>&quot;What did you buy?&quot;, she asked, eyebrow raised.</p>
<p>&quot;A solar panel&quot;, I said, trying to sound casual.</p>
<p>&quot;A what?!&quot;, she asked again, her voice rising.</p>
<p>Don't worry!&quot;, I reassured her. &quot;It's not that big&quot;, I said, gesturing with my hands to show a panel about the size of a laptop.</p>
<p>She looked skeptical but didn't push further.</p>
<p>Fast forward to delivery day. As I unboxed it, her eyes widened in surprise. The panel was easily four or five times larger than what I'd shown her. Oops.</p>
<p>The takeaway? Sometimes a little underestimation goes a long way.</p>
]]></description>
    </item>
  </channel>
</rss>
