Toilet Occupancy Notifier Built Based on ESP32 and Home Assistant
by botland in Circuits > Sensors
277 Views, 3 Favorites, 0 Comments
Toilet Occupancy Notifier Built Based on ESP32 and Home Assistant
The toilet - it may seem a bit inconspicuous, but in fact it is one of the key points supporting comfort, especially in a dynamic office environment. At the company, our daily challenge became the perpetual queue for the bathroom. As the number of employees increased, the number of available toilets remained constant, resulting in increasing levels of frustration and wasted time trying to get to the restroom.
We realized that we couldn't change the number of available toilets, but we could optimize the way people were informed of their availability.
Our solution is based on an intelligent system consisting of two types of devices. First, we have a main module located above the toilet door that informs people about the status of the toilet. Second, we have wireless beacons placed in various locations around the office. The entire system is based on a Raspberry Pi, with Home Assistant as the main management system. As a result, all devices are connected via WiFi. The ESP32-based modules connect to the network and are integrated into the system via an add-on to Home Assistant, known as ESPHome.
With this innovative approach, employees can now easily check if a toilet is available before they go there. It's a simple but effective solution that has greatly improved the workplace experience and reduced the frustration of waiting in line for the restroom.
Supplies
Main module
- Used elements
- Printout - original found on Thingiverse (adapted as needed)
- ESP32 WiFi + BT 4.2
- Relay module 1 channel
- Power LED 1 W
- Electrical cube 4pin
- Mean Well RS-15-5*
- Filaments
- Print-Me EcoLine PLA Filament 1.75mm 1kg - Anthracite Black
- Filament Devil Design PETG 1,75mm 1kg - Green Transparent
- Filament Spectrum PETG 1,75mm 1kg - Transparent Red
Indicator
- Used elements
- Printout - original found on Thingiverse (adapted as needed)
- ESP32 WiFi + BT 4.2
- Relay module 2 channels
- Power LED Star 1 W
- Power Supply 5V/4A*
- DC 5.5×2.5mm socket for the case*
- Electric cube 4pin 32A/400V
- Filaments
- Print-Me EcoLine PLA 1,75mm 1kg – Anthracite Black
- Filament Spectrum PETG 1,75mm 1kg – Transparent Red
- Filament Devil Design PETG 1,75mm 1kg – Blue Transparent
* - depending on the need, you can use an socket or built-in power supply, it depends on the availability of a power outlet, aesthetics and the size of the printed case.
Home Assistant With ESPHome
In our project, we used a Raspberry Pi 4B 4GB with Home Assistant installed. To make the whole thing work properly and without problems we used the HA add-on ESPHome, details about the add-on can be found on their website.
There is very extensive documentation on the site, which makes installing, configuring and using the add-on much easier.
Main Module
Previously prepared ESP32 module in a case is mounted above the door frame, but how does it know that the door is closed? To do this, I used a piece of Plexiglas and springs from a battery basket and placed it in the doorframe. One spring is connected to ground and the other to the signal pin on the ESP. The door lock closes the circuit and the ESP receives information about this fact. The relay then switches the LEDs from green to red and the module sends the information to the Home Assistant.
- Green - vacant
- Red - occupied
Indicator
After the main modules mounted above the toilet doors send a signal to the Home Assistant, the corresponding automation is triggered to control the ESP32s tucked inside the indicators. It outputs 2 signal pins that trigger the corresponding relays. Unlike the main modules, when the toilet is unoccupied no light is illuminated, only when the door in one of the two toilets is locked, the LEDs located in the corresponding segment of the indicator are lit, indicating that the toilet is occupied.
- red - men's restroom
- blue - women's toilet
Currently, the system has been in operation at our facility since November 2021 and has significantly improved work comfort.