50% found this document useful (2 votes)
24K views4 pages

Connections

This document describes an automatic water pump controller circuit that uses an HC-SR04 ultrasonic distance sensor to measure the water level in a tank. It connects the sensor and LCD display to an Arduino and uses the code to control a relay that turns the pump on and off based on the water level. When the level drops below 6cm, the relay is activated to start the pump. When the level rises above 13cm, the relay is deactivated to stop the pump. The LCD displays the current water level and status of the pump.

Uploaded by

api-374235747
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
24K views4 pages

Connections

This document describes an automatic water pump controller circuit that uses an HC-SR04 ultrasonic distance sensor to measure the water level in a tank. It connects the sensor and LCD display to an Arduino and uses the code to control a relay that turns the pump on and off based on the water level. When the level drops below 6cm, the relay is activated to start the pump. When the level rises above 13cm, the relay is deactivated to stop the pump. The LCD displays the current water level and status of the pump.

Uploaded by

api-374235747
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

AZHAR ELECTRONICS

Automatic Water Pump Controller


CONNECTIONS:
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)*/
Relay:
Relay IN 1 pin to Pin 13 of Arduino
Vcc to 5V
Gnd to Gnd

CODE:
#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(0);

if (distance <= 6 ){
digitalWrite (13,HIGH);// connect to relay(motor)
digitalWrite (7,HIGH);
lcd.setCursor(0,1);
lcd.print("Tank is Full");
delay(0);
}

else if (distance >=13) {


digitalWrite (7,LOW); // connect to relay(motor)
digitalWrite (13,LOW);
lcd.setCursor(0,1);
lcd.print("Motor Started");
delay(0);

You might also like