An automated, touchless water dispenser powered by an ESP32 and Time-of-Flight (ToF) sensing. Built with FreeRTOS to deliver non-blocking multi-tasking, precise hardware timing, and built-in anti-water-wastage safeguards.
-
Touchless Operation: Detects hand presence within an
$11\text{ cm}$ threshold using a precision optical Time-of-Flight sensor. -
Anti-Wastage Timers:
-
Overrun Protection: Maintains water flow for
$5\text{ seconds}$ after hand removal to allow smooth soap rinsing, then automatically shuts off. -
Hard Timeout: Enforces a strict
$1\text{ minute}$ continuous usage cap. -
Automated Lockout: Implements a mandatory
$10\text{ second}$ cooldown period after a 1-minute timeout to prevent continuous drain abuse.
-
Overrun Protection: Maintains water flow for
- Visual Feedback: Integrated LED status indicator with early-warning flashing sequences prior to automated shutoff.
- FreeRTOS Architecture: Decoupled sensor acquisition and state control loops using multi-threaded task pinning and thread-safe mutex protections.
| Component | Quantity | Description / Model |
|---|---|---|
| Microcontroller | 1 | ESP32 Development Board |
| Distance Sensor | 1 | VL53L0X Time-of-Flight (ToF) Sensor |
| Actuator | 1 | 12V Solenoid Water Valve (Normally Closed) |
| Switching Circuit | 1 | N-Channel MOSFET Module / Relay Board |
| Status Indicator | 1 | Standard LED + 220Ω Resistor |
| Power Supply | 1 | 12V DC Adapter + 5V Voltage Regulator (Buck converter) |
| Tubing / Fittings | - | Compatible plumbing hardware for solenoid |
The system continuously samples the distance between the tap nozzle and the user's hand using an I2C-connected VL53L0X Time-of-Flight sensor. An ESP32 processes sensor values asynchronously and manages a finite state machine (openTap) controlling a high-current solenoid valve via MOSFET switching.
[VL53L0X Sensor] ---> (I2C) ---> [ ESP32 (FreeRTOS Core 1) ] ---> [ MOSFET Switch ] ---> [ Solenoid Valve ]
|
(Status Indicator)
|
[ LED Pin ]
-
Idle: System awaits detection (
$D \le 11\text{ cm}$ ). - Active Flow: Solenoid opens and LED remains solid ON.
-
Overrun (5s): Hand is removed before 1 minute; water remains ON for
$5\text{ seconds}$ then turns OFF. If hand returns during overrun, active flow resumes seamlessly. -
Warning Window: At the
$50\text{ second}$ mark of continuous operation, the LED flashes rapidly to signal an impending hard shutoff. -
Hard Limit Shutoff: Water turns OFF at
$60\text{ seconds}$ . The system blocks reactivation until the user pulls their hand away ($D > 11\text{ cm}$ ) and completes a mandatory$10\text{ second}$ cooldown.
| Peripheral | ESP32 GPIO | Description |
|---|---|---|
| Solenoid MOSFET | GPIO 19 |
Controls high-side switching for 12V valve |
| Indicator LED | GPIO 4 |
Status and warning signal output |
| VL53L0X SDA | GPIO 21 |
I2C Data Line (Default) |
| VL53L0X SCL | GPIO 22 |
I2C Clock Line (Default) |
In Development