Mr. Hydrate

Electronics and programming to solve dehydration

Public Chat
Similar projects worth following
Your body depends on water to survive. Every cell, tissue, and organ in your body needs water to work properly. For example, your body uses water to maintain its temperature, remove waste, and lubricate your joints. Water is needed for overall health and wellness. This is especially so in hotter countries such as Singapore where I am stationed. Singapore is a small island nation located near the equatorial where the average temperature is around 30 degrees celsius. To beat the heat, we should drink more water to stay hydrated so as to avoid heat-related illness or injury. Whenever we see someone drinking water, why do we feel the urge to do the same, even if we are not thirsty? Mr.Hydrate is an example of a possible animated character to encourage us to drink water on a hot day with his eye-catching motion and warning light when the surrounding temperature rises above 30 degrees celsius.

Demo Video:


Code Snippets:

#include <DHT.h>
#include <Servo.h>

#define DHTPIN 2     // pin we're connected to
#define DHTTYPE DHT22   // DHT22

float temp; //Stores temperature value
const int transistorPin = 9;    // connected to the base of the transistor
int pos = 0;    // variable to store the servo position

DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor
Servo myservo;  // create servo object to control a servo

void setup() {
  // set  the transistor pin as output:
  pinMode(transistorPin, OUTPUT);
  //Initialize serial port
  //Serial.println("DHT22 sensor testing");
  //Initialize the DHT sensor
  myservo.attach(10);  // attaches the servo on pin 10 to the servo object

void loop() {
  //Read data and store it to variable temp
  temp = dht.readTemperature();
  Serial.print("Celsius = ");
  Serial.println(" degree celsius");
  if (temp > 30.0) {
    digitalWrite(transistorPin, HIGH);
    digitalWrite(transistorPin, LOW);
    for (pos = 0; pos <= 90; pos += 10) { // goes from 0 degrees to 90 degrees
      // in steps of 1 degree
      myservo.write(pos);              // tell servo to go to position in variable 'pos'
      delay(15);                       // waits 15ms for the servo to reach the position
    for (pos = 90; pos >= 0; pos -= 10) { // goes from 90 degrees to 0 degrees
      myservo.write(pos);              // tell servo to go to position in variable 'pos'
      delay(15);                       // waits 15ms for the servo to reach the position
  else {
    digitalWrite(transistorPin, LOW);


ino - 1.67 kB - 06/29/2019 at 15:12


  • 1 × Temperature sensor (DHT22)
  • 1 × Servo motor (SG 90)
  • 35 × Pins
  • 1 × Stripboard
  • 1 × Arduino Uno

View all 12 components

  • 1
    Prepare components
    1. Temperature sensor (DHT22)
    2. Servo motor (SG 90)
    3. Arduino Uno
    4. CP 2102 Module
    5. Transistor 2N 2222
    6. 1k ohm resistor 
    7. 180 ohm resistor 
    8. LED
    9. Wires
    10. Female holders
    11. Pins
    12. Stripboard
  • 2
    Prototyping on breadboard
  • 3
    Build your Arduino shield

View all 7 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates