December 2024 · University of Waterloo · 4-person team
The Autonomous Faucet Robot is a hands-free handwashing system that automates both water flow and soap dispensing. It uses ultrasonic sensors to detect hands, motors to turn faucet handles, and a rack-and-pinion soap dispenser. The system was built using LEGO EV3 components and programmed in C.
The software was designed using a modular approach where each major robot subsystem had its own dedicated functions. This made the code easier to debug, test, and extend. The main subsystems were faucet control, temperature control, soap dispensing, the EV3 display, and file-based temperature saving.
controlFaucetHandles()
Polls the ultrasonic sensor and keeps the faucet running while hands are detected. Turns off automatically when hands are removed.
getWaterTemperature()
Uses a second ultrasonic sensor to determine temperature based on hand distance. Three zones: cold (0-15cm), medium (15-30cm), hot (30cm+).
displayTemperatureBar() / displayTimerBar()
Draws shaded rectangles on the EV3 display to show current temperature and hand-wash timer in real time.
savePreferredTemp() / getPreferredTemp()
File I/O functions that save and load the last temperature setting using EV3 button inputs.
configureSensors()
Initializes all sensors and motors at startup.
Switched from encoder counts to timer delays for closing faucet handles. Encoder counts were inconsistent due to handle stiffness, so the open duration was measured and used as the closing delay instead.
Temperature control was simplified from per-centimetre mapping to three fixed zones since the ultrasonic sensors were not accurate enough to detect small changes in hand distance.