Toilet tracker can tell you either the toilet is clean or not. It also shows either it is engaged or not.
Have you ever found a dirty toilet especially in public place? It is very common in my place. Some people forget to flush and some don’t care if they flush. Even sometime the flush system does not work properly. An unflushed toilet is a very painful one for the next user.
So, how can you monitor this before going to use it? Using a camera can be an easy solution!!! But you can not place a camera inside a toilet.
So, what will be the next option? Yes, Walabot can be a good (may be only) alternative for this. Walabot is a programmable 3D imaging sensor that sees through objects using radio frequency technology and brings highly sophisticated sensing capabilities without taking any optical image!
Walabot senses the environment by transmitting, receiving and recording signals from multiple antennas. The broadband recordings from multiple transmit-receive antenna pairs are analyzed to reconstruct a three dimensional image of the environment.
This opens the possibility to use Walabot for 3D imaging in fields where using camera is not possible like inside bathroom or trial room or bedroom.
I am using the Walabot to identify either the commode is clean or not. The idea behind it is very simple. The Walabot is place on top of the commode (usually on the roof of the toilet). At the initializing stage the clean commode is scanned by the Walabot. After initialization it scanned the toilet at a regular interval (1 min or less) and detect any object which was not present during initialization. As the commode was clean during initialization Walabot can easily detect any new object (e.g. stool) on the commode. For a better result Walabot parameters must be set properly. Walabot can also measure the distance of the object it detects. So, according to the distance of the object it is possible to find either the toilet is engaged or not.
The above two figures show how engagement and cleanliness is detected.
How does the whole system work?
The complete toilet tracking system has some important parts. The Walabot is connected to a Raspberry Pi 3. Walabot scans for any new object at a regular interval and Raspberry Pi collect that information from Walabot and sends the information to Ubidots cloud server using MQTT protocol. To enable the MQTT communication pyhton paho MQTT client is installed in the Raspberry pi. An Android application was developed using MIT App Inventor from which the status of the toilet can be monitored. The Android application receives the information from ubidots cloud using HTTP protocol. See the block diagram of the complete system below.
1. Installing Walabot SDK to Raspberry Pi
Follow this getting started guide from Sparkfun.com.
2. Installing paho mqtt client to Raspberry Pi.
Use the command from terminal of Raspberry Pi:
sudo pip install paho-mqtt
3. Creating an account in Ubidots.com and note down the device tokens.
4. Installing ubidots API to Raspberry pi
Type following command in pi terminal:
sudo pip install ubidots
Note down your ubidots API Key:
5. Developing python program for Raspberry Pi
To find the appropriate configuration parameters (R, pi, theta) I tested the Walabot with different object from different location using Walabot SDK for Windows. The values I choose are mentioned in the python code. I take the threshold value small for detecting small object.
minInCm, maxInCm, resInCm = 30, 300, 3
minIndegrees, maxIndegrees, resIndegrees = -15, 15, 5
minPhiInDegrees, maxPhiInDegrees, resPhiInDegrees = -30, 30, 5
threshold = 2
After developing the python program and Android application I tested the system manually to know the complete system is working. (python program and android source is attached in code section). In the final code I updated the R value. For test setup it is set small for the edge of testing.
This is the logic implemented in the program to identify either someone in the toilet or not and the toilet is clean or not.
This is the code snippet:
for i, target in enumerate(targets):
if target.zPosCm>100 and target.zPosCm<180:
print(“Toilet is engaged.”)
elif target.zPosCm>200 and target.zPosCm<210:
print(“Toilet is not engaged, not clean.”)
print(“Toilet is not engaged and clean.”)
print(‘Not engaged and clean’)
6. Developing an Android application in MIT App Inventor (source file is attached in code section).
App Inventor for Android is an open-source web application originally provided by Google, and now maintained by the Massachusetts Institute of Technology (MIT).
It allows newcomers to computer programming to create software applications for the Android operating system (OS). It uses a graphical interface, very similar to Scratch and the StarLogo TNG user interface, which allows users to drag-and-drop visual objects to create an application that can run on Android devices. -wikipedia.
If you are new in App Inventor follow these beginner tutorials.
If you want to use the attached source you have the modify the htttp url.
Just replace YOUR_OWN_DEVICE_ID with your device ID and YOUR_OWN_TOKEN with your ubidot token. Then build.apk file and install it to your phone.
Read More Detail : Toilet Tracker (Powered by Walabot)