View All Posts

Monitoring Actual Buckets

I’ve had an issue with the heating in my flat since August. One of the heaters had rusted through (it was made in the 1980s in the GDR) and was dripping water. The whole thing started slowly and with fits and starts got worse until it was finally resolved in November by replacing the heater altogether.

Needless to say that was way too much time for such a small repair and there is a story about sub-sub contractors here that I will spare you except for a small statistic: I total it took 4 companies and about 10 people until someone with the right tools and the right knowledge showed up and got it done in under two hours. The road to that was over two months and lots of waiting while there was the worlds slowest flooding taking place in my living room. Since I had two vacations in the mean time I had to get friends to empty buckets in my absence (thanks again to everyone who did that!).

And that brings me to the actual topic of this blog post! As a nerd I obviously needed to throw a bit of technology at this problem. I wanted too get a sense of how full those buckets were in order to let my friends (and the internet!) know how bad things were so they could come over when needed instead of showing up super often.

So, as someone with:

I quickly realized that what this called for: a live camera on the internet! Also this provided a convenient excuse to buy a High Quality Camera module for the Pi!

So, here is the setup I came up with:

Hardware setup

Hardware wise I wanted that all to be on a small tripod to point it at the bucked that needed monitoring. The HQ Camera has a tripod mounting point already and I found a little mounting bracket that allowed me to mount the Pi on the back of the camera. The assembled system looks like this:

The HQ Camera on a tripod with the Raspberry Pi on its back as seen from the front

The HQ Camera on a tripod with the Raspberry Pi on its back seen from above

Watching over the dreaded heater

Software setup

In order to capture and upload the photos on the Raspberry Pi side I put together this tiny bash script:

#!/bin/bash

FILENAME=$(date -u +"%Y-%m-%dT%H:%M:%SZ").jpg

libcamera-still -q 80 -o $FILENAME --framerate 4
libcamera-still -q 80 -o latest.jpg --framerate 4

scp ~/$FILENAME frogeye@drilling.emi.industries:/home/frogeye/
scp ~/latest.jpg frogeye@drilling.emi.industries:/home/frogeye/

rm $FILENAME
rm latest.jpg

This then gets run in a cronjob every 15 minutes:

*/15 * * * *

The authentication between the Pi and the VM hosting the website is handled by ssh key pairs. On the server side I have a nginx and dehydrated configuration in place to allow the static site with the images to be available via https.

The HTML on the webserver was so small that I just wrote it by hand:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>frogeye.emi.industries</title>
    <style>
      @font-face {
        font-family: "AlphaProta";
        src: url("./AlphaProta.ttf") format("truetype");
      }

      h1 {
        font-family: AlphaProta;
        text-align: center;
      }
      #container {
        display: flex;
        justify-content: center;
        align-items: center;
      }

      #camera {
        max-width: 100%;
        border-radius: 10%;
        max-height: 100vh;
      }
    </style>
  </head>
  <body>
    <h1>BUCKET WATCH</h1>
    <div id="container">
      <div>
        <img id="camera" src="latest.jpg" />
      </div>
    </div>
  </body>
</html>

The final website looks something like this:

The resulting website with the finale capture featuring the new heater ✨

Of course this could have been made to look a bit nicer but at that point I decided that this was enough spare time spent on questionable projects. Finally I’ll leave you with a few highlights form the captured images:

The empty bucket right before I left for Vienna

At night it got a bit darker than what I hoped for

The full bucket right before being emptied

The new heater right as I was cleaning up after the repair

And that’s all the insight I have to offer on how to build a fairly resilient bucket monitoring system. If you have any questions about the other parts of my setup (nginx config and such) feel free to hit me up on mastodon!