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.
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.
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.
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.
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.
First, hook up the Load Cell to the HX711 as shown in the image below:
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)
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.
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.
- The Load Cell reads the weight of the coffee pot
- HX711 module amplifies the Load Cell data and sends it to Raspberry Pi
- Raspberry Pi posts the data to Firebase
- Firebase publishes this data to all the clients
- 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:
Here’s an animation of the dashboard getting updated in realtime:
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