Final Year Project
IoT Based Water Management and Supervision System -2019
Certification: Thakur Polytechnic
More Details on https://www.kaushikgupta.in
1. DEPARTMENTAL VISION & MISSION
ELECTRONICS & TELECOMMUNICATION
ENGINEERING DEPARTMENT
VISION
“Electronics & Telecommunication Department will strive to empower
students with excellent technical knowledge and practical skills
to meet the challenges of the industry and the society.”
MISSION
• To provide quality technical education through continuous faculty
training and industry institute interaction.
• To develop and create technical ambience in the department with
latest infrastructure facilities.
2. Project report
On
“IoT BASED WATER MANAGEMENT AND
SUPERVISION SYSTEM”
Submitted by
KAUSHIK GUPTA
Project Guide
MRS. KAVITA SINGH
DEPARTMENT OF
ELECTRONICS & TELECOMMUNICATION
ENGINEERING
ZAGDU SINGH CHARITABLE TRUST (REGD.)
THAKUR POLYTECHNIC
(An ISO 9001:2008 Certified Institute)
Thakur Complex, Next to W.E. Highway, Kandivali (E), Mumbai – 400 101.
2018-2019
3. PROJECT APPROVAL SHEET
This Project work entitled
IoT BASED WATER MANAGEMENT AND
SUPERVISION SYSTEM
By
KAUSHIK GUPTA
LAVESH LALWANI
SLEEVA RAJ
SURAJ JADHAV
Is approved for the award of the
DIPLOMA IN
DEPARTMENT OF
ELECTRONICS & TELECOMMUNICATION
ENGINEERING
MRS. KAVITA SINGH
Project Guide
--------------------------------- ---------------------------------
EXTERNAL EXAMINER INTERNAL EXAMINER
4. Affiliated to Maharashtra State Board of Technical Education
(MSBTE) Mumbai
C E R T I F I C A T E
This is to certify that
KAUSHIK GUPTA
LAVESH LALWANI
SLEEVA RAJ
SURAJ JADHAV
Have submitted this project work entitled “IoT Based Water Management
and Supervision System” is a bonafied record of project work carried out in
partial fulfilment for the award of the
DIPLOMA
IN
DEPARTMENT OF ELECTRONICS &
TELECOMMUNICATION ENGINEERING
This is a record of their own work carried out by them under our supervision and
guidance.
--------------------------------
PROJECT GUIDE
(MRS. KAVITA SINGH)
----------------------- ------------------------
H.O.D. (DEPT) PRINCIPAL
(MR. GANESH AKOLIYA) (Dr. S.M. GANECHARI)
2018-2019
5. 1
ACKNOWLEDGEMENT
We are thankful to a number of individuals who have contributed towards our final year project and
without whose help it would not have been possible. We would like to express our deep sense of
gratitude to our Principal, Dr. S.M. Ganechari for his valuable guidance in this endeavour. We are
also highly grateful to our Head of Department, Mr. Ganesh Akoliya for his thought-provoking
comments, valuable suggestions, constant motivation, encouragement and support.
We offer our sincere thanks to our Project guide, Mrs. Kavita Singh for her constant support and
timely help and guidance throughout our preparation. Her involvement right from conceptualization
of the study through its execution and meticulous perusal of the manuscript ensured its timely
completion.
We wish to take this opportunity to render thanks towards all the Electronics and
Telecommunication Engineering faculty at Thakur Polytechnic for their help and encouragement
towards making this project successful. Heartfelt thanks to our family for their unconditional support
and last but not the least our friends and colleagues for their help and cooperation.
Mumbai, February 2019.
Thanking you,
Kaushik Gupta
Lavesh Lalwani
Sleeva Raj
Suraj Jadhav
6. 2
ABSTRACT
Water resource management is becoming increasingly important. We've built a system that senses
the water levels in a tank, calls you when water levels are too low, and allows you to remotely refill
from a reserve.
This project focuses on monitoring of use of water, consider, by one block of house in a flat system,
where at the partition of pipeline from where gets diverted to various part of a block. This paper
presents an IOT device which helps to manage and plan the usage of water. This system can be
easily installed in residential societies. Sensors placed in the tank which continuously informs the
water level at the current time. This information will be updated on the cloud and using an android
application, user can visualize the water level on a smartphone anywhere that is connected to
Internet. According to the level of water in the tank the motor functioning will be automatically
controlled at low level of water motor will automatically turn on and when tank is about to fill up it
will cut off.
7. 3
INDEX
SR NO. CONTENTS PAGE NO.
1. INTRODUCTION 4
2. BLOCK DIAGRAM 5
3. CIRCUIT DIAGRAM 6
4. EXPLANATION OF PROJECT COMPONENTS 7
5. FIRMWARE REQUIRED 19
6. PROGRAM 21
7. ADVANTAGES 37
8. LIMITATIONS 37
9. PROGRAMMING WIFI MODULE 38
10. CONCLUSION 39
11.
PROBLEMS FACED DURING THE MAKING OF
THE PROJECT 40
12. REFERENCES 41
13. PICTURES RELATED TO THE PROJECT 42
8. 4
1.INTRODUCTION
Nearly the third quarterly portion of the earth which estimates up to 71 % portion of it is covered
with water. But out of which only 0.08% fresh water is available for human purposes and for living
beings the main sources of fresh water available for living purposes and for human use is the surface
water available as a result of rainfall which also recharges the lakes, different water resources like
aquifers Water scarcity is the problem faced by the Living creatures throughout the history and
whose intensity has increased during the last centenary It's estimated by next decade approximately
25% of the population of earth will live in perpetual scarcity of water It's a well- known fact that
physical factors affect the availability of water which is the culmination of the rainfall received by
that area due to number of geographical reasons. But it is also well documented fact that human
intervention is also affecting this factor which leads to unseasonal as well as in abnormal proportion
of water fall and as a result the priorities of the available water changes drastically. Improvements /
applications to appraise the IOT based water management, it can be ramified as diligent, frugal for
water management in a symbiotic panty way. Which will constrict the water resource evenly
according to the in-situ factors. According to scientists and organizations as Intergovernmental Panel
on Climate Change state has come, since a long lime. Where water management as such implies to
maximizing use of water and minimizing the wastage of water and thus preventing the domino effect
cycle arises as wastage of water. The sensors will sense the flow of water to each pipe which
ultimately tells the usage of water at one block readily.
This water usage data would be sent to cloud using the IOT space. This cloud data would be
sent to the concern resident's person's mobile app reporting the water used and altering the user to
limit the water use if it gets extended to the limit usage set by municipal government or corporation
If the limit gets extended the user have to pay accordingly. This will be real time operation. The
objective of doing so is for limiting and minimizing the usage of water for an average of per person.
And secondly, the cloud data will be used as statistic data for use of water at every season that is
winter, summer and monsoon so that measuring steps for water management can be taken with the
appropriate statistics. Yielding an avenue for predictive measure Improvements/Applications to
appraise the IOT based water management. It can be ramified as diligent, frugal for water
management in a symbiotic panty way, which will constrict the water resource evenly according to
the in-situ factors.
11. 7
4.EXPLAINATION OF COMPONENTS
LIST OF COMPONENTS
Sr.
No.
Components Value Quantity
1 Node MCU Wi-Fi development board ESP8266 1
2
Ultrasonic / Sonar Distance measuring
Sensor
HC – SR04 1
3 5V Relay REES52 1
4 Resistors
470Ω 1
1k Ω 1
10k Ω 1
4.7k Ω 1
5 Voltage Regulator 7805 IC 1
6 Step Down Transformer 6 Volts 1
7 Electrolytic Capacitor
0.01uF / 50V 1
2.5uF / 50V 1
470uF / 50V 1
100uF / 50V 1
8 Diodes 1N4007 4
9 Transistor BC548 1
10 LED 2V 4
12. 8
Node MCU Wi-Fi development board
NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-
Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module. The term
"Node MCU" by default refers to the firmware rather than the development kits. The firmware uses
the Lua scripting language. It is based on the eLua project, and built on the Espressif Non-OS SDK
for ESP8266. It uses many open source projects, such as lua-cjson and SPIFFS. The ESP8266 is a
Wi-Fi SoC integrated with a Tensilica Xtensa LX106 core, widely used in IoT applications.
It can be programmed directly through USB port using LUA programming or Arduino IDE. By
simple programming we can establish a Wi-Fi connection and define input/output pins according to
your needs exactly like Arduino, turning into a web server and a lot more.
NodeMCU is the Wi-Fi equivalent of ethernet module. It combines the features of Wi-Fi access point
and station + microcontroller. These features make the NodeMCU extremely powerful tool for Wi-Fi
networking. It can be used as access point and/or station, host a web server or connect to internet to
fetch or upload data.
13. 9
Features
• Finally, programable WiFi module.
• Arduino-like (software defined) hardware IO.
• Can be programmed with the simple and powerful Lua programming language or
Arduino IDE.
• USB-TTL included, plug & play.
• 10 GPIOs D0-D10, PWM functionality, IIC and SPI communication, 1-Wire and
ADC A0 etc. all in one board.
• Wi-Fi networking (can be used as access point and/or station, host a web server),
connect to internet to fetch or upload data.
• Event-driven API for network applications.
• PCB antenna.
Specifications.
Memory: 128kBytes
Developer: ESP8266 Open source Community
Operating system: XTOS
Storage: 4MBytes
CPU: ESP8266(LX106)
Power: USB
15. 11
Ultrasonic / Sonar Distance measuring Sensor
The Ultrasonic Sensor HC-SR04 is one of the most commonly used distance measuring
ultrasonic sensors and works extremely well with Arduino.
An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic
sound waves. It uses a transducer to send and receive ultrasonic pulses that relay back
information about an object’s proximity. High-frequency sound waves reflect from
boundaries to produce distinct echo patterns.
Ultrasound is reliable in any lighting environment and can be used inside or
outside. Ultrasonic sensors can handle collision avoidance for a robot, and being moved
often, as long as it isn’t too fast.
Ultrasonic Sensors are so widely used, they can be reliably implemented in grain bin sensing
applications, water level sensing, drone applications and sensing cars at your local drive-thru
restaurant or bank.
16. 12
Technical Specs:
Ultrasonic Sensor HC-SR04
Operating Voltage: 5V
Static current: 2mA max
Induction Angle: 15°
Detection Range: 2 – 200cm
High precision up to 3mm
Pins:
This module has 4 pins- VCC (5V), Trig, Echo, GND. Trig (trigger) is used to send out an
ultrasonic high-level pulse for at least 10μs and the Echo pin then automatically detects the
returning pulse.
Measuring Distance:
The time it takes the sound wave to be sent, hit the object and return back to the sensor is
measured. This time is then multiplied by the speed of sound (343m/sec = 0.0343cm/μs =
[1/29.1] cm/μs approx.) to give the total distance travelled by the ultrasonic wave, which is
then divided by 2 (to account for the fact that the wave was sent, hit the object, and then
returned back to the sensor, hence covering twice the distance to the object)
Distance = (Time for wave to return * Speed of sound) / 2.
17. 13
NodeMCU Usage:
This sensor module uses 2 digital pins (D1 and D2 ) on the NodeMCU for Trig and Echo,
and does not necessarily have to be pins 1 and 2. The code for measuring distance
with NodeMCU is given as:
// Generic Code for the working of UltraSonic Sensor connected to the NodeMcu (used in
the project)
// defines pins numbers
const int trigPin = 2; //D4
const int echoPin = 0; //D3
// defines variables
long duration;
int distance;
void setup () {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
}
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
18. 14
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
delay(2000);
}
19. 15
5Volts Relay
A relay is nothing more than a remote switch that uses an electromagnet to close a set of
contact points. Relays are often used in circuits to reduce the current that flows through the
primary control switch. A relatively low amperage switch, timer, or sensor can be used to
turn a much higher capacity relay on and off. As relay diagrams show, when a relay contact
is normally open (NO), there is an open contact when the relay is not energized. The other
side has three low voltage pins (Ground, VCC, and Signal) which connect to the Arduino.
Inside the relay is a 120-240V switch that's connected to an electromagnet. When the relay
receives a HIGH signal at the signal pin, the electromagnet becomes charged and moves the
contacts of the switch open or closed.
This is a 5V 4-channel relay interface board, and each channel needs a 15-20mA driver
current. It can be used to control various appliances and equipment with large current. It is
20. 16
equipped with high-current relays that work under AC250V 10A or DC30V 10A. It has a
standard interface that can be controlled directly by microcontroller.
Principle
When the signal port is at low level, the signal light will light up and the opt coupler 817c (it
transforms electrical signals by light and can isolate input and output electrical signals) will
conduct, and then the transistor will conduct, the relay coil will be electrified, and the
normally open contact of the relay will be closed. When the signal port is at high level, the
normally closed contact of the relay will be closed. So you can connect and disconnect the
load by controlling the level of the control signal port.
Features:
• Size: 75mm (Length) * 55mm (Width) * 19.3mm (Height)
• Weight: 61g
• PCB Colour: Blue
• There are four fixed screw holes at each corner of the board, easy for install and fix.
The diameter of the hole is 3.1mm
• High quality Single relay is used with single pole double throw, a common terminal, a
normally open terminal, and a normally closed terminal
• Optical coupling isolation, good anti-interference.
• Closed at low level with indicator on, released at high level with indicator off
• VCC is system power source, and JD_VCC is relay power source. Ship 5V relay by
default. Plug jumper cap to use
• The maximum output of the relay: DC 30V/10A, AC 250V/10A
23. 19
5.FIRMWARE REQUIRED
For the following project, you use Arduino IDE to program the NodeMcu, to interface with
other components and successfully work. Let’s get into the details for the same.
The industry-standard Keil C Compilers, Macro Assemblers, Debuggers, Real-time Kernels,
Single-board Computers, and Emulators support all 8051 derivatives are used for the
following project.
Keil is a German based Software development company. It provides several development
tools like
• IDE (Integrated Development environment)
• Project Manager
• Simulator
24. 20
• Debugger
• C Cross Compiler , Cross Assembler, Locator/Linker
Keil Software provides with software development tools for the 8051 family of
microcontrollers. With these tools, you can generate embedded applications for the multitude
of 8051 derivatives. Keil provides following tools for 8051 development
1. C51 Optimizing C Cross Compiler,
2. A51 Macro Assembler,
3. 8051 Utilities (linker, object file converter, library manager),
4. Source-Level Debugger/Simulator,
5. µVision for Windows Integrated Development Environment.
The Keil 8051 tool kit includes three main tools, assembler, compiler and linker.
An assembler is used to assemble your 8051 assembly program
A compiler is used to compile your C source code into an object file
A linker is used to create an absolute object module suitable for your in-circuit emulator.
8051 project development cycle: - these are the steps to develop 8051 project using keil
1. Create source files in C or assembly.
2. Compile or assemble source files.
3. Correct errors in source files.
4. Link object files from compiler and assembler.
5. Test linked application.
32. 28
"ttconsole.log(ui.values);n"
"ttvar someUrl = "/configRange?lower=" + ui.values[0]+"&upper="+ui.values[1];n"
" $.ajax(n"
"ttt{n"
"tttturl: someUrl,dataType: "text",success: function(response) {}n"
"ttt}) n"
" }n"
" })n"
" .slider("pips", {n"
" first: "pip",n"
" last: "pip"n"
" })n"
" .slider("float");n"
"</script>n"
"n"
"t</body>n"
"</html>"
};
//create new adafruit IO feed and name it as 'waterLevel'
//uncomment these two lines and write your wifi ssid/password
const char* ssid = "TP-LINK_E4C6";
const char* password = "91527516";
//also uncomment and write here your own adafruit IO username and key.
33. 29
#define AIO_USERNAME "kaushikgupta"
#define AIO_KEY "32df83ee9d4e42f1a1716e3ccdc15ccb"
//uncomment these lines as well, write radius of tank and total height in units of inches,
#define RADIUS 3
#define MAX_HEIGHT 15
//modify this line if you have to connect relay to some pin other than D4
#define MOTOR_CONTROL_PIN D4
//Connect trig of ultrasonic sensor at D1 and echo at D2, modify this line otherwise
UltraSonicDistanceSensor distanceSensor(D1,D2); //D1 trig, D2=echo
//these are default water level limits, these values will be applied on reset until user sends new limits
from webpage.
int waterLevelLowerThreshold=2;
int waterLevelUpperThreshold=5;
#define AIO_SERVER "io.adafruit.com"
#define AIO_SERVERPORT 1883 // use 8883 for SSL
float volume;
float liters;
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
// or... use WiFiFlientSecure for SSL
//WiFiClientSecure client;
34. 30
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME,
AIO_KEY);
Adafruit_MQTT_Publish waterLevel = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME
"/feeds/waterLevel");
Adafruit_MQTT_Subscribe onoff = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME
"/feeds/onoff");
/*************************** Sketch Code ************************************/
void MQTT_connect();
String inputString = ""; // a string to hold incoming data
String dataToSend="";
int waterLevelDownCount=0,waterLevelUpCount=0;
ESP8266WebServer server(80);
void handleRoot() {
server.send_P(200, "text/html;charset=UTF-8", index_html);
}
void handleLevelRequest(){
server.send(200,"text",String(liters));
}
void handleNotFound(){
String message = "File Not Foundnn";
40. 36
{
//Print the new value to the serial monitor
Serial.print("onoff: ");
Serial.println((char*) onoff.lastread);
//If the new value is "ON", turn the light on.
//Otherwise, turn it off.
if (!strcmp((char*) onoff.lastread, "ON"))
{
//active low logic
digitalWrite(D4, LOW);
}
else
{
digitalWrite(D4, HIGH);
}
}}
MQTT_connect();
server.handleClient();
}
41. 37
7.ADVANTAGES
• Can be controlled from anywhere in the world.
• Beneficial for both Rural and Urban Areas.
• Helpful in saving water. (using Water flow Sensor)
• Easier to compute water consumption.
• Helpful to cease water overflow.
• Saves electricity in long run.
• Easy to install and operate.
• Bugs can be fixed and systems updates are easy
8.LIMITATIONS
• Cannot be operated without an internet connection.
• Periodic maintenance of the connected sensors.
• Only 1 user can operate the system (via app) at a time.
• Limited UX Design.
42. 38
9.FUTURE SCOPE
• Can also be used in irrigation systems with few modifications.
• Helpful to detect water theft.
• We may include location data, water quality, temperature, humidity and various other
factors.
• Similarly, GPS shield can be integrated in the system to obtain location data of the
water source dynamically.
• Can be integrated with Prime Minister’s Smart Village Initiative.
43. 39
10. CONCLUSION
This IoT based proposed system is used to acquire water level and water consumption details
of a water source in real time from any location, any device connected to Internet. This water
level data can be used for various purposes for better management of water source.
Monitoring water level from remote location may be very useful when it is not possible to
visit location physically every time. The system can be implemented for different sources of
water by replacing sensor device suitable for the condition. In future, the proposed system
can be used to monitor and analyse water usage of the specific water source thus require
developing such logic for the application. The system can also be used to collect and study
the environmental data of water source and its surrounding area by integrating other sensor to
the system. The study may include location data, water quality, temperature, humidity and
various other factors. For example, Arduino GPS shield can be integrated in the system to
obtain location data of the water source dynamically. Similarly, Ethernet shield can also be
replaced with Wi-Fi shield/module for wireless connectivity if required. Concluding the
proposed IoT based water level monitoring system will be helpful to collect, analyse and
predict the water level detail, water usage and other information of particular water source at
particular location in real-time remotely.
44. 40
11. PROBLEMS FACED DURING THE MAKING OF
THE PROJECT
• To add the manual on-off control of motor (with also having the autonomous feature
enabled) in the same program was a bit difficult to do.
• To integrate all circuity in one module (PCB) was the main task to do and designing
of the PCB was initially a little confusion.
• The calibration of the ultrasonic sensor for the water tank was difficult
• Our project is based on water, it was necessary to make sure that the complete setup is
water tight and no leakages occur. We had to fix some leakage points, throughout the
making of the project.
45. 41
12. REFERENCES
While making this project, we referred to several books, technical magazines, websites and
visited some technical exhibitions. We have listed these references below:
• Institute of Electrical and Electronics Engineers.
• Sakthipriya, N.: An Effective Method for Crop Monitoring Using Wireless Sensor
Network, Journal of Scientific Research.
• Arduino liquid level indicator tutorial, https://goo.gl/fQMjDg.
• Arduino official software downloads.
• adafruit.io
• lastminuteengineers.com
• instructables.com
48. 44
(Left) Motor turns ON as water level is
low in the tank. Water tank starts filling.
(Below) A water in the tank reaches the
upper threshold limit (when water is full
in the tank) the motor automatically turns
off.