Smart Water Dispenser
A personalized water dispenser designed for your everyday health. Foundation of life starts with water.
Demo Video
Motivation - Why did I build this?
Main Function of my Project
- My project is a water dispenser that pours water through a pump. It gets activated with a small button, and it exaclty pours water for 1 minute an 20 seconds (~ 135 ml)
Gallery




Downloadable Files
Components Used
- Seeeduino XIAO ESP32 microcontroller
- Relay module (for 5V pump)
- Submersible water pump
- Ultrasonic sensor (HC-SR04)
- I2C LCD 16x2
- Pushbutton and buzzer
Wiring Diagram

Arduino Code (Generated with the help of AI technology)
Arduino Code
// Pin assignments
const int A1A = D6; // Motor speed control
const int A1B = D7; // Motor direction control
const int buttonPin = D2; // Button input
bool isDispensing = false;
unsigned long dispenseStartTime = 0;
void setup() {
pinMode(A1A, OUTPUT);
pinMode(A1B, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP); // Button between D2 and GND
digitalWrite(A1A, LOW); // Ensure motor starts OFF
digitalWrite(A1B, LOW);
Serial.begin(9600);
}
void loop() {
if (isDispensing) {
// Check if 80 seconds have passed
if (millis() - dispenseStartTime >= 80000) {
digitalWrite(A1A, LOW);
digitalWrite(A1B, LOW);
isDispensing = false;
Serial.println("done dispensing");
}
} else {
Serial.println("waiting for button press");
if (digitalRead(buttonPin) == LOW) {
Serial.println("button pressed");
digitalWrite(A1A, LOW);
digitalWrite(A1B, HIGH);
dispenseStartTime = millis();
isDispensing = true;
// Wait for button release
while (digitalRead(buttonPin) == LOW) {
Serial.println("button is still being pressed");
delay(10);
}
}
}
}
Future Improvements
- Wi-Fi + app control integration
- Rotary encoder for dynamic volume
- Battery backup and water level monitor
Development Process
Here’s how I built, tested, and refined the Smart Water Dispenser.
Materials Used
- XIAO ESP32 C3
- TFT Screen
- 3d printed water drain (designed with fusion)
- Jumper wires
- Male to Female end wires
- Button
- Duct Tape
- 3V Motor
- Water pump
- 3.00mm Medium Wood
- LCD 16x2 I2C
- Submersible pump
- 3D printed nozzle mount + holder
Step 1: Sketch & Planning
Defined goals: I made my first general sketches of my project on a white piece of paper with a pen and ruler. I divided my water dispenser into 2 parts: 1) The drainer box - When user in case continues to dispense water without a cup/bottle, the water will flow into the draining box instead of spilling everywhere. I also searched up on Google with reasonable size dimensions for a water dispenser.
Step 2: Sketch & Planning
Defined goals: automate hydration, safe volume control, and simple UX. Sketched system logic and listed required hardware components.
Step 2: Electronics Prototyping
Tested the pump, relay, ultrasonic sensor, buzzer, and LCD on a breadboard. Verified safe voltage levels and stable component behavior.
Step 3: Arduino Code
Used millis()
for timing, pulseIn()
for distance sensing, and created modular functions for scheduling, safety, and feedback.
Step 4: CAD & 3D Printing
Designed and printed a nozzle mount and bottle holder in Fusion 360. Parts were tested and iterated for stability, spacing, and waterproofing.
Step 5: Final Assembly & Testing
Components soldered on perfboard, secured inside the printed shell. Calibrated ultrasonic readings and pump timing (~200ml). Debugged button debounce and edge cases.