Liquid Classification with TinyML Built by Wio Terminal and Edge Impulse

The Liquid Classification TinyML project is to classify different liquids based on their spectral responses. The project is designed to showcase the capabilities of TinyML, which is the implementation of machine-learning algorithms on low-power microcontrollers. The system uses a Raspberry Pi to control a spectrometer that measures the spectral responses of different liquids. The data is then processed using Edge Impulse, a platform for building and deploying TinyML models. The machine learning model is trained on the collected data and deployed onto a low-power microcontroller, allowing for real-time classification of liquids. The project demonstrates the potential of TinyML in creating low-cost and low-power devices for a variety of applications, such as quality control in the food and beverage industry.

Seeed Hardware: Seeed Studio Wio TerminalGrove – TDS Sensor/Meter For Water QualityGrove – Turbidity Sensor (Meter) for Arduino V1.0Wio Terminal Chassis – Battery (650mAh)

Software: Edge Impulse

Industry: Smart Devices

The Background

The loss of smell and taste is a significant symptom of COVID-19 and has inspired research into olfactory training as a therapy for those affected. The Liquid Classification TinyML project’s machine learning model could potentially aid in this therapy by providing a more personalized and accurate approach to olfactory training.

In addition, liquid classification can be useful in a variety of applications, such as quality control, environmental monitoring, and medical diagnostics. For example, in the food and beverage industry, liquid classification can be used to ensure the quality and consistency of products by identifying any contaminants or variations in the composition of liquids. In environmental monitoring, liquid classification can be used to identify pollutants or contaminants in water sources. In medical diagnostics, liquid classification can be used to analyze bodily fluids for disease detection or monitoring. Overall, liquid classification can help improve the efficiency and accuracy of various processes and applications that involve liquids.

The Challange

One of the main challenges in liquid classification is the complexity of the data and the need for accurate and consistent measurements. The spectral responses of liquids can vary depending on factors such as temperature, pressure, and composition, making it difficult to develop a reliable classification model. Another challenge is the need for real-time classification, particularly in applications where rapid decision-making is critical.

The Solution

Among different parameters, TDS and turbidity are two factors we should consider to classify different liquids. We detect Total Dissolved Solids (TDS) and Turbidity in liquids because these parameters can affect the spectral properties of liquids, which can, in turn, affect the accuracy of the liquid classification model.

TDS is a measure of the concentration of dissolved solids in a liquid, while turbidity is a measure of the cloudiness or haziness of a liquid caused by suspended particles. Both TDS and turbidity can alter the spectral signature of liquids, making it more challenging to classify them accurately.

For example, high levels of TDS can interfere with certain measurement techniques and affect the accuracy of the classification model. Similarly, suspended particles can scatter and absorb light, altering the spectral signature of the liquid and making it more challenging to classify accurately.

Therefore, by measuring and controlling TDS and turbidity in liquid samples used for training the machine learning model, we can ensure that the model is trained on accurate and consistent data. This can improve the model’s ability to classify liquids accurately, particularly in applications where TDS and turbidity are significant factors, such as water quality verification.

Hardware Configuration

Before starting the liquid classification system, it is important to properly assemble the hardware components. To do this, follow the steps below:

  1. Put the PCB boards into the 3D-printed case. This will help protect the boards and keep them secure during use.
  2. Connect the cable for the TDS sensor to Grove port A2 on the battery chassis, and the cable for the Turbidity sensor to Grove port A4 on the battery chassis. If you are not using Grove ports or the battery chassis, you can use the 40-Pin GPIO Header at the back. Double-check the connections to ensure they are secure and properly connected.
  3. If you are using different analog ports than A2 and A4, update the relevant definitions in the code by changing the values for #define TDS_Pin and #define turbidity_Pin to match the ports you are using.
  4. Double-check all the connections to ensure they are properly connected and secure.

By following these steps, you can ensure that the hardware components are properly assembled and connected before starting the liquid classification system. This will help ensure that the system operates accurately and reliably, allowing you to classify liquids with confidence.

3D-printing the Tongue and the PCB Case

3D-printing the Tongue and the PCB Case

Installing Software

To be able to gather data, and later test the setup in practice, you need to prepare the WIO Terminal:

Data Collection Process, Model Training, and Model Deployment Process all are documented in the original tutorial by Thomas Vikstrom with Edge Impulse.

The Results

Different sensor data can provide valuable insights and help solve problems in a wide range of industries. The power of these insights can be amplified when machine learning models are used to analyze and make predictions based on the data. By leveraging this data, businesses, and organizations can improve efficiency, reduce costs, and ensure safety and quality in their operations

About Author


June 2023