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:

  • Course On Arduino and Android I have made many tutorials for creating apps using MIT app inventor and connected the app with arduino to make things work, I often get email stating something went missing when they follow my tutorial, Here's a step by ste… Read More
  • Course on MATLAB Simulink and Arduino. Have you ever thought of programming arduino from a powerful tool like Matlab Simulink, do you know why Simulink so powerful, many big industries and corporates are using Matlab Simulink for testing and implementing their p… Read More
  • Blink an LED using Arduino and Matlab Simulink If you are looking to make your arduino talk wiith Matlab, usually this is done by serial communication between Matlab and arduino, where we separately write program for Matlab and arduino, we pass data from and process in … Read More
  • Course on Interfacing Arduino and LabVIEW Its been a long time I have made a video course on How to use arduino with LabVIEW , This video tutorial is more sufficient for anyone to get started with arduino and LabVIEW and start building their own projects using Ardu… Read More
  • Esp8266 Control Electrical Devices From your browser. WiFi web server: This program connected to the wifi home server that is specified by the user, Once it connected to the homeserver, you can check the IP address assigned to the esp8266 by logging into your WIFI modem and che… 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