DIY Automatic Water Saving Tap with Arduino

Automatic Water Tap

Category: Water
Communication: None
Components: Internal
Created By: Sairam Problem Solver
Difficulty Level: Beginner
Input Sensor: https://www.notion.so/Distance-sensor-dc77c74814514890820ac8b68e2c7178
Microcontroller: Arduino UNO
Output Device: Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.
Status: Complete

Discover

Refer to the first booklet Discover in the Solve Ninja Techno Kit for information on the components available with the Solve Ninja Techno Kit.

Things you will need

Solve Ninja Techno Kit which will contain:

Additional materials:

  • Electrical wire and sockets for extension

Investigate

Questions you need to ask

Get data. Examples:

  • What is the difference between water usage and water wastage?
  • What are the relevant units of measurement?
  • What is the maximum distance that an user uses the tap? At what point of opening the tap does this happen?
  • What is the ideal time that any user uses the tap to perform simple actions like washing hands, utensils, groceries, etc.?

What are the things you need to learn about the user? Examples:

  • Who is the user?
  • How much water is being used?
  • How often is it being used?
  • How much is being wasted? How?
  • Is there any time when the user opens the tap gradually/not fully?
  • Does the user think they are wasting water?
  • Does the user recognize this as a problem?
  • What is stopping the user from recognizing the problem and taking action?

What are the things you need to think about to convince the user that wasting water is a problem? Examples:

  • Why is it a problem?
  • What would influence the user’s behavior? How do they want the problem to be solved/notified?
  • Can there be a punishment mechanism whenever there is excessive water flow or a reward mechanism whenever there is optimum water flow?

This will help you decide what output device to use, for example-

  • LCD screen that displays how much water is being/has been used, or,
  • RFID/ biometric system to tag users and capture data of how much water is being used by each individual user, etc. The list is endless.

Refer to the second booklet Investigate in the Solve Ninja Techno Kit for information on which Input sensors and Output devices to use.

Solve

Refer to the third booklet Solve in the Solve Ninja Techno Kit for information on making connections and Arduino IDE.

Steps to follow

  1. Take the Solution Box from the Solve Ninja Techno Kit.
  2. Connect the 4 pin wire connector to the PCB in the port named “Distance Sensor”.
  3. Connect the distance sensor to the 4 pin wire connector.
  4. Connect one end of the USB cable to Arduino and other to Computer/laptop.
  5. Plug in one end of the power adapter to the DC jack, and the other end to a power socket.

You will need a 9V 1A power adapter for using this kit. It will not work with the USB cable alone.

  1. Switch on the Solution Box.
  2. Open Arduino IDE on computer/laptop.
  3. Download, Copy, Paste code from here to the Arduino IDE:
  • Click here for code
/* Prototype Name : Automatic Water Tap
   Input Sensor   : Distance Sensor
   Output Device  : Relay
   Libraries Used : NewPing, LiquidCrystalPCF584, FastLED
*/

#include <NewPing.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
LiquidCrystal_PCF8574 lcd(0x3F);
#include <FastLED.h>
#define DATA_PIN 9// Digital pin number for LED (NeoPixel)
#define NUM_LEDS 3
CRGB leds[NUM_LEDS];
#define TRIGGER_PIN  5 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     6 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
int relay = 4;
void setup() {
  Serial.begin(9600); // Open serial monitor at 115200 baud to see ping results.
  pinMode(relay, OUTPUT);
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Auto Tap");
}

void loop() {
  delay(500);                     // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  Serial.print("Ping: ");
  int distance = sonar.ping_cm();
  Serial.print(distance); // Send ping, get distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");
  if (distance >= 0 && distance <= 10) {
    digitalWrite(relay, HIGH);
    delay(1000);
  }
  else {
    digitalWrite(relay, LOW);
    delay(1000);
  }
}

  1. Then Check for Tools→ Board→ Port in the IDE.
  2. Compile and Upload the code.
  3. Disconnect USB cable.
  4. Switch off the Solution Box.
  5. Switch on the Solution Box.
  6. Test by blowing air into the flow sensor in the direction of the arrow. Test if value increases in the serial monitor/ LCD screen.
  7. Disconnect the flow sensor from the Solution Box.
  8. Connect the flow sensor to the tap as shown. Use FTA/Threaded Collars to fix the sensor to the pipes. Tighten the FTA using a spanner and use the teflon tape to prevent any leakages that might happen.
  9. Re-Connect the 3 pin wire connector to the PCB in the port named “Flow Sensor”. Extend if needed. You can use Jumper cables for this.
  10. Connect the flow sensor to the 3 pin wire connector.
  11. Hang the Solution Box on the wall at a suitable distance from the tap and flow sensor. To check if the distance is suitable,
  • make sure that water does not splash on the solution box.
  • the flow sensor wire/power adapter wire should not be too taut.
  1. Connect the flow sensor to the Solution Box.
  2. Power up the Solution Box.

Share

Refer to the fourth booklet Share inside the Solve Ninja Techno Kit to know how you can share your solution.

  • Locally: Once you install the solution near a tap, observe how the user interacts with the tap and the water meter. Talk to them about the solution and learn what they think of it.
    • Has their perspective on water consumption changed? Are they consciously reducing their water consumption?
    • Is there any way to collect data to prove that their water consumption has reduced, as a result of reinforcing the behaviour of turning off tap?
    • What problems do they face because of it?
  • Globally: Share your solution on the Solve Ninja App, and inspire 5 of your friends to take similar action. Continue collecting data; real victory is when your family, school mates, community members realise that in addition to saving water as a resource, they are also saving money in their water bills!