MAKER: Md. Khairul Alam / Translated by: Quwujin Cherry
Have you ever encountered a toilet in a public restroom that hasn’t been flushed after use? Yes, there are always some people who forget to flush, or they simply don’t care, or sometimes the toilet flush is broken… Encountering a toilet that is left unflushed is an unforgettable experience in life.
This project is about creating a toilet condition tracker that can accurately tell you whether the toilet is clean and whether it can be used.
Imagine if we could monitor the toilet? Using a camera is a simple solution! But you can’t place a camera inside the restroom. Therefore, using Walabot is a great choice.
Walabot is a programmable 3D imaging sensor that uses radio frequency technology to observe objects and achieves highly complex sensing functions without any optical images!
Materials List
Hardware: Walabot x1, Raspberry Pi 3B x1
Software: MQTT, Ubidots, MIT App Inventor, HTTP
How Walabot Works
What is Walabot? Check out this video to feel it.
Walabot sends, receives, and records signals through multiple antennas to sense the environment. It analyzes the broadband records from multiple transmitting and receiving antennas to reconstruct a 3D image of the environment.
Walabot makes 3D imaging possible, replacing areas where cameras cannot be used, such as bathrooms, laboratories, or bedrooms.
I use Walabot to identify whether the toilet is clean. Its working principle is very simple. Place the Walabot on top of the toilet (usually at the top of the toilet).
During the initialization phase, Walabot scans the clean toilet. After initialization, it regularly scans the toilet (every minute or less) and detects any new objects that were not present during initialization. Since the toilet was clean during initialization, Walabot can easily detect any new objects on the toilet (such as feces).
For better results, Walabot parameters must be correctly set. Walabot can also measure the distance of detected objects. Therefore, based on the distance of the measured objects, it can also determine whether the restroom is accessible.
Is the toilet occupied?
Is the toilet clean?
The above two numbers show the usage and cleanliness of the toilet.
Operation of the Entire System
A complete toilet tracking system requires some important components. 1. Connect the Walabot to the Raspberry Pi 3.
2. Walabot regularly scans for any new objects, and the Raspberry Pi collects that information from Walabot and sends it to the Ubidots cloud server using the MQTT protocol.
3. Enable MQTT communication by installing the Python Paho MQTT client on the Raspberry Pi.
4. An Android application is developed using MIT App Inventor to monitor the toilet’s status.
5. The Android application receives information from the Ubidots cloud using the HTTP protocol. Refer to the complete system framework diagram below.
System Framework Diagram
Installation Steps:
1. Install the Walabot SDK on the Raspberry Pi. Follow the getting started guide on Sparkfun.com.
2. Install the Paho MQTT client on the Raspberry Pi. Use the Raspberry Pi terminal command:
sudo pip install paho-mqtt
3. Create an account on Ubidots.com and note down the device token.
ID
4. Install the Ubidots API on the Raspberry Pi. Enter the following command in the Pi terminal:
sudo pip install ubidots
Note down your Ubidots API key:
5. Develop a Python program for the Raspberry Pi.
To find the right configuration parameters (R, pi, theta), I used the Walabot SDK on Windows to test different objects at different orientations. The values I chose are mentioned in the Python code.
I lowered the threshold for detecting small objects.
minInCm, maxInCm, resInCm = 30, 300, 3
minIndegrees, maxIndegrees, resIndegrees = -15, 15, 5
minPhiInDegrees, maxPhiInDegrees, resPhiInDegrees = -30, 30, 5
threshold = 2
Testing with Windows SDK
After developing the Python program and Android application, I manually tested the system to see if the entire system was working properly. (The Python program and Android source code are attached in the code section).
In the final code, I updated the R value. For the testing setup, it was set very small for the edge test.
This is the logical relationship implemented in the program to identify whether there is someone in the restroom and whether the restroom is clean.
6. Develop the Android application in MIT App Inventor
The source code files are attached in the code section.
MIT App Inventor is an open-source web application originally provided by Google and is now maintained by the Massachusetts Institute of Technology (MIT).
It allows beginners to perform computer programming and create software applications for the Android operating system (OS). It uses a graphical interface very similar to Scratch and the StarLogo TNG user interface.
It allows users to drag-and-drop visual objects to create applications that run on Android devices.
If you are a beginner with App Inventor, follow these beginner tutorials. If you want to use additional resources, you can modify the HTTP URL.
Change URL: http://things.ubidots.com/api/v1.6/datasources/YOUR_OWN_DEVICE_ID/variables/?token=YOUR_OWN_TOKEN
Just replace YOUR_OWN_DEVICE_ID with your device ID and YOUR_OWN_TOKEN with your Ubidots token. Then build the .apk file and install it on your phone.
The new .apk file token and device ID are taken from the user and stored in the device memory for future use.
Using a database
The Android app can be found in the Google Play Store. You can install it from the Play Store to your smartphone.
The link is: https://play.google.com/store/apps/details?id=appinventor.ai_khairul_uapstu.toilet
Part of the demonstration images
Application screenshots
Framework Diagram
The framework diagram shows how the entire system works.
Database Configuration
Using App Inventor for Application Development
The Android application (.apk file) can be downloaded from the file library at http://maker.quwj.com/project/77
The Android source code file (MIT App Inventor) can be downloaded from the file library at http://maker.quwj.com/project/77
Code
Python code for Raspberry Pi. It can be downloaded from the project file library at http://maker.quwj.com/project/77
Project file library address:
http://maker.quwj.com/project/77
via hackster.io/taifur/toilet-tracker-powered-by-walabot-08f6ab
Links in the text can be clicked to read the original text at the end
More Exciting Content
Creating an Automatic Irrigation System with Raspberry Pi
UltraV: Portable UV Index Meter
Easily Implementing Deep Learning Object Detection on Raspberry Pi
DIY WI-FI Remote-Controlled Boat with ESP32 Development Board