Edge Impulse logo
Blog Post

Great Taste in ML

TinyML, Embedded Devices, Machine LearningThis artificial tongue is able to 'taste' a variety of liquids with a machine learning model running on a Seeed Studio Wio Terminal.

Nick Bild

May 11, 2023

    Artificial taste sensors are electronic devices that mimic the sense of taste and can detect and analyze different substances' chemical composition. They are essential in many industries, including food and beverage, healthcare, and environmental monitoring. The importance of such sensors lies in their ability to provide accurate and reliable results, making them a valuable tool in ensuring human health and safety.

    Water quality testing is one of the primary uses of artificial taste sensors. These sensors can detect the presence of harmful substances in water, such as heavy metals, pesticides, and other contaminants that can pose a risk to human health. This technology is particularly crucial in areas where access to clean water is limited, and people are at a higher risk of waterborne diseases.

    The wine industry has also been utilizing artificial taste sensors to improve the quality of their products. These sensors can analyze the chemical composition of wine and detect any defects that may affect its taste and aroma. By using artificial taste sensors, winemakers can identify any faults in the production process and make the necessary adjustments to ensure a consistent and high-quality product.

    Seeed Studio Wio Terminal

    Frequently when someone is designing a machine learning-powered creation with Edge Impulse, it is because they have a very specific problem that they want to address. Speaking of his latest project, Thomas Vikstrom admitted that he did not have a specific problem that he was trying to solve, but rather, he thought that simulating the taste buds of the human tongue would be fun and educational. This is a great reminder that sometimes just tinkering around is a great exercise — you never know when the skills you learn along the way could come in handy for getting some real work done.

    To set a goal for the project, Vikstrom decided he would try to identify five different liquids using a taste sensor of his own design and a machine learning classifier. For the hardware platform, the Seeed Studio Wio Terminal was selected because it has an Arm Cortex-M4F CPU running at 120 MHz and 192 KB of RAM, making it well-suited for running tinyML algorithms. It also has a 2.4-inch LCD display built-in, which comes in handy for a lot of applications. The Wio Terminal was paired with a Grove total dissolved solids sensor (to measure the dissolved combined content of all inorganic and organic substances in a liquid) and a Grove turbidity sensor (to measure the number of suspended particles in a liquid).

    The 3D-printed tongue

    After connecting a few wires and 3D printing an optional (but highly recommended) artificial tongue to house the sensors, the hardware setup was complete. Work on the software side of the equation began by using the Edge Impulse data forwarder to automatically upload sensor data to an Edge Impulse Studio project. Vikstrom got together coffee, red currant, seawater, tea, and freshwater, then collected about 37 minutes worth of data in this way. Data was also collected while the sensors were in the open air to serve as a negative detection class. The dataset was split into training and testing datasets to complete the collection process.

    The artificial tongue’s sensors

    Next, using Edge Impulse Studio’s web interface, Vikstrom designed the impulse, which defines how data flows through the machine learning analysis pipeline, from raw sensor data to the model’s prediction. The impulse started with a preprocessing step that split the sensor data into two second segments. After that, the most relevant features were extracted from the raw data, then were forwarded into a neural network classifier. The feature explorer tool was used at this point to explore the training data. It was observed that each of the classes was well separated from the other classes by their features. This is a great indicator that the data is of good quality and that the model is likely to perform well, so the training process was initiated.

    The performance couldn’t be any better

    After just a few minutes, training was complete, and the model was ready for evaluation. The training classification accuracy was revealed to be 100%, which was not entirely unexpected based on how well the data was separated in the feature explorer. However, it is always a good idea to confirm that the model has not been overfit to the training data. Towards this end, the more stringent model testing tool, which uses data left out of the training process, was used. This evaluation also found the average classification accuracy to be 100%, so there was good reason to believe that the classifier was ready for real-world use.

    Once an analysis pipeline is ready for use, the next step is to deploy it to the physical hardware. Doing so avoids the latency and privacy concerns associated with sending sensor data to the cloud for processing. Edge Impulse offers many options for deployment, but in this case, the “Arduino library” option was selected because the Wio Terminal is compatible with the Arduino IDE. This option is very versatile, and allows one to customize the code as much as they would like. For this project, it enabled Vikstrom to update the LCD display to provide information about the classification results.

    When the finished device was initially tested, it was very surprisingly found to produce inconsistent results, which was unexpected given the model’s performance on the collected data. After some investigation, Vikstrom realized that it was because he had not remembered to keep the turbidity sensor at a consistent depth in the liquid. When he fixed this problem, the device was giving 100% accurate classifications again. This serves as a great reminder that it is critical to capture a large diversity of measurements when collecting your training data.

    Vikstrom may not be sure what to use this taste sensor for, but maybe you have got some ideas? If not, maybe you would like to pick up some new skills and learn about machine learning classifiers? Whatever the case may be, you will not regret reading through the project documentation or cloning the public Edge Impulse Studio project and getting started on your own creation.

    Want to see Edge Impulse in action? Schedule a demo today.


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter