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
Please help, how to program control of two (2) pieces sro4 sensor to measure the water level?
ReplyDeleteHow you connect the motor with the relay controller?if you have a diagram,can you post please
ReplyDeleteHello I'm interstellar in ur project can have control for two overhead tank and one solenoid valve for controlling water flow
ReplyDeletewhich program do you used to draw the circuit
ReplyDeletekok ad eror ya gan pas di program
ReplyDeleteI'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
ReplyDeleteHi. Can this be used to detect milk level in the bucket as well ?
ReplyDeletewhy pib 13 high
ReplyDelete