How we have improved our production monitoring…

Dezider Meško
zonky-developers
Published in
5 min readJan 16, 2019

Story by Lukáš Vyhlídka and Dezider Meško

Some time ago, in our “garbage” slack channel, someone posted article about monitoring of toilets in Adastra. Even their MacGyver like tinfoil solution isn’t something we would prefer, obviously their solution works and more important they provide us with inspiration. So let’s spread this virus more.

It is true, that we have pretty similar toilet problems like in Adastra, (which company doesn’t?) but we have decided to monitor small brown stuff instead of big one — our stainless steel coffee kettle.

I know it’s not the Moccamaster, but serves well.

We are trying to brew good filtered coffee. And is nothing more disappointing, after long code review, than an empty coffee kettle. Realistic expectations are essential for happy live, so we decided to make coffee kettle monitoring.

Mechanical part of the project.

When we were looking for weight sensor, we ended with classic load cell in shape of cuboid. Kettle is for 1.2l of coffee, so we have ordered 3kg sensor together with HX711 load cell amplifier.

It took us three printing iterations to get good shape — first print had wrong wall thickness in relation to 0.6mm nozzle size. Second showed that we have to adjust stiffness of whole platform and enlarge the window between sensor and electronics for easier cable management. Finally third one is good enough.

Iteration, iteration, iteration…

We’ve tried to design modular design, so box with electronics can be print later, and if someone else would like to print it for different board than ESP8266 on a breadboard, he/she can easily do so. Anyway it took us another three iterations to print good electronics box.

Final design in Fusion360

You can find whole Fusion360 project here

Let’s add two consoles, and we have Enterprise owned by … kettle

Electronic part of the project

Coffee kettle monitoring was designed to send the data online right from the beginning. As already mentioned, the ESP8266 was used as the microcontroller because of the integrated wifi chip.

To signal the amount of coffee in the kettle, four LED diodes were used. The online datasource is the InfluxDB presented in Grafana.

Parts used

  • Wemos D1 mini (ESP8266 based board)
  • Small Breadboard
  • Jumper wires
  • 4x LED diodes (red, yellow, blue, red)
  • 4x 330 ohm resistors
  • HX711 module

Wiring

Each of 4 LED diodes’ anode is connected to a digital pin (D8, D7, D6, D5). Cathode is then connected to ground through a 330R resistor.

DOUT pin of HX711 module is connected to D1.

SCK pin of HX711 module is connected to D2.

Maybe even we are tinfoil MacGyver guys…

Calibration

Because there are different static resistance made by the wires connection between the Load Cell and the HX711 module, the scale has to be calibrated first.

We have used the code from https://circuits4you.com/2016/11/25/hx711-arduino-load-cell/ to find the calibration factor. Upload that to Wemos D1 and start it up. Before start leave the scale empty and then place an item of known weight (e.g. 0.5 kg). Using the serial input you can change the factor until the reported weight is the same as the item you’ve placed.

After the calibration we’ve set the tare weight (weight that should be measured as 0) to the measured value with an empty kettle. Thanks to this the measured weight is only of the coffee itself.

Both the calibration factor and tare weight offset is hardcoded in our codebase (see next section).

The Code

Code can be found in our GitHub repo.

The library for HX711 communication can be found on https://github.com/bogde/HX711.

After the boot, Wemos tries to connect to the WIFI. After successful connection it starts a periodic weight measurement.

When the weight get saturated (it does not change more than 5g) for 2 seconds it does two things:

  • LEDs are set to signalise the level of the coffee in the kettle.
  • Weight is sent to our InfluxDB database

In case the weight is saturated but less than 0 then the red diode is blinking. It signalises that there is no kettle placed.

No dashboard no fun

For some time we were thinking if we should report state to Slack, own web page with kettle picture, or something else. In the end we visualise state by LEDs and stores data in InfluxDB. Data is presented by Grafana. We’ve decided to place it right in our operational dashboard where the state of the Zonky production environment is reported.

Keep calm, still 0.6l of coffee there…

What’s next?

And that’s it. First thing which we have noticed is, that we are checking dashboard more often. We even noticed that our RPi, which is displaying dashboard on TV has some networking issues. In the future, we are looking for data which we will obtain from this little device — how much coffee typically left overnight (and is wasted), how quickly coffee disappears in the morning, average amount people are pouring, and other important metrics.

--

--