The idea for this project came from a common experience that many people face in public places. Users often have no idea whether a restroom stall is occupied until they reach the door, leading to unnecessary waiting and congestion. At the same time, maintenance teams depend on routine inspections instead of actual restroom usage, making it difficult to know when cleaning or restocking is really needed.
We wanted to design a smarter solution that improves convenience for users while also helping facility managers maintain hygiene more efficiently. Privacy was one of our biggest priorities, so rather than using cameras, we chose a Time-of-Flight sensor that detects presence without capturing any images.
How the System WorksOccupancy Detection
The VL53L0X Time-of-Flight sensor continuously measures the distance between itself and objects inside the restroom.When someone enters and the measured distance becomes less than 600 mm, the system identifies the restroom as occupied. The OLED display immediately changes to "OCCUPIED", and the red LED turns on while the green LED turns off.
Once the person leaves and the measured distance increases beyond the threshold, the system updates the display to "VACANT" and switches the LEDs accordingly.
Restroom Usage Counter
Every time the restroom changes from Vacant to Occupied, the system records one usage.
This information can later help facility managers:
- Schedule cleaning based on actual usage.
- Understand restroom traffic.
- Identify peak usage hours.
Instead of cleaning on fixed schedules, maintenance can become more efficient and data driven.
Soap Dispenser Monitoring
To improve hygiene management, an FSR sensor is placed beneath the soap dispenser button.
Each time the dispenser is pressed:
- One soap usage is recorded.
- The usage counter increases.
- When the predefined limit is reached, the system generates a "RESTOCK SOAP" alert.
Although this method estimates soap consumption rather than measuring the exact amount remaining, it provides a simple and low-cost way to remind maintenance staff before the dispenser becomes empty.
Working flowUser enters restroom ➡️ VL53L0X ToF sensor detects occupancy.
XIAO ESP32 processes the distance data ➡️ Restroom status changes to "Occupied".
OLED display updates in real time ➡️ Red LED indicates the stall is occupied.
User leaves the restroom ➡️ ToF sensor detects the stall is vacant.
ESP32 updates the occupancy status ➡️ OLED displays "Available" and Green LED turns ON.
Each Vacant → Occupied transition is counted ➡️ Restroom usage counter is incremented.
FSR monitors soap dispenser usage ➡️ Soap usage level is updated continuously.
Soap usage reaches the configured threshold ➡️ "RESTOCK SOAP" alert is displayed for maintenance staff.
The prototype consists of the following hardware:
- Seeed Studio XIAO ESP32S3
- VL53L0X Time-of-Flight Distance Sensor
- SSD1306 0.96-inch OLED Display
- Force Sensitive Resistor (FSR)
- Red LED
- Green LED
- 220 Ω resistors
- 10 kΩ resistor
- Breadboard
- Jumper wires
- USB cable
Each component was selected to keep the system compact, affordable, and energy efficient.
Software UsedThe project was developed using the Arduino ecosystem.
Software and libraries include:
- Arduino IDE
- ESP32 Board Package
- Adafruit SSD1306 Library
- Adafruit GFX Library
- Adafruit VL53L0X Library
- Wire Library
These libraries simplify communication with the display and sensors, allowing the ESP32S3 to process sensor data efficiently.
System ArchitectureThe project is organized into four simple layers.
Sensor Layer
The sensors collect information from the environment.
- The VL53L0X detects whether the restroom is occupied.
- The FSR detects soap dispenser presses.
Processing Layer
The XIAO ESP32S3 receives sensor data, processes it, updates counters, and controls the output devices.
Output Layer
The processed information is presented through:
- OLED display
- Green LED for VACANT
- Red LED for OCCUPIED
- Serial Monitor for debugging and logging
Future IoT Layer
Since the ESP32S3 includes built-in Wi-Fi, the system can later connect to:
- Cloud dashboards
- Mobile applications
- Maintenance notifications
- Real-time analytics
The prototype was built in several simple steps.
- Connect the OLED display using the I²C interface.
- Connect the VL53L0X sensor to the same I²C bus.
- Connect the red and green LEDs through 220 Ω resistors.
- Build the FSR voltage divider using a 10 kΩ resistor.
- Upload the Arduino program.
- Test occupancy detection.
- Verify soap usage counting.
- Mount the hardware inside a demonstration enclosure.
Our system offers several useful features:
- Privacy-friendly occupancy detection
- Real-time restroom availability
- OLED status display
- LED occupancy indicators
- Automatic usage counting
- Soap dispenser monitoring
- Restock alerts
- Compact design
- Low power consumption
- Ready for IoT expansion
Compared to conventional restroom management, our system provides several benefits.
- Reduces unnecessary waiting.
- Improves user convenience.
- Supports better restroom hygiene.
- Optimizes maintenance schedules.
- Helps prevent soap shortages.
- Uses inexpensive hardware.
- Is easy to install and maintain.
- Can be expanded with additional smart features.
Our project also supports sustainable facility management.
By using actual restroom usage instead of fixed schedules, cleaning resources can be used more efficiently. Soap wastage is reduced because maintenance staff receive timely refill reminders. The system also consumes very little power thanks to the energy-efficient ESP32S3.
Most importantly, our design protects user privacy by avoiding cameras entirely while still providing reliable occupancy detection.
ApplicationsThe system can be deployed in many public facilities, including:
- Restaurants
- Hotels
- Shopping malls
- Airports
- Railway stations
- Colleges
- Universities
- Hospitals
- Office buildings
- Smart city infrastructure
During development, we encountered several technical challenges.
The occupancy threshold required careful calibration to ensure accurate detection. We also needed to prevent multiple soap counts from a single dispenser press. Since both the OLED display and ToF sensor communicate over I²C, proper integration was essential. Another challenge was updating the OLED smoothly without affecting sensor performance. Finally, we tested the system under different environmental conditions to ensure reliable occupancy detection.
Future ImprovementsThis prototype can be extended with several advanced features, including:
- Cloud-based monitoring dashboard
- Mobile application
- Push notifications for maintenance staff
- Real-time analytics
- Multiple restroom stall monitoring
- AI-based prediction of peak usage
- Load-cell-based soap level measurement
- Integration with smart building management systems
- Battery backup
- Solar-powered operation
- Tissue and paper towel monitoring
These additions would transform the prototype into a complete smart restroom management solution.
ConclusionThe Smart Restroom Occupancy & Hygiene Monitoring System shows how affordable embedded technology can solve everyday problems in public facilities. By combining occupancy detection, restroom usage tracking, and soap dispenser monitoring into a single compact platform, the system improves user convenience while helping maintenance teams make better decisions based on real-time data.
Built around the Seed Studio XIAO ESP32S3, the project is energy efficient, privacy-friendly, and ready for future IoT integration. With its modular design and low implementation cost, it has the potential to enhance restroom management in restaurants, shopping malls, hospitals, educational institutions, airports, offices, and future smart city infrastructure.















_LWNORVejBN.png?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)




Comments