Project tutorial

H20asis © GPL3+

Tasty thirsty-safety firsty-a touch-less water dispenser.

  • 0 respects

Components and supplies

Apps and online services

About this project


India is a largely hot country. This means that in all schools and offices, people have to make several trips to the water fountain (AKA Water dispenser), and it often seems as if it’s always crowded out there.

While most urban institutions can afford high end Water Fountains with Heating/Cooling options, a majority of institutions in rural or middle/lower class areas just have simple water dispensers.

These dispensers require you to press/flip a tap lever of sorts. In addition, a typical Indian habit is to not queue up, so every one tends to gather closely around while someone is taking water in their bottle.

In these Covid times, this is a perfect recipe for disaster.

So, my idea was to create a simple water dispenser set-up using commonly available parts that doesn’t need people to touch anything; while at the same time, forces people to develop better queuing habits by switching off the water if proper distancing is not maintained.

This is H2Oasis.

In the real world, a typical water dispenser would usually consist of two parts: A Water Canister (Usually 20 litres) placed up-side-down atop a Water Dispensing Container with a tap of some sort.

My project does away with the bottom part and so is completely touch-less.

H2Oasis is composed of 3 parts.

1. Partition:

A simple panel (Using flattened cartons/wood as available) that allows for access to the Water dispenser only from two opposite sides.

The Water dispenser is placed in the middle, at a safe distance of 2 metres from the entry as well as the exit points.

2. Three Contact sensors

There is a Contact Sensor placed on the ground at both the entry and exit points as well as one before the Water dispenser.

One side of the contact sensor is on the ground, the other is on a commonly available plastic lid that depresses when someone steps upon it, hence making contact with the ground part of the sensor. It returns to its original form once they step off, hence breaking the contact.

Once the person arrives in front of the water dispenser, they step upon the Water Dispenser Contact. This activates the H2Oasis system.

3. Pipe system Cap

This allows one end of a pipe to dip into the upright water canister while the other end is connected to the input side of the water pump. A second pipe connects to the output side of the pump and fits into the cap, to allow water to flow out like a spout.

4. The Brain

This is the heart of H2Oasis and uses an Arduino Nano hooked to the three contact sensors, an ultrasonic sensor, a voice recorder, a green/red LED light and a water pump motor.

How it Works

When someone comes from the entry and steps on the contact sensor in front of the Water cooler, the system turns on.

Then, when they put their Personal water bottle under the waterspout, the Ultrasonic Distance sensor triggers the water pump.

The bottle starts to fill.

During this time, if an impatient someone else comes in through the Entry (or even through the Exit) they will step on the Entry Sensor or the Exit Sensor.

This will trigger the Red light and the speaker to announce, “Step back behind the Entry Line”.

Simultaneously, the water pump will be switched off.

So the impatient person realises that he will get further delayed if he doesn’t step back and stand in queue to await his turn.

Then, when the offending person steps back off the sensor, the system will resume.

The Red light goes off. The Green light comes on. The Water pump re-starts.

When the person at the water fountain removes his bottle, the water pump switches off.

And when the person steps off the Water Dispenser Contact sensor, the system resets and is now ready for the next person.


H20asis full codeC/C++
#define REC 2
#define PLAY_E 3
#define FT 4
#define playTime 5000
#define recordTime 5000 

const int trigPin = 10;
const int echoPin = 11;
long duration;
int distance;

const int redPin = 12;
const int greenPin = 13;

const int pumpPin = 6;

const int mainpressPin = 7;
const int pressure1Pin = 8;
const int pressure2Pin = 9;

void setup() 
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT); 

  pinMode(REC,OUTPUT);// set the REC pin as output

  pinMode(PLAY_E,OUTPUT);// set the PLAY_e pin as output
  pinMode(pumpPin, OUTPUT);

  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);  
  pinMode(mainpressPin,INPUT); // first pressure sensor
  pinMode(pressure1Pin,INPUT); // second pressure sensor
  pinMode(pressure2Pin,INPUT); // third pressure sensor

void loop() 
      char ch;
      if (Serial.available() > 0)
          ch =; 
          // start recording
          if( ch == 'r'){
            digitalWrite(REC, HIGH);
            Serial.println("Recording started");
            digitalWrite(REC, LOW);
            Serial.println("Recording Stopped"); 
          //TODO make this only print once
           // Serial.println("### Enter r to record");
        //TODO make this only print once
        //Serial.println("###Serial Monitor Exited");

    //check if first pressure sensor is pressed
    int val=0;
    val=digitalRead(mainpressPin); //TODO make 7 a global variable

    if (val==1)
       digitalWrite(trigPin, HIGH);
       digitalWrite(echoPin, HIGH);
       digitalWrite(greenPin, HIGH);
       Serial.println("###System Activated");

   if (val!=1){
       digitalWrite(echoPin, LOW);
      // digitalWrite(pressure1Pin,LOW);
       digitalWrite(greenPin, HIGH);

  //check if second pressure sensor is pressed

  int val_press=0;

  int val_touch=0;

   if ((val_touch ==1 || val_press ==1) && val==1)
       digitalWrite(redPin, HIGH);
       digitalWrite(PLAY_E, HIGH);
       digitalWrite(pumpPin, LOW);
       Serial.println("Step back please");
       digitalWrite(redPin, LOW);
       digitalWrite(PLAY_E, LOW);
       digitalWrite(pumpPin, LOW);

   //calculate distance
   long duration, distance;
   digitalWrite(trigPin, HIGH);
   digitalWrite(trigPin, LOW);
   duration=pulseIn(echoPin, HIGH);
   distance=(duration/2)/29.1;  //TODO double check 29.1

   //use distance of hand to control water flow
        digitalWrite(pumpPin, LOW);
        Serial.println("Water stopped");
   else if(distance<=20 && distance!=0 && val_press!=1 && val_touch!=1 && val==1)
         digitalWrite(pumpPin, HIGH);
         Serial.println("Water flowing");
Pressure sensorC/C++
Code to test pressure sensor(s)
const int mainpressPin = 7;

void setup()
  pinMode(mainpressPin, INPUT); // first pressure sensor

void loop()
  int val = 0;
  val = digitalRead(mainpressPin);

  if (val == 1)



H20asis lr02iiws1k


Similar projects you might like

DUO Water Tank Control Unit

Project tutorial by vdneut

  • 1 comment
  • 8 respects

Make Eating Robot With Arduino Nano | Gold Screw

Project tutorial by GoldScrew

  • 21 respects

10 Awesome Beginner Arduino Projects

by RoyTobby

  • 1 comment
  • 46 respects

Otto DIY+ Arduino Bluetooth robot easy to 3D Print

Project tutorial by Team Otto builders

  • 239 respects

Tito - Arduino UNO 3D-printed robot

Project tutorial by Camilo Parra Palacio

  • 61 respects

The "Mars Rover" Emulator

Project tutorial by MJRoBot (Marcelo Rovai)

  • 57 respects
Add projectSign up / Login