< All posts | Fediverse | RSS | GitHub | Talks

Aug 6 2018

Building telemetry for tea aka Tealemetry

As a British person, I admittedly conform to the stereotype of tea consumption, and giving I’ve been consuming tea for most of my life I have gained opinions on all kinds of tea based variables. The biggest one being the acceptable tea drinking temperature.

So the thing is. Black tea (the best tea) needs to be brewed with near boiling water to taste the best. But at the same time this is incompatible with me being able to drink it right away. On top of that because you have to wait for the tea to cool down, it’s easy to forget about it, and then it’s too late:

a graph showing the range of temperatures tea can be in

Some people think that drinking tea at 30c or room temperature is acceptable, I think those people are incorrect. However after missing the acceptable temperature window too many times I decided I need a way to be alerted when the tea is drinkable. I got out my FLIR camera and confirmed that the heat spread over a freshly brewed cup of tea is even at the bottom of the mug.

a photo of a mug with a FLIR reading of 71C at the bottom of the mug

This started me thinking. You could design a tea coaster that can read the temperature of the mug sitting on it. So I set out to make a coaster with a slot for a temperature sensor, and under it, space for a ESP8266 as the microcontroller.

a 3d model of the tea coaster

Then used my flatmate’s 3D printer to print it out in PLA:

Assembled together it looks like this (minus the ESP8266 being outside of the slot for debugging), the MLX90616 sensor peeking out from the bottom of the coaster.

assembled coaster

final product

After that, the ESP8266 setups up a web server that exports metrics about the coaster temperatures in prometheus format, with exceptional accuracy of 0.02c:

[ben@aura ~]$ curl xxx:9000/metrics
# HELP tea_mug_temp The point temp on the coaster.
# TYPE tea_mug_temp gauge
tea_mug_temp 24.689997
# HELP tea_ambient_temp the temp of the sensor.
# TYPE tea_ambient_temp gauge
tea_ambient_temp 27.490015

This means I can graph my coaster in grafana and watch the mug get colder over time:

a grafana graph of tea temp

I can also then write a alert for when the cup of tea is considered drinkable, max_over_time is used to ensure that the alert for drinkability is not dismissed by me picking up the mug to drink from it.

ALERT teaDrinkable
  IF (max_over_time(tea_mug_temp[60s]) > 36) and (max_over_time(tea_mug_temp[60s]) < 56)
  FOR 1s
  ANNOTATIONS {
    summary = "The mug on the coaster is now drinkable",
    description = "drink it. or not. I'm an alert, not a cop",
  }

For me, my alerts are delivered to a discord chat room via a alertmanager webhook translator I wrote for alertmanager called alertmanager-discord

discord screenshot

The bonus of this is that I get phone notifications too for this room:

screenshot of the discord mobile notification

Now, arguably you could include a LED to also signal when it’s drinkable so that it’s not dependent on the internet for notifications, but where would be the fun in that? Long live the internet of shit.

If you want to build your own Tealemetry device, you can find all of the ESP8266 source code and 3D printing models on my github here: https://github.com/benjojo/Tealemetry

If you generally enjoyed this, you may enjoy what is else on the blog! If you want to stay up to date with what I am doing you can either use my blogs RSS, or follow me on Twitter