Smart Hydration System

author Ioana Cristea ACES 2021

1.Project Objective

The idea behind this project is to keep the customer hydrated.
This will be achieved by determining the amount of water inside a water glass and sending email notifications based on how much and when does the user drink from it.

2.Project Description

The Smart Hydration System consists of a glass that is monitored in order to give feedback to the user regarding the water he drank.
Each time the user does not drink water, an email notification will be sent.
The email notification will arrive at an interval established by the user.
If the user does not drink in the interval specified, and did not receive an email during this period, than a new email will be sent.
For a visual feedback, there is a led bar indicating the level of the water.
The platform used for programming the Intel Galileo board is Arduino IDE.

3.Hardware Description

The hardware system consists of:

  • ESP32 Wroom Board
    • The ESP Wroom Board controls the entire system. It sends the emails to the user, it monitors the water level and gives feedback.
    • This board can be used with the Arduino IDE.

 ESP32 Wroom Board

  • HC-SR04 Ultrasonic Sensor
    • The ultrasonic sensor is used to determine the distance to the water, which gives the ESP32 Board the chance of deducing when the user drank last time water.
    • The concept behind the ultrasonic distance sensor is the following: when triggered, the device sends a ultrasonic wave forward; this wave is reflected on the nearest surface and is expected back to the ultrasonic sensor; the device rises a signal on the whole period of time between the sending of the wave and the receiving of the reflected wave; this signal represents the duration, therefore, to find the distance between the sensor and the nearest surface the formula d = v*t/2 is used (the 2 factor is a result of measuring the time for both the emitted and reflected waves).
    • The ultrasonic sensor has the role to measure the level of water within the glass. This level is measured at every iteration of the program loop.
    • The trigger signal is linked to the digital GPIO 33, the echo signal is linked to the GPIO 25, the VCC signal is linked to 5V and the ground signal is linked to GND.

 HC-SR04 Ultrasonic Distance Sensor

  • Led Bar
    • The Led Bar is not a necessary component, but it gives some more feedback to the user.
    • The led bar is formed by 10 parallel leds.
    • Each led is enseried with a 220 ohm resistance to protect them from burning out.
    • For this project only 4 leds were used to offer a visual representation of the water lever, the more leds are turned on, the higher the water level is.
    • The 4 leds are linked to the pins 12,14,27,26.
    • The Led Bar has all the LEDs on when the glass is full in order to attract the user and make him feel like he needs to drink water.
    • When the glass is empty, all the LEDs are off, these would not attract the user. This would be more effective if the glass would fill automatically (from a barrel of 2l per day).

 10 LED Bar

  • Glass of water
    • The water glass is a normal glass, on top of which the ultrasonic sensor is placed.
    • This glass was supposed to be filled automatically, but the water pump did not work in my configuration because of the current provided by the board pins. This could have been resolved with a current amplificator, but I didn't have the necessary components for implementing this.

The Hardware Diagram looks like this:  Hardware Diagram

4.Software Description

The Intel Galileo board was programmed using the Arduino IDE. The program is based on the two well-known functions: setup() and loop().
The setup() function ensures that each pin has the right direction set.
It also starts the server with the webpage.

The loop() function represents the core of the software project. This function is executed in a forever loop in which the following steps are followed:

  • Get the last time the user has drank water
  • Get the last time an email was sent
  • Calculate the distance from the ultrasonic sensor to the water within the glass
  • Based on the distance calculated, a number of LEDs will be lit up: as the level rises more LEDs will be lit up (the maximum distance is split into 4 intervals, representing the 4 LEDs )
  • The current level of water is compared to the last level of water in order to check if the user has drank water
  • If the user hasn't drank in a specific period of time (taken from the web page), an email notification is sent
  • If the water glass is full, the whole process is repeated, otherwise, the pump will start working, filling the glass with water (in this time the level of water is also checked)

 The software diagram

5.Issues and Solutions

This project, as any project presented some technical issues.
The main problem was that the water pump did not function connected directly to a digital pin.
I came to figure out that this could be resolved using a current amplifier, although I didn't have the components necessary to implement it.


This project shows how easy is to make everyday life more simple. Using only a handful of components and taking some time to investigate how they work, a self smart hydrating system can be achieved.
Although, the project is not one that a person might use in real life, as there are some limitations such as taking the filled glass to drink from it it’s quite hard without messing up the circuits.

Download the source code

iothings/proiecte/2021/smarthydration.txt · Last modified: 2022/01/20 19:03 by ioana.cristea0112
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0