Edge Impulse Experts / Liquid classification
This project detects which liquid two sensors are immersed in
About this project
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:
- WIO Terminal
- Grove Turbidity Sensor for measuring the turbidity of the water (the number of suspended particles).
- Grove - TDS Sensor/Meter For Water Quality - Total Dissolved Solids
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.
- 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)
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.
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.
The Impulse consisted of a 1000 ms window with a 1000 ms window increase. As processing block was used
Keras classification was used as learning block.
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?
Gave 99 % accuracy which is great.
Tested with same liquids, and the accuracy was 100 %.
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
Download block output
|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|
Data collected7m 25s