Build a Smart Hydration Reminder Bottle!
A super fun robotics project where your bottle tells you when to drink water — with lights, buzzer sounds, and Arduino code!
Why Build This?
Did you know that kids need to drink around 6–8 glasses of water every day? But when you're busy playing games or studying, it's really easy to forget! That's a problem robots can solve! 🦾
In this project, you'll build a Smart Hydration Reminder Bottle using an Arduino UNO, an ultrasonic sensor, LEDs, and a buzzer. The bottle watches how long it's been since you last drank water. If it's been too long, it buzzes and flashes lights to remind you!
What you'll learn: How sensors work, how to write Arduino code, how to wire up a circuit, and how robots can help us stay healthy!
What You Need 🛒
Collect all these parts before you start. You can find most of them at an electronics shop or online!
Arduino UNO
The "brain" of the project. Runs our code!
HC-SR04 Ultrasonic Sensor
Detects if the bottle is being lifted or tilted.
3 LEDs (Red, Yellow, Green)
Show hydration status with colors like a traffic light.
Piezo Buzzer
Makes a beeping sound when it's time to drink!
9V Battery + Clip
Powers everything without needing a computer.
Breadboard
Makes connecting wires easy, no soldering needed!
Jumper Wires (20+)
Male-to-male and male-to-female connectors.
3x 220Ω Resistors
Protect the LEDs from too much electricity.
Plastic Water Bottle
Any bottle will do — this becomes your smart device!
Computer + USB Cable
For uploading code to the Arduino with the free Arduino IDE.
Total Cost: Most of these parts together cost around ₹500–₹800 (about $6–$10 USD). Arduino starter kits often include most of these items!
How It Works 🤔
Let's understand the big idea before we build! This project uses a clever combination of a sensor, a timer, and alerts to create a helpful robot assistant.
Sensor Detects
The ultrasonic sensor measures distance. When you pick up the bottle, the distance reading changes!
Timer Counts
Arduino counts how many minutes have passed since you last drank water.
LEDs Show Status
Green = Great! Yellow = Drink soon. Red = You forgot to drink! Like a traffic light for hydration.
Buzzer Alerts You
After 30 minutes without drinking, the buzzer beeps to get your attention!
The Science Bit: Ultrasonic sensors work like bat echolocation — they send out a sound pulse and measure how long it takes to bounce back. A closer object = shorter bounce time. We use this to detect when the bottle moves!
Circuit Diagram & Wiring 🔌
Here's how to connect everything. Follow this wiring table carefully — getting it right is the most important part!
Wiring Connection Table
Use this table as your guide when building on the breadboard:
| Component | Component Pin | Arduino Pin | Wire Color |
|---|---|---|---|
| HC-SR04 Sensor | VCC | 5V | 🔴 Red |
| HC-SR04 Sensor | GND | GND | ⚫ Black |
| HC-SR04 Sensor | TRIG | Pin 2 | 🟠 Orange |
| HC-SR04 Sensor | ECHO | Pin 3 | 🟣 Purple |
| Green LED (+ Resistor) | Anode (+) | Pin 7 | 🟢 Green |
| Yellow LED (+ Resistor) | Anode (+) | Pin 8 | 🟡 Yellow |
| Red LED (+ Resistor) | Anode (+) | Pin 9 | 🔴 Red |
| All LED Cathodes (–) | Cathode (–) | GND | ⚫ Black |
| Piezo Buzzer | Positive (+) | Pin 10 | 🔵 Blue |
| Piezo Buzzer | Negative (–) | GND | ⚫ Black |
LED Tip: Always put the 220Ω resistor in series with each LED! The longer leg of the LED is the positive (+) side (anode). Without resistors, you'll burn out your LEDs!
Step-by-Step Build Guide 🔧
Follow these steps in order. Take your time — rushing causes mistakes!
Install the Arduino IDE
Download and install the free Arduino IDE from arduino.cc/en/software. Connect your Arduino UNO with a USB cable. Open the IDE and select your board from Tools → Board → Arduino UNO, then choose your port.
Set Up the Breadboard
Place your breadboard on your work surface. The two long rows on the sides are power rails — connect the red rail to Arduino 5V and the blue rail to Arduino GND with jumper wires. This makes powering components much easier!
Place & Wire the HC-SR04 Sensor
Push the HC-SR04 sensor into the breadboard. Connect VCC → red power rail, GND → blue ground rail, TRIG → Arduino Pin 2, and ECHO → Arduino Pin 3. Mount the sensor on the side of your bottle facing outward (it should be able to "see" the table below).
Add the Three LEDs
Place each LED in the breadboard. Always put a 220Ω resistor between the LED's positive leg and the Arduino pin. Connect Green LED to Pin 7, Yellow to Pin 8, Red to Pin 9. Connect all negative legs (short legs) to the ground rail.
Connect the Buzzer
Place the piezo buzzer on the breadboard. Connect the positive (+) leg to Pin 10 and the negative (–) leg to ground. Piezo buzzers usually have a small + symbol on the top. If you're not sure which leg is positive, the longer one is typically positive.
Double-Check Everything!
Before uploading code, check every connection against the wiring table. Make sure no wires are loose or crossed. A common mistake is connecting sensor VCC to 3.3V instead of 5V — the HC-SR04 needs 5V to work properly!
Upload the Code
Copy the code from the section below into the Arduino IDE. Click the ✓ checkmark to verify it compiles without errors, then click the → arrow to upload it to your Arduino. You'll see orange LEDs flash on the board as it uploads!
Mount Everything on the Bottle
Once it's working, use rubber bands or tape to mount the breadboard/Arduino to the side of your water bottle. Point the HC-SR04 sensor downward so it can detect the bottle resting on a table (it reads the distance to the table surface). Drink water and watch the magic happen!
The Full Code 💻
Copy this code exactly into your Arduino IDE. Every line has a comment explaining what it does — this is how real engineers write code!
// ╔═══════════════════════════════════════════════════╗ // ║ Smart Hydration Reminder Bottle ║ // ║ MakeMindz Robotics Project ║ // ║ Remind yourself to drink water with Arduino! ║ // ╚═══════════════════════════════════════════════════╝ // ── Pin Definitions ────────────────────────────────── const int TRIG_PIN = 2; // HC-SR04 Trigger const int ECHO_PIN = 3; // HC-SR04 Echo const int LED_GREEN = 7; // Green LED (hydrated!) const int LED_YELLOW = 8; // Yellow LED (drink soon) const int LED_RED = 9; // Red LED (drink NOW!) const int BUZZER_PIN = 10; // Piezo Buzzer // ── Settings ───────────────────────────────────────── const long WARN_TIME = 20L * 60 * 1000; // 20 min = yellow const long ALERT_TIME = 30L * 60 * 1000; // 30 min = red+buzz const int LIFT_DIST = 10; // cm threshold // ── Variables ───────────────────────────────────────── unsigned long lastDrinkTime = 0; // when you last drank bool bottleWasDown = true; // was bottle on table? // ───────────────────────────────────────────────────── void setup() { // Set up sensor pins pinMode(TRIG_PIN, OUTPUT); pinMode(ECHO_PIN, INPUT); // Set up output pins pinMode(LED_GREEN, OUTPUT); pinMode(LED_YELLOW, OUTPUT); pinMode(LED_RED, OUTPUT); pinMode(BUZZER_PIN, OUTPUT); // Start serial monitor for debugging Serial.begin(9600); Serial.println("💧 Smart Bottle Ready!"); // Record current time as "last drink" lastDrinkTime = millis(); // Startup blink: all LEDs flash 3x for (int i = 0; i < 3; i++) { digitalWrite(LED_GREEN, HIGH); digitalWrite(LED_YELLOW, HIGH); digitalWrite(LED_RED, HIGH); delay(200); digitalWrite(LED_GREEN, LOW); digitalWrite(LED_YELLOW, LOW); digitalWrite(LED_RED, LOW); delay(200); } } // ───────────────────────────────────────────────────── long getDistanceCm() { // Send ultrasonic pulse digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2); digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10); digitalWrite(TRIG_PIN, LOW); // Measure echo duration long duration = pulseIn(ECHO_PIN, HIGH, 30000); // Convert to cm (speed of sound = 343 m/s) // distance = (duration / 2) / 29.1 return duration / 58; } // ───────────────────────────────────────────────────── void setStatus(bool green, bool yellow, bool red) { // Turn LEDs on or off based on parameters digitalWrite(LED_GREEN, green ? HIGH : LOW); digitalWrite(LED_YELLOW, yellow ? HIGH : LOW); digitalWrite(LED_RED, red ? HIGH : LOW); } // ───────────────────────────────────────────────────── void alertBuzz() { // Play 3 short beeps to get attention for (int i = 0; i < 3; i++) { tone(BUZZER_PIN, 880, 200); // 880Hz = A5 note delay(300); } } // ───────────────────────────────────────────────────── void loop() { long dist = getDistanceCm(); Serial.print("Distance: "); Serial.print(dist); Serial.println(" cm"); // Detect if bottle was lifted (distance increases when lifted) bool bottleIsUp = (dist > LIFT_DIST); // If bottle just went UP → user is probably drinking! if (bottleIsUp && bottleWasDown) { lastDrinkTime = millis(); // reset the timer Serial.println("🥤 Drink detected! Timer reset."); // Celebrate with a happy beep tone(BUZZER_PIN, 1047, 100); // C6 note delay(150); tone(BUZZER_PIN, 1319, 150); // E6 note } // Remember position for next loop bottleWasDown = !bottleIsUp; // Calculate how long since last drink unsigned long elapsed = millis() - lastDrinkTime; // ── Hydration Status Display ── if (elapsed < WARN_TIME) { // Under 20 mins: All good! Green light setStatus(true, false, false); Serial.println("✅ Hydrated! Green"); } else if (elapsed < ALERT_TIME) { // 20–30 mins: Getting thirsty. Yellow warning setStatus(false, true, false); Serial.println("⚠️ Drink soon! Yellow"); } else { // Over 30 mins: DRINK NOW! Red + buzzer setStatus(false, false, true); alertBuzz(); Serial.println("🚨 DRINK WATER NOW! Red"); } delay(1000); // Check once every second }
Understanding the Code: The millis() function counts milliseconds since the Arduino turned on. We compare the current time to when we last detected the bottle being lifted to know how long it's been since you drank. Simple but clever!
Testing Your Smart Bottle 🧪
Let's make sure everything works before declaring success!
Quick Tests to Run
Startup Test
When powered on, all three LEDs should flash 3 times. This means the code loaded correctly. Open the Serial Monitor in Arduino IDE (magnifying glass icon) to see debug messages.
Lift the Bottle Test
Place the bottle on a table. Pick it up and put it down. You should hear a small happy beep and see "Drink detected!" in the Serial Monitor. The timer resets!
Fast-Forward Warning Test
Temporarily change WARN_TIME to 10L * 1000 (10 seconds) and ALERT_TIME to 20L * 1000 (20 seconds) to quickly test the yellow and red LED stages without waiting 30 minutes!
Troubleshooting: LEDs not lighting? Check the resistors and LED direction. Sensor not responding? Check TRIG/ECHO connections to pins 2 and 3. No upload? Make sure the correct COM port is selected in Tools → Port.
Cool Upgrades to Try 🚀
Once your basic bottle is working, try these exciting enhancements to make it even smarter!
-
Add a Bluetooth Module (HC-05) Send hydration alerts to your phone! The HC-05 module connects via Bluetooth and can communicate with a simple Android app.
-
LCD Display (I2C 16x2) Show a countdown timer like "Next drink in: 8 mins" on a small screen. Wire it to the Arduino's I2C pins (A4 and A5).
-
Temperature Sensor (DHT11) Drink more water when it's hot! Add a DHT11 sensor to reduce the reminder timer automatically on warm days.
-
Daily Log with SD Card Module Record every sip with a timestamp on an SD card! You can then graph your drinking habits on a computer.
-
Play a Melody Instead of Beeps Use the tone() function to play a fun little song (like "Happy Birthday" or your favourite game music) instead of plain beeps!
-
Weight Sensor (HX711 Load Cell) Put the bottle on a weight scale. The Arduino can calculate exactly how much water you've drunk by comparing the bottle's weight!
Safety Tips ⛑️
Electronics are super fun, but let's stay safe while building!
Change connections only when the Arduino is disconnected from power.
Don't drink directly from the bottle while the circuits are attached!
If you're under 12, have a parent or teacher nearby when building.
Never let red (+) and black (–) wires touch directly — it can make the battery very hot.
Bend pins carefully. Don't force connectors — if it's not going in easily, check the orientation.
Never throw batteries in the bin! Take them to a local battery recycling point.
Congratulations, Maker! 🎉
You've just built a real working IoT health device — the same kind of idea that engineers at companies like Apple and Fitbit work on! Your Smart Hydration Reminder Bottle uses sensors, timers, and actuators (LEDs + buzzer) to solve a real everyday problem.
Here's what you mastered in this project:
Circuit Design
Wiring sensors, LEDs, and buzzers to a microcontroller safely.
Arduino Coding
Writing C++ code with functions, conditionals, and timers.
Sensor Reading
Using ultrasonic pulses to detect distance and motion.
Problem Solving
Turning a real-world health problem into a tech solution!
Share Your Build! Take a photo or video of your Smart Hydration Bottle and share it with your school, friends, or on your class blog. You've earned it — you're a real maker now!

Comments
Post a Comment