Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🚰 Smart Water Tap

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.


📌 Features

  • 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.
  • 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.

🛠️ Hardware Requirements & Bill of Materials (BoM)

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

⚙️ How It Works

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 ]

State Machine Behavior

  1. Idle: System awaits detection ($D \le 11\text{ cm}$).
  2. Active Flow: Solenoid opens and LED remains solid ON.
  3. 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.
  4. Warning Window: At the $50\text{ second}$ mark of continuous operation, the LED flashes rapidly to signal an impending hard shutoff.
  5. 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.

🔌 Pin Mapping

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)

📐 Circuit Diagram

In Development

About

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.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages