Automatically find the top and bottom of the coffee mug
Fill up a mug to the desired amount (full or half full)
Track the filling process in real-time
Production price of complete solution around 10 EUR
A leading coffee manufacturer wanted to add a function to their coffee machines that could fill every kind of mug (small, large, glass, ceramic) fully or half-fully. The requirement was that system must be able to automatically find the dimensions of the mug and track the filling process in real-time without human intervention.
A lot of time is wasted due to coffee spills due to overfilled coffee mugs, but the challenge was to see if this could be done for a reasonably low cost – around 10 EUR.
As no other coffee machine manufacturers had a flexible solution for their coffee machines, this would give them a competitive advantage as well as add a exciting new gadget to their product portfolio.
Searching for a solution
After the client had spoken to a number of research institutes who said that it,
“wasn’t possible with today’s technology”
and trying a few tests themselves, they were about to give up. But then they came into contact with ASN consultancy. Our algorithm developers were able to find a working solutions within one week!
The following case describes the steps that we undertook, including details of the solution.
Working prototype that worked on various types of mugs and cups
Automatic top (edge) and bottom detection
Real time tracking of the filling process
Professional real-time demonstration GUI
Robust system for around 10 EUR
ASN consultancy could answer the question with an ultrasonic bistatic sensor. However, our developers needed first to design an analog front-end (AFE) hardware PCB (printed circuit board) for transmitting and receiving the ultrasonic signals.
The AFE was then coupled to a DAQ (data acquisition module) for sampling. A sampling rate of 250kHz was chosen to capture the reflected 40kHz ultrasonic pulses.
Data analysis and algorithms
Loading the captured datasets into the ASN filter designer’s signal analyser, designing an FIR Hilbert filter and filtering the data, we were able obtain a time domain envelope of the received signal. The envelope was passed through the tool’s Advanced time domain analysis block, and positions of the peaks (pertaining to the top and bottom of the mug) localised via Savitzky-Golay data analysis for robust differentiation.
Our developers found that by looking the 3rd derivative we could accurately determine where the edge (top) and bottom of the mug was. The plot shown below illustrates the concepts, whereby the first peak pertains to the top of the mug and second (much larger) pertains to the bottom. The time domain envelope from the FIR Hilbert filter is shown in red.
Captured data: ultrasounic echo data and envelope (red)
Real-time tracking during filling
Armed with the top and bottom location information, we were able to begin tracking the coffee during the filling process. The basic idea was to track the largest peak of time domain envelope as it moved from right, i.e. from the bottom of the mug to left (the top of mug). Inconsistencies in peak location readings due to ripples and vibrations in the liquid were filtered out via a median filter.
The result for the client
A working prototype for around 10 EUR, that was able to accurately fill various type of coffee mug and tea cups. The system also worked well in the presence of milk foam (from cappuccinos, latte etc).