Edge Impulse Experts / Liquid classification Public

Edge Impulse Experts / Liquid classification

This project detects which liquid two sensors are immersed in

About this project

Liquid detector

Objective

The objective of this project was to detect which liquid two sensors are immersed into.

Method and results

For this project following equipment was used:

I put a rubber band around the sensors to be able to immerse both simultaneously and with one hand in the liquids (See the picture at the end). The Turbidity sensor has a hole at the top which I covered with some bluetack, but it is still far from waterproof. (Who has designed a water sensor to not tolerate water, just asking...)

The turbidity sensor is with the Seeed provided Arduino code only returning a voltage, but with the datasheet it should be possible to convert the voltage into NTU (Nephelometric Turbidity Units). The Arduino code for the TDS sensor is returning PPM-units.

Liquids tested

  • Air (not really a liquid...)
  • Tapwater, tapwater in Finland is said to be even cleaner than bottled water
  • Seawater, actually brackish water but still from the sea
  • Tea, Lipton black tea from Kenya (in my opinion not drinkable, but then I never drink tea)

Arduino code

On the Wio Terminal I reused code I've adapted to show graphics for this project and added the required code to print sensor values to the terminal as I needed to use the data forwarder.

Data

I collected a total of ~7 minutes data split into training and testing sets. Each sample consisted of 10 seconds worth of data, recorded at 5 Hz.

Impulse

The Impulse consisted of a 1000 ms window with a 1000 ms window increase. As processing block was used Raw data. Keras classification was used as learning block.

NN Classifier

I found out that using 2 Dense layers of 30 and 15 neurons works well. Note for some reason the quantized version gives extremely poor accuracy (only 22 %), while the unoptimized version gives 100 %. Don't know the reason for this... is more data needed, or is it because I use Wio Terminal as device?

Model testing

Gave 99 % accuracy which is great.

Live classification

Tested with same liquids, and the accuracy was 100 %.

Conclusions

While the two sensors used are probably not of industrial quality, this short project shows that it is possible to detect at least a few types of liquids. One sensor is not enough as I found out that e.g. cranberry juice and seawater has similar TDS-value, but when also using the Turbidity sensor, the liquids could be separated. By adding a PH-sensor more liquids are expected to be detected, unfortunately all suitable hobby PH-sensors are out of stock at the moment, so could not verify this theory.

For real-world usage, liquid sensors together with ML can be used to detect if it's time to clean the swimming pool or the fish aquarium. The technology could also be used to indicate if e.g. water from your own well is good to use. If not, filter and clean it, and test it again. Industrial grade sensors might be used to detect e.g. different types of alcohol, or perhaps even what brand a certain wine sample is. Think Benjamin Cabé's nose, but in addition to the nose add his taste buds :-D

IMG_2715.jpg

IMG_2714.jpg

Download block output

Title Type Size
Raw data training data NPY file 314 windows
Raw data training labels NPY file 314 windows
Raw data testing data NPY file 128 windows
Raw data testing labels NPY file 128 windows
NN Classifier model TensorFlow Lite (float32) 5 KB
NN Classifier model TensorFlow Lite (int8 quantized) 3 KB
NN Classifier model TensorFlow SavedModel 10 KB
NN Classifier model Keras h5 model 5 KB

Clone project

You are viewing a public Edge Impulse project. Clone this project to add data or make changes.

Summary

Data collected
7m 25s

Project info

Project ID 145909
Project version 1
License Apache 2.0