Saturday, 28 October 2017

Automatic water level controller in water tank with Arduino


This very simple and easy way of controlling water level in the water tank. I've seen many people in rural area where they get their water from deep underground pumps. So what they do is, when the tank goes empty they switch on and then fill the tank. Some times they go for shower and water runs out, they start screaming turn the switch on.  If there is no one there, the person has to go himself to turn on the switch. So if anyone installs this system, he will have maximum comfort I'm sure.
Ad

The sketch
int relay = 4;

void setup() {
// initialize serial communication at 9600 bits per second:
pinMode (relay,OUTPUT);
Serial.begin(9600);
}


void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A2);

if (sensorValue >=500){
Serial.println(sensorValue);
digitalWrite (relay, LOW);
  }
  else {
Serial.println(sensorValue);
  digitalWrite (relay, HIGH);
  }
delay(500);
}

I didn't draw the diagram because (reason has been explained in the All Arduino posts) plus thought clever people will get the idea. The system scans the water level every half a second so it can pump the water back to the set level very quickly if the water level goes down quite fast. You can make it scan slower, but for that you will have to edit the sketch a bit. If you want do that then I think it will be the best idea to ask an Arduino coding expert first, otherwise you can mess up the whole system and your water level might over flow. I can make customized system for you but forget it can't be bothered helping for free. :(
Ad


No comments:

Post a Comment