Alen - For Merge k7
Alen - For Merge k7
1. INTRODUCTION 2
2. ABSTRACT 3
3. BLOCK DIAGRAM 4
4. MAJOR COMPONENTS 5
6. CIRCUIT DIAGRAM 34
8. PROGRAM 36
9. CONCLUSION 44
10. REFERENCE 44
1
INTRODUCTION:
ABSTRACT:
2
This project is an automatic process to detect, indicate and control the
level of water in overhead tank or any other storage containers using ultrasonic
sensor. The water level is maintained above a particular percentage which is
adjusted in the Arduino Code. The maximum level also can be adjusted in
Arduino Code.
When the water level goes below the given minimum percentage the
pump starts running automatically. When the water level reaches the preset
maximum percentage, the pump stops automatically.
This project also has dry pump run protection, which turn off the
motor and the buzzer will notify that the sump is empty during motor running. The
motor will not start if the sump is empty.
BLOCK DIAGRAM:
3
4
MOTOR
ULTRASONIC
R
SENSOR
WATER LEVEL
SENSOR ARDUINO UNO
PUSH BUTTON
SWITCH 2
5VOLT POWER
SUPPLY
5
MAJOR COMPONENTS :
Arduino Uno
Ultrasonic Sensor
Water Level Sensor
Push Button Switch
Relay Module
Buzzer
20*4 LCD Display
Power Supply Unit.
ARDUINO UNO:
6
ARDUINO INTRODUCTION
7
or by an external 9-volt battery, though it accepts voltages between7 and 20
volts.
The Arduino Uno power supply can be done with the help of a USB cable
or an external power supply. The external power supplies mainly include AC
to DC adapter otherwise a battery. The adapter can be connected to the
Arduino Uno by plugging into the power jack of the Arduino board.
Similarly, the battery leads can be connected to the Vin pin and the GND pin
of the POWER connector. The suggested voltage range will be 7 volts to 12
volts.
8
The 14 digital pins on the Arduino Uno can be used as input & output with
the help of the functions like pin Mode(), digital Write(), & Digital Read().
Pin1 (TX) & Pin0 (RX) (Serial): This pin is used to transmit &
receive TTL serial data, and these are connected to the ATmega8U2 USB to
TTL Serial chip equivalent pins.
9
Pins 3, 5, 6, 9, 10, & 11 (PWM): This pin gives 8-bit PWM o/p by the
function of analog Write ().
Reset Pin: This pin is used for reset (RST) the microcontroller
ARDUINO MEMORY
ARDUNIOCOMMUNICATION
10
The Arduino Uno ATmega328 offers UART TTL-serial communication,
and it is accessible on digital pins like TX (1) and RX (0). The software of
an Arduino has a serial monitor that permits easy data. There are two LEDs
on the board like RX & TX which will blink whenever data is being
broadcasted through the USB.
APPLICATIONS OF ARDUINO
ULTRASONIC SENSOR:
11
The ultrasonic sensor is an electronic device used to measure
distances. Because, measuring distance is an essential factor in many applications
such as robotic control, vehicle detection etc. Sensors such as optical and sound
are the most helpful
Ultrasonic sensors are also used as level sensors to detect, monitor and
control liquid levels in closed vessels. Most notably, ultrasound technology has
enabled the medical industry to image internal organs, identify tumours, and ensure
the health of babies in the womb.
12
implies ultrasonic sensor operates on ultrasonic frequencies. Those frequencies are
above 20k Hertz.
13
sound is received by the receiver present in the same module. An ultrasonic signal
is propagated by a wave at an angle of 30 o. The above-depicted figure illustrates
how the ultrasonic signal propagates from the transmitter. Measuring angle should
be at least 15ofor maximum accuracy. In this case, distance to the desired object.
14
To prevent mutual interference between Ultrasonic Sensors, the
synchronous operation can be used by emitting the ultrasonic waves from
each sensors simultaneously.
SPECIFICATIONS:
The water level sensor has a very simple schematic which makes it
up but despite which is rather very interesting to learn, let’s learn further.
The water level sensor is a widely used sensor. you can see this sensor in the
water level detector and many other places. water level sensors can be used in our
daily life usable things.
16
Above is the schematic of the water level sensor, which I have drawn myself
from a sensor lying around as always. The schematic seems to be quite easy
and simple.
It consists of only a S8050 SMD transistor, which is an NPN transistor. For
it’s better understanding of it’s working and type of output, visit projects
based on it.
As in the Soil Moisture sensor article, I have clearly mentioned that due to
long time exposure of sensing area of the sensor, it accumulates a layer of
salt. Similarly, in this also it accumulates a layer of salt so clear the layer
timely for proper reading.
One of the major drawback of this sensor is that due to its very simple
schematic it’s value cannot be controlled also the signal cannot be boosted
or compared as in other sensors.
The working of this sensor is similar to its schematic, very simple and easy
to understand. As in the above circuit diagram, you can see that the sensing
area is marked with blue lines.
17
The S8050 sensor works as a switch in this sensor. The base of the transistor
is connected to the one series of lines of the sensing area.
The other series is connected to the emitter of the transistor with 1 kΩ
resistor in series. The emitter is connected to GND and Signal pin via a
100 Ω resistor in series.
The collector pin of the transistor is connected to the VCC of the sensor. The
onboard status LED is also connected to the emitter pi of the sensor with
1 kΩ resistor in series.
Application of water level sensor
Water level detection in the water tank to measure the level of the water
inside the tank.
we can use this sensor in the air cooler to prevent the overflow and less
amount problem
we can use this sensor into the lead-acid battery to measure the level of
acidic water inside the battery
we can use this awesome sensor into the irrigation in the rural area also we
can monitor the level of the water.
we can use this water level sensor to measure the water inside the RO
machine of water.
Advantages:
The main advantage is the simplicity of the sensor that a beginner can also
use it easily and easily to build schematic even on a piece of PerfBoard.
The working voltage level has an input of 40V, which covers all the popular
Development board and microcontrollers.
The sensor can also be built on the large scale as required by the user, as the
schematic is so simple and requires only few active and passive components.
With the help of mounting holes, you can easily mount the sensor anywhere
of the surface or custom-built the PCB for the same.
More advanced version and different types of water level sensor are also
available which works differently, but the output is same.
Disadvantages:
18
The main disadvantage of the sensor is the single type of OUTPUT it gives.
The sensor should be modified to give the ANALOG value of the water
level with respect to physical water level, which is much more useful than
DIGITAL values.
Open traces on the sensor PCB for the sensing of the water is not galvanized,
as a result it deposits a layer of salt over then over a period of continuous use
or time.
There is no such way to control the logic level of the OUTPUT signal as it
depends on the input voltage, so it needs to be connected with the
microcontroller power pins.
PUSHBUTTON
PUSHBUTTON DESCRIPTIONS
A push switch (button) is a momentary or non-latching switch which causes
a temporary change in the state of an electrical circuit only while the switch
is physically actuated. An automatic mechanism (i.e. a spring) returns the
19
switch to its default position immediately afterwards, restoring the initial
circuit condition.
A 'push to make' switch allows electricity to flow between its two contacts
when held in. When the button is released, the circuit is broken. This type of
switch is also known as a Normally Open (NO) Switch. (Examples:
doorbell, computer case power switch, calculator buttons, individual keys on
a keyboard)
A 'push to break' switch does the opposite, i.e. when the button is not
pressed, electricity can flow, but when it is pressed the circuit is broken.
This type of switch is also known as a Normally Closed (NC) Switch.
(Examples: Fridge Light Switch, Alarm Switches in Fail-Safe circuits)
Many Push switches are designed to function as both 'push to make' and
'push to break' switches. For these switches, the wiring of the switch
determines whether the switch functions as a 'push to make' or as a 'push to
break' switch.
RELAY MODULE:
20
Relay modules are simply circuit boards that house one or more relays.
They come in a variety of shapes and sizes, but are most commonly
rectangular with 2, 4, or 8 relays mounted on them, sometimes even up
to a 16 relays.
Relay modules contain other components than the relay unit. These
include indicator LEDs, protection diodes, transistors, resistors, and
other parts. But what is the module relay, which makes the bulk of the
device? You may ask. Here are facts to note about it:
21
A relay module is available in an array of input voltage ratings: It
can be a 3.2V or 5V relay module for low power switching, or it
can be a 12 or 24V relay module for heavy-duty systems.
The relay module information is normally printed on the surface of
the device for ready reference. This includes the input voltage
rating, switch voltage, and current limit.
What does a relay module do? The relay module function is mainly to
switch electrical devices and systems on or off. It also serves to isolate
the control circuit from the device or system being controlled.
This is important because it allows you the use a microcontroller or
other low-power device to control devices with much higher voltages
and currents.
Another relay module purpose is to amplify the control signal so that it
can switch the higher currents using only a small out of power from
a microcontroller.
22
Relay Module Working
How does a relay module work? The relay module working principle is
actually quite simple. It uses an electromagnet to open and close a set of
electrical contacts. Here is the sequential working of relay module
devices for easier understanding:
23
This in turn closes the switch contacts on the output (high voltage)
side, allowing electricity to flow and power the device or system
that is connected to it.
To prevent flyback voltage from damaging the relay module circuit
and the input device, a diode is often placed in parallel with the
electromagnet coil. This diode is known as a flyback diode. It
allows current to flow in only one direction.
When a higher level of isolation is required, an optocoupler is
used. An opto-isolated relay module has the photoelectric device
on the input side, which is used to control the electromagnet’s
switching action.
Relay modules are available with either normally open (NO) or normally
closed (NC) switch configurations.
BUZZER DESCRIPTION:
24
An audio signaling device like a beeper or buzzer may be electromechanical
or piezoelectric or mechanical type.
The main function of this is to convert the signal from audio to sound.
Generally, it is powered through DC voltage and used in timers, alarm
devices, printers, alarms, computers, etc.
Based on the various designs, it can generate different sounds like alarm,
music, bell & siren.
It includes two pins namely positive and negative.
25
The positive terminal of this is represented with the ‘+’ symbol or a longer
terminal.
This terminal is powered through 6Volts whereas the negative terminal is
represented with the ‘-‘symbol or short terminal and it is connected to the
GND terminal.
BUZZER SPECIFICATIONS
The specifications of the buzzer include the following.
Color is black
The frequency range is 3,300Hz
Operating Temperature ranges from – 20° C to +60°C
Operating voltage ranges from 3V to 24V DC
The sound pressure level is 85dBA or 10cm
The supply current is below 15mA
26
POWER SUPPLY UNIT
First, we are using a step-down transformer [Secondary rating 12Volt & 1 Amp]
step down 230V AC supply to 12-Volt AC. Then we rectify the 12V AC to 12 V
DC using a diode bridge rectifier [Full wave rectifier]. After the rectifier, we have
used Capacitors to filter the ripple from the circuit and fed it to the input of the
7812 voltage regulator. 7812 regulates the 12 volt DC to 12 Volt DC and at the
output of 7812 IC, we get constant 12 Volt DC output.
TRANSFORMER
A step down transformer will step down the voltage from the ac mains to the
required voltage level. The turn’s ratio of the transformer is so adjusted such as to
obtain the required voltage value. The output of the transformer is given as an
input to the rectifier circuit.
27
RECTIFICATION
Rectifier is an electronic circuit consisting of diodes which carries out the
rectification process. Rectification is the process of converting an alternating
voltage or current into corresponding direct (DC) quantity. The input to a rectifier
is AC whereas its output is unidirectional pulsating DC. A full wave rectifier or a
bridge rectifier is used to rectify both the half cycles of the ac supply (full wave
rectification). The figure shows a full wave bridge rectifier.
SMOOTHING
REGULATION
This is the last block in a regulated DC power supply. The output voltage or
current will change or fluctuate when there is a change in the input from ac mains
or due to change in load current at the output of the regulated power supply or due
to other factors like temperature changes. This problem can be eliminated by using
a regulator. A regulator will maintain the output constant even when changes at the
input or any other changes occur. IC 7812 is used to obtained fixed values of
28
20*4 LCD DISPLAY:
In a 20x4 LCD module, there are four rows in display and in one row twenty
character can be displayed and in one display eighty characters can be shown.
The liquid crystal display interfacing code is easily accessible. We just required
eleven input and output pinouts for the interfacing of the LCD screen.
The input supply for this module is three volts or five volts, with that module other
components like PIC, Raspberry PI, Arduino.
Liquid crystal display works on two types of the signal first one is data and the
second one is for control.
The existence of these signals can be identified through the on and off condition of
RS pinout. Data can be read by pushing the Read/write pinout.
29
20x4 LCD Pinout
These are some pinouts of 20x4 LCD modules that are described here with the
detailed.
Pin Pin
No: Name: Parameters
It It is ground pinout
Pin#
denoted potential at this pinout is
1
as Vss zero.
It
Pin# At this pinout, five volts
denoted
2 are provided.
as Vdd
30
pinout
3 denoted the contrast of the screen.
as Vo
This
Pin# pin It used to H/L register
4 denoted select signal.
as RS
It
Pin# It used for H/L read/write
denoted
5 signal.
as R/W
This
Pin# pinout It used for H/L enable
6 denoted signal.
as E
The
pinouts
from
seven
Pin# to It used for H/L data bus
7-14 fourtee for 4 bit or 8-bit mode.
n
denoted
as DB0
– DB7.
31
It
Pin# identifi It used to set backlight
15 ed as A anode.
(LED+)
It
recogni
Pin# zed as It used to set backlight
16 K cathode.
(LED-)
.
Features of 20 x 4 LCD
These are some features of 20 x 4 LCD modules that are described here with the
detailed.
32
The most important feature of this module is that it can display 80 characters at a
time.
This module operates on the plus five volts input supply and can also work on the
plus three volts.
The plus three volts pinout can also be used for the negative supply.
The light-emitting diode of this module can get supply from the pinout one, pinout
two, pinout fifteen, pinout sixteen, or pinout A and K.
These are some pinouts of 20 x 4 LCD modules that are described here with the
detailed.
Symb
Parameters
ol Conditions
It
Input denote The value of VDD is
Voltage d as plus five volts.
VDD
33
It
Supply denote Its value is ten
Current d as milliamperes.
IDD
LC Driving
Its
Voltage for
symbol
Normal
is Its value is 5.2 volts
Temperatu
VDD
re Version
to V0.
Module
It is
LED
denote
Forward Its value is 4.3V
d as
Voltage
VF.
LED It
Forward denote Its value is 4.6V.
Current d as IF.
This
pinout VEL = 110 VAC,
EL Supply
denote and four hundred
Current
d as frequency.
EL
34
Absolute Maximum Ratings
Symb
Parameters
ol Conditions
It
Working Its value is zero to a
denote
temperatur plus fifty-celsius
d as
e degree.
Top
It
Storage Its value minus
denote
Temperatu twenty Celsius to
d as
re plus seventy celsius.
Tst.
Supply It
Voltage for denote Its value is three
liquid d as volts to thirteen
crystal Vdd or volts.
display Vss.
35
CIRCUIT DIAGRAM:
36
CIRCUIT DIAGRAM DESCRIPTION:
37
This project contains Arduino UNO, HCSR 04 Ultrasonic sensor,
Push Button, Water level Sensor, 20*4 LCD Display, Buzzer, and a Relay module.
The VCC of the water level sensor is connected to +5V and the
GND is connected to the GND. The ‘S’ Pin is connected to ht ‘A 0 ‘ the analog
input of the Arduino.
The VCC is connected to the +5V and the GND pin is connected
to the GND of both LCD and Relay Module.
For VCC and GND a Common line is kept in the Bread Board
and Taken from the Bread Board and given to the each components.
PROGRAM:
#include <NewPing.h>
38
// include the library code:
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars
and 2 line display
#include <NewPing.h> // Include library used for measuring the distance using
HC-SR 06 sonar sensor
#define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic
sensor.
#define ECHO_PIN 7 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 500 // Maximum distance we want to ping for (in
centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing
setup of pins and maximum distance.
#define MOTORPIN 8 // Arduino pin tied to Relaypin of the Relay Circuit
//#define EXTRELAYPIN 13 // Arduino pin tied to vin pin of the External Relay
Circuit
#define BUZZER 9 // Arduino pin tied to +ve terminal of the Buzzer
float val;
#include <EEPROM.h>
int addr = 0;
int addr2 = 1;
int flag;
byte readval;
#define buttonPin 12
int buttonState = LOW; // variable for reading the pushbutton status
39
int percentage;
int DRYSensorPin = A0; // set A0 as the Spump water sensor pin
int DRYsensorValue = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.begin(20, 4); // set up the LCD's number of columns and rows:
lcd.setCursor(0,0);
lcd.print("SMART WATER LEVEL ");
lcd.setCursor(0,1);
lcd.print("CONTROL SYSTEM ");
lcd.setCursor(0,2);
lcd.print("USING ULTRASONIC ");
lcd.setCursor(0,3);
lcd.print("SENSOR ");
delay(4000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Starting ARDUINO, ");
lcd.setCursor(0,1);
40
lcd.print("Press SCAN Button to");
lcd.setCursor(0,2);
lcd.print("Change Tank Height ");
lcd.setCursor(0,3);
lcd.print("If Required ");
delay(4000);
// delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Confirm Tank Must be");
lcd.setCursor(0,1);
lcd.print("Empty To Set Tank ");
lcd.setCursor(0,2);
lcd.print("Height using Sonar ");
delay(4000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Now Scan to Change ");
lcd.setCursor(0,1);
lcd.print("Tank Height to New ");
delay(4000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Long Press Button...");
for (int i=0; i<=5; i++)
{
lcd.setCursor(0,1);
lcd.print(" Hold : ");
lcd.print(5-i);
lcd.print(" Seconds ");
buttonState = digitalRead(buttonPin);
41
if (buttonState == LOW)
{
TankHeight =sonar.ping_cm();
EEPROM.write(addr, TankHeight);
}
delay(1000);
}
{TankHeight= EEPROM.read(addr);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Tank New Height Set@");
lcd.setCursor(0,1);
lcd.print(" ");
lcd.print(TankHeight);
lcd.print("cm ");
lcd.setCursor(0,2);
lcd.print("Cheers ");
lcd.setCursor(0,3);
lcd.print("WELCOME ");
delay(2000);
lcd.clear();
lcd.setCursor(0,2);
lcd.print("TANK HEIGHT: ");
//lcd.print("cm ");
lcd.setCursor(12,2);
lcd.print(TankHeight);
lcd.print("cm ");
delay(50); // Wait 100ms between pings (about 20 pings/sec). 29ms should be the
shortest delay between pings.
SonarReading=sonar.ping_cm();
DRYsensorValue=analogRead(DRYSensorPin);
//Serial.println(DRYsensorValue);
Temp= SonarReading-GapbwSonar;
ActualReading= WaterLevelMAX-Temp;
percentage=(ActualReading/WaterLevelMAX*100);
Serial.println(percentage);
//Serial.println(TankHeight);
lcd.setCursor(0,0);
lcd.print("WATER LEVEL:");
lcd.print(percentage);
lcd.print("% ");
if(DRYsensorValue>=100)
if(percentage<=20)
{
lcd.setCursor(0,3);
lcd.print("SUMP: WATER FILLED ");
lcd.setCursor(0,1);
43
lcd.print("PUMP STATUS: RUNNING");
digitalWrite(MOTORPIN,HIGH);
// digitalWrite(EXTRELAYPIN,LOW);
flag=1;
EEPROM.write(addr2, flag);
flag= EEPROM.read(addr2);
// ZeroPercentage();
flag= EEPROM.read(addr2);
if(percentage>20 && percentage<=100 && flag ==1)
{
digitalWrite(MOTORPIN,HIGH);
// digitalWrite(EXTRELAYPIN,LOW);
lcd.setCursor(0,1);
lcd.print("PUMP STATUS: RUNNING");
}
{
digitalWrite(MOTORPIN,LOW);
// digitalWrite(EXTRELAYPIN,HIGH);
lcd.setCursor(0,1);
lcd.print("PUMP STATUS: OFF ");
}
44
}
else if(percentage>100)
delay(500);
lcd.setCursor(0,1);
lcd.print("PUMP STATUS: OFF ");
lcd.setCursor(0,0);
lcd.print("Water Level:");
lcd.print("100");
lcd.print("% ");
digitalWrite(MOTORPIN,LOW);
// digitalWrite(EXTRELAYPIN,HIGH);
flag=0;
EEPROM.write(addr2, flag);
flag= EEPROM.read(addr2);
// HundredPercentage();
else if(DRYsensorValue<=100)
flag= EEPROM.read(addr2);
if(flag==1)
45
{
// lcd.clear();
lcd.setCursor(0,3);
lcd.print("SUMP: WATER FILLED ");
lcd.setCursor(0,1);
lcd.print("PUMP STATUS: DRYRUN!");
digitalWrite(BUZZER,HIGH);
digitalWrite(MOTORPIN, LOW);
// digitalWrite(EXTRELAYPIN, HIGH);
delay(100);
digitalWrite(BUZZER,LOW);
delay(100);
}
else if(flag==0)
{
lcd.setCursor(0,3);
lcd.print("SUMP: NOWATER/CHECK");
}
}
CONCUSION:
46
The designed prototype system has been successfully tested and
verified and the results obtained ensured that the control system designed is
capable three distinct advantages:
REFERENCE:
www.create.Arduino.cc
www.DIY.com
www. Engineeringprojects.com
Last minute engineering.com
ESTIMATION:
47
S.NO. DESCRIPTION AMOUNT
3. BUZZER 50
9. MISCELLANEOUS 500
TOTAL 7000
48