Coffee Data Science

Measuring Refractometer Accuracy to Groundtruth for Coffee

Better sampling to better understand TDS vs Brix vs Groundtruth

Robert McKeon Aloe
Towards Data Science
5 min readJul 15, 2022

--

I use a refractometer (a digital Atago) on a daily basis to measure Total Dissolved Solids (TDS), which I then use to calculate Extraction Yield (EY). I assume the Atago is accurate, but there is no data provided by Atago or any refractometer producer. They only give accuracy numbers. I have done some other tests, but I wanted to see what how I could better test groundtruth.

I compared the Atago to a Brix visual refractometer, and then I compared both of these to some groundtruth. I used two substances for groundtruth: espresso powder and sugar. I dissolved these in water, and I ran some trials.

Atago and visual Brix, all images by author

The general equation to convert brix to TDS is TDS = 0.85*Brix. I wanted to see how accurate that constant was or if a second order polynomial would fit better.

One challenge with visual brix refractometers is that they are difficult to read at times. You can resolve between two hash marks so that you can get to 0.1 Brix accuracy, which is fine for espresso readings, but they don’t do so well at lower readings for pourover.

Reading Brix for espresso powder or coffee is a bit fuzzy, but the line for pure sugar is very clean. Usually, if you take enough readings, you can get better consistency for reading coffee. Usually, the right reading is the very edge of the color drop off.

The images are sharper in real life.

Previous Data

I collected some data when I first got the Atago. I took each shot and pulled the shot in the first half and the second half. Plotting these data points shows a line of 0.9074 fits the data pretty well.

So I split the data between the first and second half of the shots. The higher TDS values were closer to 0.85 at 0.8322, but the lower values were 0.902. There was still a bit of noise too. I wonder how much of the connection between Brix and TDS changes based on what is extracted from the shot and when.

Espresso Powder as Groundtruth

I started with espresso powder where I know the weight of the espresso powder and water to know empirically the TDS. I then used these samples and subsequent dilutions of a starting solution to achieve multiple points along the curve.

The data wasn’t too noisy, and the trend had a good correlation. The trendline for TDS vs Brix was with a slope of 0.88, which still isn’t 0.85.

When comparing TDS or Brix to groundtruth, the trendline for Brix is 0.994, which means that espresso powder is not as representative as a groundtruth like I thought it would be. It is closer to sugar than coffee as the TDS measurement had a slope of 0.894.

Sugar Water as Groundtruth

I did the same experiment with sugar water as groundtruth, but still the relationship between TDS and Brix was not 0.85. The slope of the best fit line was 0.8711.

If you remove the one outlier at (22,21), the best fit comes in line to have a slope of 0.85.

When I looked at measured TDS vs groundtruth, it was much closer to 0.85 at 0.8492 which means that there is an offset in the Atago to account for it to measure coffee instead of sugar water.

Something strange was going on at the lower values. I focused on TDS less than 4, and the best fit line for just those points was a lot closer to y = x or a slope of 1.

I looked at Brix measurements too vs groundtruth, and there was something weird happening at the lower end.

I have found more questions than I feel I answered:

  1. I need a better groundtruth or need a modified coffee groundtruth.
  2. Lower TDS solutions behave funny which might be due to some best fit equation.
  3. More data is needed to understand how TDS is accurate for the different parts of the shot. So a salami shot with multiple watered down samples would be an interesting experient.

If you like, follow me on Twitter, YouTube, and Instagram where I post videos of espresso shots on different machines and espresso related stuff. You can also find me on LinkedIn. You can also follow me on Medium and Subscribe.

Further readings of mine:

My Future Book

My Links

Collection of Espresso Articles

A Collection of Work and School Stories

--

--

I’m in love with my Wife, my Kids, Espresso, Data Science, tomatoes, cooking, engineering, talking, family, Paris, and Italy, not necessarily in that order.