I love coffee and side projects. I wanted to solve a coffee related annoyance that I faced on a regular basis. This post is about how I built a Coffee Pot Monitor, to track the coffee level in a coffee pot, remotely, using a Load Cell, HX711 amplifier, and a Raspberry Pi.

The Annoyance

Imagine yourself being busy with something important. You take a quick break to grab some coffee and walk over to the break room only to find an empty coffee pot.

Oh, the horror

There’s no way for me to know the amount of coffee left in the pot, without walking over to the break room and checking it out. The coffee pots we have at work are opaque. So, it’s not possible to know the amount of coffee left in the pot by looking at it.

Initial Solution

I came up with a solution to my problem. A camera mounted near the coffee pot would stream the video data to a Raspberry Pi. Using Computer Vision on this stream, I can identify when someone uses the coffee pot. When someone pumps the coffee from the pot, my algorithm decreases the coffee level in the coffee pot by a static value (one cup). A dashboard, which can be accessed via a URL, displays this data in realtime.

There’re several drawbacks to this approach. For starters, my algorithm assumes that every person pumps exactly one cup of coffee. Now, consider the case of an empty, opaque coffee pot. A person tries to pump coffee and realizes there’s no coffee left. In this case, my algorithm still decreases the coffee level by a cup even though no coffee is pumped.

To say the least, it is a convoluted approach.

I knew it was a convoluted idea. I wanted to build it anyway.

One fine day, I shared the idea with a friend from work, Rajesh. He liked the thought behind the project and suggested an improvement.

Improved Solution

Rajesh suggested using the coffee pot’s weight to calculate the coffee level. That was it. Suddenly, it became obvious. It’s a great way to track the volume of the coffee in a coffee pot.

The potential of the project got us both excited. We submitted the idea to the quarterly Hackathon at work. Long story short, we won the first prize for our implementation of this idea.

Tools

After some research, it became clear that we needed a Load Cell along with a Hx711 load cell amplifier. I immediately ordered it from Amazon along with the Raspberry Pi 3 B+.

Setup

First, hook up the Load Cell to the HX711 as shown in the image below:

Connecting a Load Cell to a HX711 amplifier

Next, connect the HX711 amplifier to Raspberry Pi as follows:

  • VCC to Raspberry Pi Pin 2 (5V)
  • GND to Raspberry Pi Pin 6 (GND)
  • DT to Raspberry Pi Pin 29 (GPIO 5)
  • SCK to Raspberry Pi Pin 31 (GPIO 6)
Connecting a HX711 to a Raspberry Pi

That finishes our hardware setup. Let’s move on to the software side.

We use the HX711 python library in Raspberry Pi to read the Load Cell data from the Hx711 amplifier. Every three seconds, the Raspberry Pi posts the data to Firebase. A simple static HTML page serves as the dashboard by displaying the realtime data from Firebase.

The build

We need two pieces of wood. One of the pieces, acts as a base to place the coffee pot. The other acts as a stand for the Load Cell. These are placed on either sides of the Load Cell. In my case, a colleague of mine, Vijay, helped with cutting out these two pieces of wood.

  • Top view of the equipment
  • Side view from an angle
  • Load Cell positioned between two wooden planks
  • Load Cell zoomed in
  • Load Cell connected to the HX711 amplifier and Raspberry Pi
  • Another view of the Load Cell

Architecture

Data flow from Load Cell to the user’s browser
  1. The Load Cell reads the weight of the coffee pot
  2. HX711 module amplifies the Load Cell data and sends it to Raspberry Pi
  3. Raspberry Pi posts the data to Firebase
  4. Firebase publishes this data to all the clients
  5. The browser displays the updates

How it works

There is a one time setup process. First, weigh the empty pot on the Load Cell. Let this weight be w1 (min). Next, weigh the coffee filled pot on the Load Cell. Let this weight be w2 (max). At any given point of time, the weight of the coffee pot ranges from w1 to w2.

Every time someone pumps (or pours) coffee from the pot, the weight of the coffee pot decreases. This data is published to all the clients using Firebase. It’s as simple as that.

Here’s the final product:

Coffee Pot placed on the wooden platform
Coffee Pot placed on the wooden platform

Here’s an animation of the dashboard getting updated in realtime:

Conclusion

The entire cost of setting this up is approx. $45. It’d be great if we could build this at a much lower price. That way, it can be more affordable and practical. I’ll soon open source the code behind the project and provide the GitHub link to the repository.

Featured image courtesy: https://unsplash.com/photos/KixfBEdyp64

Join the Conversation

6 Comments

  1. Hm. Why a whole RPi for this? I like the project, it’s a good fit for an “IoT” solution like this, but it’s a bit like shooting flies with a cannon. It can be achieved just as efficiently, with all features including the nifty web page, using a $3 ESP8266/ESP32.

    1. You’re absolutely right about achieving the same using an Arduino board. I wasn’t too familiar with the Arduino and I just wanted to build something really quick, which meant, using software/hardware technology that I was familiar with. Besides that, there wasn’t really any other reason to not go with Arduino. Thanks for the advice though.

Leave a comment

Leave a Reply

%d bloggers like this: