Using Statistics Instead Of Sensors

Statistics often gets a bad rap in mathematics circles for being less than concrete at best, and being downright misleading at worst. While these sentiments might ring true for things like political polling, it hides the fact that statistical methods can be put to good use in engineering systems with fantastic results. [Mark Smith], for example, has been working on an espresso machine which can make the perfect shot of coffee, and turned to one of the tools in the statistics toolbox in order to solve a problem rather than adding another sensor to his complex coffee-brewing machine.

To make espresso, steam is generated which is then forced through finely ground coffee. [Mark] found that his espresso machine was often pouring too much or too little coffee, and in order to improve his machine’s accuracy in this area he turned to the linear regression parameter R2, also known as the coefficient of determination. By using a machine learning algorithm tuned to this value, which assesses predictable variation in a data set, a computer can more easily tell when the coffee begins pouring out of the portafilter and into the espresso cup based on the pressure and water flow in the machine itself rather than using some other input such as the weight of the cup.

We have seen in the past how seriously [Mark] takes his coffee-making, and this is another step in a series of improvements he has made to his equipment. In this iteration, he has additionally produced a simulation in JupyterLab to better assist him in modeling the system and making even more accurate predictions. It’s quite a bit more effort than adding sensors, but since his espresso machine already included quite a bit of computing power it’s not too big a leap for him to make.

9 thoughts on “Using Statistics Instead Of Sensors

  1. Glad to be a savage myself. I drink straight from my Senseo pad machine with unskimmed milk and 1 sweetener tab. I just wonder if it wasn’t easier to use one of these Dynalon Ball Flow Indicator (check google). Plug that in between the silicone water tube/hose.

    Surely a simple LED and photodiode can pull it off to see each revolution of the ball?

    1. Yeah, that was the first thing I saw. Steam is used to foam milk (or other satanic approximations) and hot water at a very specific temperature (93C for me) is used to make espresso. Real coffee geeks talk about PID retrofitting old machines.

  2. Without statistics all you have is data. With statistics, you can get information.

    I don’t think there would be many cases where I WOULDN’T be using statistics with any sensor these days, regardless of whether I was aware of it or not. Whether it be built into the sensor package itself or running on the microcontroller (or remote server) to at the very least control for outliers, or compensate for drift. But there are plenty of types of sensors that only work by directly measuring one thing and using statistics to give a indirect measurement of something else (eg, a MOS sensor giving an eCO2 measurement).

  3. “[Mark] found that his espresso machine was often pouring too much or too little coffee”

    I can’t find this in any article regarding the project. It appears the first concern was that the water level was often too low in the tank because it wasn’t being checked. The second aim was to automate the machine, so that the user only had to prep the puck and the machine would do the rest.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.