It's been a year since I was not active with the hackster.io community. Just came back from the break with this new and one of my dream project. I think I should call this as products. let's get into more details and story of this idea.
Noticed this contest from hackster io and decided to contribute my idea. Submitted idea of something but today I have done something else. The project is different but the technology I use the same. MATTER is the matter for everyone who talks about IoT products. I decided to make a product which works in MATTER with ML.
What is Float Bot?"Float Bot" is the hero of this project who does the sensing and sends me the updates about my home overhead tank.
The project idea is to sense the Water level, Cleanliness, Temperature and Motor Status etc. The communication happens over Matter (https://csa-iot.org/all-solutions/matter/) networks. The Nordic-Thingy-53 comes with enough sensors to make a decent prototype. The Edge Impulse I have just used a bit to showcase the sensing of Motor running status, Motor dry run detection, Water low level and Tank Lid open etc.
In today's world there are a lot of manufactures makes the water level indicators with motor control. The drawback with existing systems are
1. Wired connection makes the system very expensive, difficult with multiple water tanks.
2. Physical Sensors are in contact with water always and require maintenance or replacement.
3. Existing system cannot sense anything other than the level.
Like this there are many.. But How the Float bot overcomes all these with new technology.
1. It's Wireless - No need for hanging wires on your building.
2. It's Reliable - Some people say, wireless is not best but we are focusing on 2025 we have a better eco system for Home IoT.
3. Its Floating, Sensing with Internal Battery, can be charged from solar panel (Tank Lid)
4. Easy Installation - It's compact in size and wireless, just like a boat we need to throw it in your tank.
System OverviewThe whole system overview is shown in blocks below,
Nordic Thingy 53 is the main controller board and it comes with a lot of environmental sensors to measure temperature, pressure, humidity, color, motion etc. Its microphone can be used for recording or voice detection.
I have used Thingy 53 for running Matter with sensor clusters. The new sensor "TF-Mini-S"Lidar is used for detecting the water level. The other sensors are just used as it is. Also the design includes the part of controlling the AC motor. This is done with the help of Relays and Triacs, I have used Nordic nRF52840 DK (https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dk) as End node to control the motor. On Edge Impulse the data coming from the sensor is processed and given to use in the form of actual use cases like fault detection, Tank lid open, Prediction of Time to Full etc.
Unboxing of Thingy53The 1st step in this project is Unboxing, Received the kit on end of august 2022. Here is the video of unboxing.
Development of CodeThe Kit comes with a preflashed example of ML (Edge Impulse Code) https://github.com/edgeimpulse/firmware-nordic-thingy53, This shows the basic functionality of ML with accelerometer sensor. The nRF Edge Impulse Mobile application is used to demonstrate it. Android App
On the other side, MATTER ! to work with matter the Nordic nrf Connect sdk (2.1.0) comes with a few example codes, Light bulb, Lock, Sensors etc. This NCS (nrf connect sdk) can be installed via nrfConnect->ToolChain Manager desktop application. There are getting started guides, well documented to start with this.
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/nrf/introduction.html
My installed path C:\ncs\v2.1.0
The example code which matches my requirement is "matter weather station" which is inside the application folder. I started with this example code. I followed the tutorial / doc to setting up my workspace with Visual Code Studio
These examples are Zephyr RTOS (https://www.zephyrproject.org/) based, since I'm new to this RTOS, it took some time to followup the code. Its kind of new learning in short period of time.
Build and Test the CodeAfter spending some time, I was able to build the 1st code example of MATTER, Just got hex files and flashed them and was excited to see MATTER working. But not as easy as we think. It required the Eco system to work. Most of the time I used an external J-link debugger to flash code. In this step Understand the needs of Linux PCs and Raspberry Pi. Unfortunately I had a very old Linux machine and managed somehow.
Google has released the open thread board router application which is used in Thread networking, the Thread is layer And more details about this open Thread
https://openthread.io/guides/border-router
Followed this tutorial to setup the Open Thread Board Router with Raspberry Pi 3
https://openthread.io/codelabs/openthread-hardware#0
I have used my Nordic Dongle to run Thread RCP application with host as raspberry pi. I used J-link to program the USB dongle. The services agents are run automatically, Also I put the raspberry pi into auto login mode. The Open Thread agent service starts automatically and we can check the status by issuing comments below
sudo service otbr-agent status
sudo service otbr-web status
The Eco system is ready, and verified that it's working fine by pinging from the wifi network, also the thread router can be accessed via local-network. The router which has an IPV6 address enabled to make this router work. Really spent more time to bring this border router to alive.
Border router is ready and now the tool comes into picture here is called "CHIP Tool", CHIP (Connected Home IP) was the original name of "MATTER". This tools can be found in the connectedhomeip repo (https://github.com/project-chip/connectedhomeip/). I acquired this repo into my linux machine. Started building with following this tutorial (blob/master/docs/guides/BUILDING.md) It was bit painful because my linux machine is very less memory (4GB). Many failures and struggles after all I made it to build successfully. There are two ways to use Chip tools, on host or as an android app. I preferred to use with an Android app for commissioning.
Android AppThe prebuild android app (.apk) can be downloaded from https://github.com/nrfconnect/sdk-connectedhomeip/releases And here you have to download the suitable version one for mobile. Otherwise the pairing won't happen for provisioning the node. After all, I made through the pairing successfully and tested the 1st example on MATTER. The reading of temperature, humidity and pressure sensing.
So my experiment with example code done, as next step I started to customize the application.
UART with TF-MINI SThe plan is to integrate the TF-MINI S lidar sensor to the Thingy53. I analyzed the existing code and tried some attempts to bring UART but failed, later deciding to add a co-controller to process the data coming out from the sensor. LPC810, a very tiny and powerful MCU (8pin DIP). I used to receive data and convert into bits for format. This really works with Thingy to read data with a timer interval. So the sensor ranges to 12 meters but I set the limit to 2meter range since its small overhead tank (average height). The output of the sensor is in cm, converted into bits ranging from 0 to 31 (5bits) This is good enough to represent the water level.
To demonstrate the working of Float Bot, I required Motor Pump to switch ON/OFF manually, just thought of using another MATTER end node device to control the motor. I took the "Light Bulb" example and made it working with a 12V DC Motor. I used Nordic nrf52840-dk for this node. Everything was good as planned. During the trial RUN the motor pump got damaged and collapsed the plan. In the last minute another plan came to control the 230AC motor, after all, finally the Nordic DK board popped up with a power issue. But its OK, soon I will be able to control the same.
12V DC Motor control working video -> https://www.linkedin.com/feed/update/urn:li:activity:6989776826080403456
Nordic Dongle is mounted on raspberry pi as router node, The sensor node data is read over the Thread network and published to the IPV6 address. This data can be read from Chip Tool. Chip Tool android app seems very good to showcase my application. But there are some customization I have done to change text strings and logos. And I named this version as ChipTool 2.0. Customization the screens from Android Studio and building the code from the console.
Here is the user guide to build an Android Tool from connectedhomeip source.
https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/android_building.md#building-android-chiptool-from-android-studio
Target to proper core so that the application works without any issues. The.Apk debug will be generated inside the output folder.
Screen Shots from Chiptool 2.0
The Water Tanks come in different sizes and heights in order to make the BOT work. we need to calibrate 1st. This calibration gives the result of MAX and MIN values which are used to calculate the water storage in percentage.
To calculate the lower limit, the water will be drained out and the percentage is noted (23%) and for the upper limit the water is filled full and the percentage is noted (31%). This variation in percentage gives the capacity of the current water tank.
kWaterlevelMeasurementValue = ((raw_bits - 20) * 100)/ (31 - 20);
printk("Water level values: %d\n", kWaterlevelMeasurementValue);
Level Sensing with Matter DemoThis video shows the working of water level sensing over Matter with a Thread border router as Raspberry-pi 3.
Training the Float BotTraining the Bot is straight forward, I used nRF Edge Impulse mobile application. The precompiled version of Edge Impulse code is used in Thingy53 to acquire data in nRF Edge Impulse mobile app (https://play.google.com/store/apps/details?id=no.nordicsemi.android.nrfei&hl=en_IN&gl=US) and It's uploaded to edge impulse studio(https://studio.edgeimpulse.com).
Training for Motor Status with - Running and Idle
Accelerometer is used here to detect the water wave oscillation level.
Training for Tank cover open / close
Assuming it's a day time, Open/Close is detected with an ambient light sensor.
Training for Tank Empty -
The microphone is used to detect the sound coming through the pipe when water is run with a mixture of air.
All these parameters are recorded into Edge Impulse Studio via Nordic nRF Edge Impulse mobile application.
In Edge Impulse Studio, the collected sensor data is trained with models for ML. The project is created and sensor data is uploaded from mobile automatically over nRF Edge Impulse app.
Collected data is trimmed in the studio to create Impulse.
To create the impulse for each sensor the processing block and learning block is assigned to produce the classification features. Later the features are generated with default parameters. After this step the training outputs are obtained.
This document helps to know more about the usage of Edge Impulse Studio https://docs.edgeimpulse.com/docs/
Finally all the models are trained and deployed into the Thingy53 over nRF Edge Impulse Mobile App.
Use-casesOther than water tank level sensing, there are many places where we could use the same prototype (Float Bot).
1. Material Level Detection
2. Sewerage Capacity and Wastewater Management
3. Tanker Truck
4. Storage Tanks (Milk/Agriculture)
3D DesignThis prototype can be 3d printed with an air tight molding base. It gives the feel of a boat with Thingy53. The case should be qualified for IP67 standard to add water proof.
The "Float Bot" is left inside the tank and The trained module is deployed into the Thingy53 using the nRF Edge Impulse mobile app. The details video of working demo is below
Comments