top of page

How to Make Smart Water tap at your home


Circuit:

Download Programming and Circuit:


#define inSensor 2

#define outSensor 3

int inStatus;

int outStatus;

int countin = 0;

int countout = 0;

int in;

int out;

int now;

int now1;

#define relay 5

#define relay1 6

#define buzzer 4

void setup()

{

  pinMode(inSensor, INPUT);

  pinMode(outSensor, INPUT);

  pinMode(relay, OUTPUT);

  pinMode(relay1, OUTPUT);

  pinMode(buzzer, OUTPUT);

}

void loop()

{

  inStatus = digitalRead(inSensor);

  outStatus = digitalRead(outSensor);

  if (inStatus == 0)

  {

    in = countin++;

  }

  if (outStatus == 0)

  {

    out = countout++;

  }

  now = in - out;

  now1 = in == out;

  if (now <= 1)

  {

    digitalWrite(relay, HIGH);

    delay(100);

    digitalWrite(buzzer, HIGH);

    delay(50);

    digitalWrite(buzzer, LOW);

    delay(50);

  }

  if (now >= 0)

  {

    digitalWrite(relay1, HIGH);

    delay(100);

    digitalWrite(buzzer, HIGH);

    delay(50);

    digitalWrite(buzzer, LOW);

    delay(50);

  }

  if (now1 = 1)

  {

    digitalWrite(relay, LOW);

    digitalWrite(relay1, LOW);

    delay(100);

    digitalWrite(buzzer, HIGH);

    delay(50);

    digitalWrite(buzzer, LOW);

    delay(50);

  }

}



Demo Video:


68 views0 comments

Recent Posts

See All

Comments


bottom of page