Iot 1
Iot 1
Water is the precious gift of God on the earth. Life exists on the earth because of the
availability of water. Itself being tasteless, odourless and colorless, it adds taste, color and
nice smell in the life of living beings on the earth. It is found everywhere and known as life. It
takes nothing from us but gives life to us. It has no shape but takes the shape of container we
store it. We find it everywhere in rivers, seas, tanks, wells, ponds, etc but we lack clean
drinking water. Three-fourth part of the earth is full of water however we need to conserve
water as there is very less percentage of clean water.
The project entitled, "IoT Based Automated Valve For Water Tank" will eliminate the
water tank leakage and overflow problems. Solenoid automated valve will have the control of
the water incoming to the tank and the float sensor, water flow sensor can control the flow and
once the tank if full, it will stop the water flowing from the pipe and pass the signal to the
main line to control the flow. it helps the public to save water and government to plan for the
water distribution properly for the city and villages as per the availability in the dam and
reservoir.
1
CHAPTER – I
INTRODUCTION
The need of water in India is one of the biggest challenge facing huge level water
scarcity today. Places in India like Rajasthan and some parts of Gujarat are facing water
scarcity where women and girls of the houses cover a long distance on bare foot to just get a
pot of water. In some cities like Bangalore people have to buy water bottles worth Rs. 25 to
Rs. 30 to drink clean water. People face more problems during summer months when the
daily need of water increases. Recently, it is studied that around 25% urban population lacks
availability to clean drinking water. In some areas, the privatization of water bodies is the
main reason of water demand apart from that, extreme weather changes and climates affect
the dams to save water and natural resources. Hence, this project present an internet of things
(IoT) based monitoring and environment control for leakage and water flow for water tank for
every house and the government tanks too. Furthermore, this project is dedicated to improve
and enhance the wastage of drinking water mainly. The Modules of the projects are as
follows,
Water flow sensor
Float sensor
Arduino
Solenoid valve
Relay Module
2
MODULE DESCRIPTION
Water flow sensor
To monitor the amount of water being supplied and used, the rate of flow of water has
to be measured. Water flow sensors are used for this purpose. Water flow sensors are installed
at the water source or pipes to measure the rate of flow of water and calculate the amount of
water flowed through the pipe.
Float Sensor
A float switch is a type of level sensor, a device used to detect the level of liquid
within a tank. The switch may be used to control a pump, as an indicator, an alarm, or to
control other devices.
Arduino
They are often used to replace manual valves or for remote control. Solenoid valve
function involves either opening or closing an orifice in a valve body, which either allows or
prevents flow through the valve. A plunger opens or closes the orifice by raising or lowering
within a sleeve tube by energising the coil.
Relay module
We can control high voltage electronic devices using relays. A Relay is actually a
switch which is electrically operated by an electromagnet. The electromagnet is activated with
a low voltage, for example 5 volts from a microcontroller and it pulls a contact to make or
break a high voltage circuit.
3
1.3 Scope of the Study
The system is based on water tank control using Arduino and solenoid valve to control
the leakage and the flow of water from the main tank to the sub tanks. Automation simplifies
various problems in the world economy as well as in daily life. The solenoid valve will
identify the water flow and when it reaches up to certain level, using the arduino module it
will control the water flow. It uses the latest technology to handle the water pipes with the
proper pressure. It can reduce maintenance cost, less wastage of water, alarm, and durability.
Nowadays, water wastage control and monitoring, leakage and distribution are the
biggest challenge in the society. Majority of the cities are not having water saving mechanism
to save the leakage and over flow. The manual control may not work properly and dependent
of peoples around there always and the automated will eliminate the ways to save water.
The limitation of the project is also depend on the system configuration and devices
need to be in place to handle the operations. It needs little programming for the hardware
equipments to do the automation, otherwise if not set criteria, it may lead to the same wastage
what it happened while using the manual system.
4
CHAPTER – II
SYSTEM ANALYSIS
2.1 EXISTING SYSTEM
The existing system is manual system controlled by the municipality office and the
individual house assign someone for this task every day with their schedule for the drinking
water monitor. The municipal office have maintaining their information in record format, it is
a tedious job. Some time the record may be missing or damaged. If they are in need of
particular information to retrieve it will take more time so it is very difficult to submit the
water distribution report immediately.
DRAWBACKS
Waste of time for manual operations of water overflow.
Sometimes the operations done manually will prone to excess waste.
Proper schedule not observed manually in municipal office.
Manual dependency and power consumption.
5
2.2 PROPOSED SYSTEM
To overcome the above said difficulties in the existing system, the proposed system is
designed and developed to automate the water incoming and over flowing problems. The
municipal office also need to schedule the timing, even not schedule the proper timings the
proposed system will handle the water wastage and over flow issues in the individual homes
as well as the water tanks. The proposed system is to automate for saving drinking water and
maintained the tank fill with IoT technologies and the sensors which works real time and stop
whenever it necessary actions. The latest equipments and the coding technologies will be used
in the proposed system to handle the criteria.
ADVANTAGES
No dependencies for the filling tank.
The power consumption will be reduced.
Overflow of government tanks and the individual home also protected.
Proper schedule need not be followed for the water issues.
The proposed system is also available to alarm in the home for just notification
purpose.
2.3SYSTEM SPECIFICATION
2.3.1 Hardware Requirements
2.3.2Software Specification
Operating system : Windows 10.
Coding Language : Embedded C++
Designing : Arduino IDE
6
2.3.3 ABOUT THE SOFTWARE
Arduino IDE stands for Integrated Development Environment. It is a text editor that
lets you upload code on to arduino. Every program file is called a sketch and contains all the
code that you write for your projects. Every file has an extension of .ino The code is written in
basic c++ format and is human readable. the IDE is responsible for taking care of the coding
part interpretation to the controller. The internal process of compiling translates the code that
you write to a format that the machine understands.
Once installing the IDE the first thing to do is set up the preferences. The
programming can be done that by heading over to the preferences section under the Arduino
tab. which control various different settings like where the sketches to be saved, font size, and
a lot more.
Arduino programming language can be divided in three main parts: functions, values
(variables and constants), and structure. The process of compiling is seamless to the user. All
we have to do is press a button. If the system have errors in your computer code, the compiler
will display an error message at the bottom of the IDE and highlight the line of code that
seems to be the issue. The error message is meant to help to identify what might have done
wrong – sometimes the message is very explicit, like saying, “Hey – you forget a semicolon”,
sometimes the error message is vague. Some of the syntax are discussed below,
THE SEMICOLON;
A semicolon needs to follow every statement written in the Arduino programming
language. For ex,
int LEDpin = 9;
In this statement, we are assigning a value to an integer variable (we will cover this later),
notice the semicolon at the end. This tells the compiler that you have finished a chunk of code
and are moving on to the next piece. A semicolon is to Arduino code, as a period is to a
sentence. It signifies a complete statement.
7
THE DOUBLE BACKSLASH FOR SINGLE LINE COMMENTS //
//When you type a double backslash all the text that follows on the same line will be
grayed out . Comments are what you use to annotate code. Good code is commented well.
Comments are meant to inform you and anyone else who might stumble across your code,
what the heck you were thinking when you wrote it. A good comment would be something
like below,
//This is the pin on the Arduino that the LED is plugged into
int LEDpin = 9
Comments will be ignored by the compiler – so you can write whatever you like in them.
If you have a lot you need to explain, you can use a multi-line comment,
Comments are like the footnotes of code, except far more prevalent and not at the bottom
of the page.
CURLY BRACES { }
Curly braces are used to enclose further instructions carried out by a function (we discuss
functions next). There is always an opening curly bracket and a closing curly bracket. If we
forget to close a curly bracket, the compiler will not like it and throw an error code.
void loop() { //this curly brace opens
//way cool program here
} //this curly brace closes
Remember – no curly brace may go unclosed!
8
FUNCTIONS ( )
Functions are pieces of code that are used so often that they are encapsulated in certain
keywords so that you can use them more easily. For example, a function could be the
following set of instructions…
Garbage Monitoring
1. Get the percentage value of garbage filled in different locations.
2. When it reaches certain value, the message will be sent.
3. Find Garbage Location
4. Reset after garbage collection point
5. GSM module handling
Street light
1. Get a light
2. Fill it with power
3. Add connection
4. Find failure
5. Rectify light
7. Monitor lights
8. Handle lights and LDR
This set of simple instructions could be encapsulated in a function that we call Street light.
Every time we want to carry out all those instructions are carried out.
In Arduino, there are certain functions that are used so often they have been built into the
IDE. When you type them, the name of the function will appear orange. The function
pinMode(), for example, is a common function used to designate the mode of an Arduino pin.
What’s the deal with the parentheses following the function pinMode? Many functions
require arguments to work. An argument is information the function uses when it runs.
For our Street light function, the arguments might be street name and LDR type, or
weather and size of the lights.
9
pinMode(13, OUTPUT);
//Sets the mode of an Arduino pin
The argument 13 refers to pin 13, and OUTPUT is the mode in which you want the pin to
operate. When you enter these arguments the terminology is called passing. The system pass
the necessary information to the functions. Not all functions require arguments, but opening
and closing parentheses will stay regardless though empty.
millis( );
//Retrieves the length of time in milliseconds that the Arduino has been running
Notice that the word OUTPUT is blue. There are certain keywords in Arduino that are
used frequently and the color blue helps identify them. The IDE turns them blue
automatically.
Now we won’t get into it here, but you can easily make your own functions in Arduino,
and you can even get the IDE to color.
VOID SETUP ( )
The function, setup(), as the name implies, is used to set up the Arduino board. The
Arduino executes all the code that is contained between the curly braces of setup() only once.
Typical things that happen in setup() are setting the modes of pins, starting
void setup( )
{ //the code between the curly braces is only run once for setup()
You might be wondering what void means before the function setup(). Void means that
the function does not return information.
Some functions do return values – our street light function might return the number of
buckets it required to clean the dog. The function analogRead() returns an integer value
between 0-1023. If this seems a bit odd now, don’t worry as we will cover every common
Arduino function in depth as we continue the course.
Let us review a couple things should know about setup()…
1. setup() only runs once.
2. setup() needs to be the first function in your Arduino sketch.
3. setup() must have opening and closing curly braces.
10
VOID LOOP( )
The Arduino developers because the function names are so telling. As the name
implies, all the code between the curly braces in loop() is repeated over and over again – in a
loop. The loop() function is where the body of your program will reside. As with setup(), the
function loop() does not return any values, therefore the word void precedes it.
void loop( )
{ //whatever code you put here is executed over and over
Most of the code will have specific conditions laying in wait which will trigger new
actions. If you have a temperature sensor connected to your Arduino for example, then when
the temperature gets to a predefined threshold you might have a fan kick on. The looping code
is constantly checking the temperature waiting to trigger the fan. So even though the code
loops over and over, not every piece of the code will be executed every iteration of the loop.
The Summary of the IDE Syntax as follows,
; semi-colons
// single line comments
/* */ multi-line comments
( ) parenthesis
11
Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers - students,
hobbyists, artists, programmers, and professionals - has gathered around this open-source
platform, their contributions have added up to an incredible amount of accessible knowledge
that can be of great help to novices and experts alike. Arduino was born at the Ivrea
Interaction Design Institute as an easy tool for fast prototyping, aimed at students without a
background in electronics and programming. As soon as it reached a wider community, the
Arduino board started changing to adapt to new needs and challenges, differentiating its offer
from simple 8-bit boards to products for IoT applications, wearable, 3D printing, and
embedded environments. All Arduino boards are completely open-source, empowering users
to build them independently and eventually adapt them to their particular needs. The software,
too, is open-source, and it is growing through the contributions of users worldwide.
Arduino Board
12
Arduino has been used in thousands of different projects and applications. The
Arduino software is easy-to-use for beginners, yet flexible enough for advanced users. It runs
on Mac, Windows, and Linux. Arduino also simplifies the process of working with
microcontrollers, but it offers some advantages are as follows,
Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX, and
Linux operating systems. Most microcontroller systems are limited to Windows.
Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use for
beginners, yet flexible enough for advanced users to take advantage of as well. For teachers, it's
conveniently based on the Processing programming environment, so students learning to
program in that environment will be familiar with how the Arduino IDE works.
Open source and extensible software - The Arduino software is published as open source
tools, available for extension by experienced programmers. The language can be expanded
through C++ libraries, and people wanting to understand the technical details can make the leap
from Arduino to the AVR C programming language on which it's based. Similarly, you can add
AVR-C code directly into your Arduino programs if you want to.
Open source and extensible hardware - The plans of the Arduino boards are published
under a Creative Commons license, so experienced circuit designers can make their own version
of the module, extending it and improving it. Even relatively inexperienced users can build the
breadboard version of the module in order to understand how it works and save money.
13
The main working principle behind the working of this sensor is the Hall Effect.
According to this principle, in this sensor, a voltage difference is induced in the conductor due
to the rotation of the rotor. This induced voltage difference is transverse to the electric current.
When the moving fan is rotated due to the flow of water, it rotates the rotor which induces the
voltage. This induced voltage is measured by the Hall Effect sensor and displayed on the LCD
display. The water flow sensor can be used with hot waters, cold waters, warm waters, clean
water, and dirty water also. These sensors are available in different diameters, with different
flow rate ranges. These sensors can be easily interfaced with microcontrollers like Arduino.
For this, an Arduino microcontroller board for processing, a Hall effect water flow sensor, a
16×2 LCD display, and Breadboard connecting wires are required. The sensor is placed at the
water source inlet or at the opening of the pipe. The sensor contains three wires. Red wire to
connect with supply voltage. Black wire to connect to ground and a yellow wire to collect
output from Hall Effect sensor. For supply voltage 5V to 18V of DC is required.
Circuit Design
Connect the Red and Black wires of the YF-S201 Water Flow Sensor to +5V and GND.
Since I will be using the Interrupt feature of the Arduino, only Digital I/O Pins 2 and 3 are
possible to connect to the Output of the Water Flow Sensor.
In this project, I have connected the Output of the Water Flow Sensor (Yellow Wire) to
Digital I/O Pin 2 of Arduino UNO.
14
FLOAT SWITCH
All float operated liquid level controls operate on the basic buoyancy principle which
states “the buoyancy force action on an object is equal to the mass of liquid displaced by the
object.” As a result, floats ride on the liquid surface partially submerged and move the same
distance the liquid level moves. Because of this, they are normally used for narrow level
differential applications such as high level alarm or low level alarm.
The float rides on the process liquid surface, precisely tracking liquid surface motion.
Rising liquid level lifts the float, sliding the attraction sleeve up inside the enclosing tube and
into the magnetic field to actuate the electrical or pneumatic switch (signaling liquid
presence).
Subsequently, falling liquid level lowers the float, drawing the attraction sleeve out of
the magnetic field to deactivate the electrical or pneumatic switch (signaling liquid absence).
Float-type level switches are generally able to handle high-temperature applications, and
sometimes prove useful for close interface detection.
Floats can operate up to three switching elements. Independent switching levels may
be obtained with tandem floats. Consult the vendor for special float switching arrangements.
All these are optional & depends on our application.
15
SOLENOID VALVE
The solenoid valve is industrial equipment controlled by electromagnetism. It is an automatic
basic element to control the fluid. It belongs to the actuator, but not limits to the hydraulic
pressure and pneumatic control. In the industrial control system, the solenoid valve is used to
regulate the direction, flow rate, speed and other parameters of the medium. The solenoid
valve can coordinate with different circuits to realize the anticipated control, with both control
precision and flexibility being guaranteed.
The solenoid valve is constituted by the solenoid coil and magnetic core. It is the valve
body containing one or several holes. When the coil is get through or cut off with power, the
operation of the magnetic core will result in that the fluid passes through the valve body and is cut
off, so as to reach the goal of changing the fluid direction. The electromagnetic component of the
solenoid valve is constituted by the fixed iron core, movable iron core, coil and so on. The valve
body is constituted by the slide valve core, slide valve harness and spring base. The solenoid coil
is installed on the valve body directly while the valve body is enclosed in the seal pipe, so as to
constitute a simple and compact combination.
16
The solenoid valve has an enclosed chamber inside and ventilated holes in different
positions. Every hole is connected with different oil pipes. The chamber has a piston in the
middle. The two sides are two pieces of electromagnets. The electrifying magnetic coil will
attract the valve body to its side, so that different oil outlets will be opened or closed through
controlling the movement of the valve body. However, the oil inlet is constantly open. The
hydraulic oil will enter into different draw-off pipes. The oil pressure will be used to drive the
piston of the oil cylinder, which will drive the piston rod and then the mechanical device. In
this way, through controlling the current of the solenoid valve, the mechanical movement will
be controlled. Furthermore, let's briefly learn about the working principle of two main types
of solenoid valve.
Working principle
When the power is on, the electromagnetic force opens the pilot hole and the pressure
of the upper chamber decreases rapidly, forming a pressure difference which is low in the
upside and high in the bottom around the closure element. The fluid pressure promotes the
closure element to move upwards to open the valve. When the power is off, the spring force
closes the pilot hole. The pressure through the bypass port rapidly forms a pressure difference
which is high in the upside and low in the bottom around the closure element. The fluid
pressure drives the closure element to move downwards and close the valve.
Characteristics
The fluid pressure scope has a relatively high upper limit. It can be installed randomly,
with the fluid pressure difference condition being satisfied.
17
RELAY SWITCH
Relays are like remote control switches. It is highly used due to its simplicity, long
life, and reliability. Relays can take electrical inputs and gives mechanical output or vice
a 5V, 10A 2-Channel Relay interface board. It can be used to control various appliances, and
other equipments with large current. It can be controlled directly with 3.3V or 5V logic
signals from a microcontroller. It has a 1x4 (2.54mm pitch) pin header for connecting power
18
CHAPTER - III
SYSTEM DESIGN
19
3.1.2 SYSTEM FLOW DIAGRAM
One of the most important factors of an information system for the user is the output
the system produces. Without the quality of the output, the entire system may appear
unnecessary that will make us avoid using it possibly causing it to fail. Designing the output
should process the in an organized well throughout the manner. The right output must be
developed while ensuring that each output element is designed so that people will find the
system easy to use effectively. The water occupied value will be set and the float sensor will
stop the water flow when it touches the level automatically. The power will be consumed less
for the motor to pull the water from the lower tank to the upper tank.
This can be utilized in the municipal office big water tanks with few changes in the
circuit and devices. The solenoid valve and the water flow sensor can handle the above said
operations without having any human interventions.
21
CHAPTER – IV
SYSTEM TESTING AND IMPLEMENTATION
TYPES OF TESTING
Unit Testing
This is the first level of testing the sensors and the data. The different modules are
tested against the specifications produced during the integration. This is done to test the
internal logic and sensor values of each device module. Those resulting from the interaction
between sensors, equipments are initially avoided. The input received and output generated is
also tested to see whether it falls in the expected range of values because of the network and
the internet. Unit testing is performed from the bottom up, starting with the smallest and
lowest modules and proceeding one at a time. Here testing done individually with solenoid
valve, water flow sensor and the water level indicator to get the better results before
implementing the project.
22
Integration Testing
In integration testing, the tested modules water controlled are combined into sub-
systems, which are then tested. The goal of integration testing to check whether the sensors
are cooperated with the arduino board and the sensor to transfer it values through baud rate.
The different sensor modules were linked together and integration testing done on them.
23
CHAPTER –V
CONCLUSION AND FUTURE ENHANCEMENT
5.1 CONCLUSION
The smart water monitoring system using the arduino will be used in the
government and the individual home for the leakage and the overflow of the water. The
research area of saving drinking water is the main focussed area for the world to tackle the
water scarcity in various top class cities. Once this application is implemented the full control
of flow and the solenoid valve makes the wastage of drinking water overflow. It is used to
track the leakage and over flow in the city at any particular moment. Smooth and perfect
operations with the public and the other officials who are responsibility for the issues stated in
existing system. Currently this system can work for the individual home and it can be
developed for the government tanks and the big storey apartment houses to solve the water
problem issues. Water saving techniques in the business areas are like waterless urinals,
waterless car washes, infrared or foot-operated taps, pressurized water brooms, cooling tower
conductivity controllers, water-saving steam sterilizers (in hospitals and health care units),
rain water harvesting, water to water heat exchangers, etc.
24
BIBLIOGRAPHY
REFERENCE PAPERS
1. E. V. Ebere , Oladipo Onaolapo Francisca , “Microcontroller based automated water
2. Gaikwad Sonali Ashok, “Water antitheft and quality monitoring system by using PLC
building water supply system using PLC techniques,” Journal of Theoretical and
distribution system using solar energy”, International Journal of Engineering Research and
5. A. J. Whittle, M. Allen, A. Preis and M. Iqbal “Sensor networks for monitoring and
control of water distribution system” The 6th International Conference on Structural Health
Monitoring of Intelligent Infrastructure, Hong Kong 9-11 December 2013, Journal of Wireless
Mobile Networks, Ubiquitous Computing, and Dependable Applications, Vol. 6, No.1, pp. 4-23.
6. Sagar Khole, Tushar Kople and A.P More, “Automated Drinking water supply system
25
APPENDIX
A. REAL TIME ARCHITECTURE DIAGRAM
26
C. Programming sketch in IDE
E. Sample Codings
27
#define FLOAT_SENSOR 12
int sensorPin = A0;
int sensorValue;
int limit = 850;
void setup()
{
Serial.begin(9600);
pinMode(relay, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(FLOAT_SENSOR, INPUT_PULLUP);
pinMode(13, OUTPUT);
}
void loop()
{
sensorValue = analogRead(sensorPin);
Serial.println("Analog Value : ");
Serial.println(sensorValue);
fs=digitalRead(FLOAT_SENSOR);
28
Serial.println("Off");
}
delay(100);
}
void setup() {
Serial.begin(9600);
pinMode(16, OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
sensorValue1 = analogRead(sensorPin);
Serial.println(sensorValue1);
sw = digitalRead(switch1);
Serial.println(sw);
if (sensorValue1<limit || sw == HIGH) {
digitalWrite(16,LOW);
Blynk.virtualWrite(V4, 0);
}
else if (sensorValue1>limit || sw == LOW) {
digitalWrite(16, HIGH);
Blynk.virtualWrite(V4, 225);
}
delay(200);
}
{
sensorValue = analogRead(sensorPin);
Serial.println("Analog Value : ");
29
Serial.println(sensorValue);
fs=digitalRead(FLOAT_SENSOR);
30