Wednesday, May 6, 2015

Automatic Water level controller with Level display on LCD





previously I made an automatic water level controller , you can check this link here, Please check the link which I have given to know more about the detail of this project. This is an upgrade version to the previous one, I've added an LCD display to the project to display the water level.

Arduino Code:

/*
 HC-SR04 Ping distance sensor:
 VCC to arduino 5v 
 GND to arduino GND
 Echo to Arduino pin 9 
 Trig to Arduino pin 8*/
 /* LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)*/

#include<LiquidCrystal.h> // include the library code for lcd
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //  
#define echopin  9 // echo pin
#define trigpin 8 // Trigger pin

int maximumRange = 50;
long duration, distance;

void setup() {
  lcd.begin(16,2);
  Serial.begin (9600);
  pinMode (trigpin, OUTPUT);
  pinMode (echopin, INPUT );
  pinMode (4, OUTPUT);
  pinMode (13,OUTPUT);
}
  
void loop ()
{
  {
    digitalWrite(trigpin,LOW);
    delayMicroseconds(2);
    
    digitalWrite(trigpin,HIGH);
    delayMicroseconds(10);
    
    duration=pulseIn (echopin,HIGH);
    
    distance= duration/58.2;
    delay (50);
    Serial.println(distance);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("water level :");
    lcd.print(distance);
    delay(100);
    
  }
  
 if (distance >= 25 ){
   digitalWrite (7,HIGH);// connect to relay(motor)
   digitalWrite (13,HIGH);
   lcd.setCursor(0,1);
   lcd.print("Motor Started");
   delay(100);
 }

 else if (distance <=5) {
   digitalWrite (7,LOW); // connect to relay(motor)
   digitalWrite (13,LOW);
   lcd.setCursor(0,1);
   lcd.print("Tank is full");
   delay(100);
   
 }

}

----------------------------------------------------------------------------------------------------------------------------

Arduino file can be downloaded from this link here

Related Posts:

  • Robot Kinematics Using Labview, Solidworks and Arduino Virtual prototype of LR Mate 200ic This project uses solidworks, labview, softmotion and arduino. CAD model is created with help of SoldiWorks, Labview used for creating control singnals, Softmotion used for i… Read More
  • Automatic Light control using Labview and arduino This project is about automatically turning on LED's , when the light intensity goes low. It uses a LDR, 10k , 220 ohm resistors, and arduino uno . A very simple Easy to do automatic light controller in Labview , LDR… Read More
  • DC Motor Control by LabVIEW This Video's about controlling a DC motor from LabVIEW The above video explains how to control DC motor with the help of arduino and labview, its possible to control 2 motors using L293D Motor IC, by using this motor… Read More
  • How to connect Labview and Soliworks This video's about interfacing NI labview with SolidWorks. You need NI labview, NI softmotion and solidworks with Motion analysis to successfully do this testing on your own. More details are included in the video che… Read More
  • Controlling relay using Arduino and Labview The above fritzing uses a 5v relay , If you are using a 12v relay you need to connect an external supply for powering the relay. This is the simple relay control operation, where the control can be feed to the arduino b… Read More

8 comments :

  1. Please help, how to program control of two (2) pieces sro4 sensor to measure the water level?

    ReplyDelete
  2. How you connect the motor with the relay controller?if you have a diagram,can you post please

    ReplyDelete
  3. Hello I'm interstellar in ur project can have control for two overhead tank and one solenoid valve for controlling water flow

    ReplyDelete
  4. which program do you used to draw the circuit

    ReplyDelete
  5. kok ad eror ya gan pas di program

    ReplyDelete
  6. I've done all the steps and program the code to arduino uno, but the lcd is always showing water level=0 and tank is full

    ReplyDelete
  7. Hi. Can this be used to detect milk level in the bucket as well ?

    ReplyDelete