0% found this document useful (0 votes)
7 views87 pages

Project Report

The document presents a project report on the TWAD Smart Water Distribution and Water Quality Management System, developed by students of Electronics and Communication Engineering at Government College of Engineering, Tirunelveli. The system utilizes IoT-based sensors and cloud analytics for real-time monitoring of water quality and distribution, aiming to enhance efficiency and sustainability in water management. This project addresses challenges such as contamination, wastage, and infrastructure failures, promoting better decision-making for municipalities and water authorities.

Uploaded by

thileep1234567
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views87 pages

Project Report

The document presents a project report on the TWAD Smart Water Distribution and Water Quality Management System, developed by students of Electronics and Communication Engineering at Government College of Engineering, Tirunelveli. The system utilizes IoT-based sensors and cloud analytics for real-time monitoring of water quality and distribution, aiming to enhance efficiency and sustainability in water management. This project addresses challenges such as contamination, wastage, and infrastructure failures, promoting better decision-making for municipalities and water authorities.

Uploaded by

thileep1234567
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

TWAD SMART WATER DISTRIBUTION

AND
WATER QUALITY MANAGEMENT SYSTEM
A PROJECT REPORT
Submitted by

ARUN SURESH M 950821106009


HARISH KUMAR M 950821106305
KATHIRESAN S 950821106033
MUPPIDATHI E 950821106043

In partial fulfillment for the award of the degree

Of

BACHELOR OF ENGINEERING

IN

ELECTRONICS AND COMMUNICATION ENGINERRING

GOVERNMENT COLLEGE OF ENGINEERING,

TIRUNELVELI

ANNA UNIVERSITY: CHENNAI 600 025

1
JUNE 2025

ANNA UNIVERSITY: CHENNAI 600 025

BONAFIDE CERTIFICATE

Certified that this project report “ TWAD Smart Water Distribution and
Water Quality Management System ” is the Bonafide work of

ARUN SURESH M - 950821106009

HARISH KUMAR M - 950821106305

KATHIRESAN S - 950821106033

MUPPIDATHI E - 950821106043

who carried out the project work under my supervision.

Signature of the HOD with date Signature of the Supervisor with date

Dr. M. VIJAYARAJ M.E., Ph.D., Prof. A. RENALDO MAXIMUS


M.E .,

Professor and Head of the Department, Professor,


Department of Electronics and Department of Electronics and
Communication Engineering, Communication Engineering,
Government College of Engineering Government College of Engineering
Tirunelveli – 627 007. Tirunelveli – 627007.
2
CERTIFICATE EVALUVATION

College Name: Government College of Engineering, Tirunelveli

Branch: Electronics and Communication Engineering

Semester: 08 Subject Code& Name: EC3811 - Project Work

SL.NO. NAME OF TITLE OF NAME OF THE PROJECT


THE THE SUPERVISOR WITH
STUDENTS PROJECT DESIGNATION
1. ARUN SURESH M
(950821106009) Mr. A.RENALDO MAXIMUS
M.E .,
2. HARISH KUMAR M TWAD
(950821106305) Smart Water Professor,
Distribution Department of Electronics
3. KATHIRESAN S and Water and Communication
(950821106033) Quality Engineering,
Management Government College of
4. MUPPIDATHI E System Engineering,
(950821106043) Tirunelveli-627007.

The report of the project was submitted by the above students on fulfilment
for the award of the Bachelor of Engineering degree in Electronics and
Communication Engineering of Anna University Chennai were evaluated and
confirmed to be a complete report of the work done by the above students.

Submitted for EC3811-Project Work Examination held at Government


College of Engineering Tirunelveli, for ANNA UNIVERSITY-CHENNAI
Examination on

3
INTERNAL EXAMINER EXTERNAL EXAMINER

4
ACKNOWLEDGEMENT

I thank the almighty, for the blessings that have been showered upon us to
bring forth the success of the project work.

First and foremost, we thank the glorious almighty for blessing us with all
that was required for the completion of our project. We express our sincere
thanks to our principal Dr. P. LATHA, M.E., Ph.D., MISTE, for permitting us
to carry out this project work successfully.

I also take this opportunity to express my sincere thanks to Dr. M.


VIJAYARAJ M.E., Ph.D., MISTE, Professor and Head of the Department,
Department of Electronics and Communication Engineering, Government
College of Engineering, Tirunelveli who supported us throughout
the project.

I wish to express my thanks to our faculty advisor Dr. K. PADMAPRIYA


M.E., Ph.D., MISTE, for her encouragement and support to complete this
project.

I express my heartfelt gratitude to my guide Mr. A.RENALDO


MAXIMUS M.E ., Professor, Department of Electronics and Communication
Engineering, Government College of Engineering, Tirunelveli for her priceless
guidance and motivation for the project to complete it successfully.

I express our deep sense of thanks to all faculty members in my department


for their cooperation and interest shown at every stage of our endeavor in making
a project work success. Last but not least, our sincere thanks to our lovely parents

5
and friends who have been the constant source of our strength throughout our
life.

ABSTRACT

Water is an essential resource for human survival, economic development,


and environmental sustainability. Efficient management of water distribution and
quality is crucial to ensure a safe and reliable supply for communities.
Traditional water management systems often lack real-time monitoring, leading
to issues such as wastage, contamination, and infrastructure failures.

The TWAD Smart Water Distribution and Water Quality Management


System is designed to address these challenges by integrating IoT-based sensors
and cloud-based data analytics. This system enables continuous monitoring of
key water quality parameters such as temperature ensuring that the supplied
water meets safety standards.

Additionally, real-time data collection and predictive maintenance help


identify potential issues before they escalate, reducing operational costs and
enhancing system efficiency.

By implementing this smart water management system, municipalities and


water authorities can improve decision-making, optimize resource utilization, and
ensure a sustainable and equitable water supply for the population. This project
contributes to the advancement of water management technologies, promoting
long-term water conservation and public health.

6
7
TABLE OF CONTENTS

CHAPTER TITLE PAGE NO.


NO.

1. Introduction

2. Literature Review

System Implementation

3.1 Existing System


3.2 Proposed System
3. 3.3 Design
3.4 Block Diagram
3.5 Block Description
3.6 Circuit Diagram
3.7 Circuit Description
4. Hardware Details

4.1 ATMEGA 328


4.1.1 Description of Input
4.1.2 ATMEGA-328 IC

8
9
10
CHAPTER 1
INTRODUCTION

The global increase in population and rapid urbanization have significantly


raised the demand for clean and safe drinking water. Existing water distribution
systems, particularly in developing regions, struggle to keep pace with this rising
demand, often leading to supply shortages and inequitable distribution. This calls
for a smarter system that can adapt to changing consumption patterns and ensure
consistent supply.

Many areas are already facing water scarcity due to over-extraction of


groundwater, seasonal variability, and climate change. Traditional systems fail to
address efficient usage and conservation. A smart water distribution system is
essential to monitor consumption and encourage responsible usage through data-
driven insights.

Most water distribution networks operate blindly, with little to no real-time


feedback on the status of pipelines, reservoirs, or consumption trends. This
results in delayed responses to leaks, bursts, or low supply. Implementing real-
time monitoring through IoT sensors can provide immediate alerts and enable
proactive action.

Contamination of drinking water is a major health issue. Parameters such as


Total Dissolved Solids (TDS), temperature, and microbial content must be
monitored continuously to ensure safety. Traditional manual testing methods are
11
periodic and prone to delays. A smart system with continuous quality monitoring
can safeguard public health.

Aging pipelines, unplanned urban development, and poor maintenance


often result in pipe bursts, illegal connections, and high non-revenue water
(NRW). Smart systems can detect such anomalies instantly, allowing for timely
repairs and system optimization, thus reducing operational losses.

Manual supervision and emergency repairs due to unmonitored faults


significantly increase operational expenses for municipal bodies. Smart
predictive maintenance using IoT and data analytics reduces maintenance costs
and extends infrastructure lifespan by identifying problems before they escalate.

Without smart data systems, water distribution is often done uniformly,


ignoring region-specific requirements. This results in over-supply in some areas
and shortages in others. Smart water distribution can balance supply based on
real-time consumption data and storage levels, ensuring equitable delivery.

Water is a finite resource, and its mismanagement contributes to


environmental degradation. Smart systems help detect leaks, avoid wastage, and
support water conservation efforts, aligning with sustainable development goals
and promoting ecological balance.

The adoption of digital technologies like IoT, cloud computing, and AI has
revolutionized sectors like transportation and healthcare. Water management
systems too must evolve by integrating these technologies for smarter, more
responsive operations.

12
Consumers today demand transparency and accountability in public
services. A smart system can provide real-time updates on water quality and
supply status to users via mobile apps or dashboards, enhancing trust and
promoting community participation.

During natural disasters like floods or droughts, smart water systems can
provide critical data for emergency response. They enable authorities to make
informed decisions quickly, preventing large-scale disruptions in water access.

Government agencies are enforcing strict regulations on water quality and


distribution efficiency. Smart systems ensure compliance by automating data
collection, storage, and reporting, making it easier for municipal bodies to meet
regulatory standards and avoid penalties.

13
CHAPTER 2
LITERATURE REVIEW

[1] M. S. Islam, M. S. Hossain, and N. S. Islam, "A Smart IoT Based Water
Quality Monitoring System Using MQTT Protocol," 2019 International
Conference on Robotics, Electrical and Signal Processing Techniques
(ICREST), Dhaka, Bangladesh, pp. 378–382, 2019.

This paper presents an IoT-based water quality monitoring system that uses
the MQTT protocol for efficient data transmission. Key parameters such as pH,
turbidity, and temperature are monitored through sensors. The MQTT protocol
enables low-latency communication between sensors and a central database. The
system architecture includes microcontrollers, cloud platforms, and real-time
alert mechanisms. It emphasizes cost-effectiveness, scalability, and flexibility.
The paper demonstrates real-time visualization and analytics of water quality
data. It highlights the role of IoT in improving public health and environmental
monitoring. The system can be deployed in both urban and rural areas. Its
modular design ensures easy integration with smart city infrastructure. The
approach supports proactive decision-making for water safety.

[2] R. Al-Ali, I. Zualkernan, and F. Aloul, "A Mobile GPRS-Sensors Array


for Air Pollution Monitoring," IEEE Sensors Journal, vol. 10, no. 10, pp.
1666–1671, Oct. 2010.

This work introduces a mobile GPRS-enabled sensor array for


environmental monitoring, particularly air quality. Though focused on air
pollution, its framework is applicable to water quality monitoring as well. The
system integrates multiple sensors to gather data on environmental conditions.
GPRS communication facilitates real-time data transmission to central servers.
The mobile platform increases coverage and accessibility. It supports long-range
data communication at a low cost. The approach is energy-efficient and suitable
for developing regions. Data analytics are performed remotely using web-based
14
platforms. The study lays groundwork for scalable and mobile environmental
monitoring systems. It advocates for low-cost, sustainable sensor networks in
public health monitoring.

[3] S. K. S. Tyagi, A. Agarwal, and P. Maheshwari, "A Conceptual


Framework for IoT-Based Water Management in Smart Cities," 2016
International Conference on Internet of Things and Applications (IOTA),
Pune, India, pp. 374–379, 2016.

The paper proposes an IoT-based framework for integrated water


management in smart cities. It outlines the architecture for real-time monitoring
of water levels, flow, and quality. Key modules include sensor networks,
communication infrastructure, and cloud analytics. The system is designed to
optimize distribution and reduce losses. The framework also includes modules
for predictive maintenance and fault detection. It supports scalability for different
city sizes and water demands. The authors emphasize sustainability and
operational efficiency. Case scenarios demonstrate how IoT enhances decision-
making for utilities. It addresses challenges such as aging infrastructure and
resource scarcity. The paper serves as a guideline for implementing smart water
systems.

[4] M. A. Mazidi, S. N. Simic, and S. A. Gadsden, "A Survey of Smart Water


Quality Monitoring and Management," IEEE Access, vol. 8, pp. 110904–
110923, 2020.

This comprehensive survey reviews various smart water quality monitoring


systems. It categorizes existing technologies based on sensor type,
communication protocols, and data analytics. Key challenges such as energy
consumption, data reliability, and sensor accuracy are discussed. The paper
examines centralized and distributed architectures. It highlights real-time
applications in urban and rural settings. The study provides insights into security
and scalability issues. Emerging trends like machine learning and edge
computing are reviewed. The authors suggest future research directions for
robust and autonomous systems. The survey serves as a reference for developers

15
and policymakers. It underlines the need for interdisciplinary collaboration in
water management.

[5] M. Abdellatif, M. M. Dessouky, and H. M. El-Bakry, "An Efficient IoT-


Based Smart Water Quality Monitoring System," Multimedia Tools and
Applications, vol. 82, no. 5, pp. 1–21, 2023.

This paper develops an IoT-based water quality monitoring system focused


on efficiency and scalability. It monitors parameters such as pH, turbidity, TDS,
and temperature using real-time sensors. The system uses cloud computing for
data storage and analysis. A web-based dashboard allows authorities to view
trends and receive alerts. The design includes low-power components and solar-
powered options for rural deployment. The authors emphasize high system
accuracy and reliability. Experimental results confirm reduced latency and
improved detection. The system supports remote diagnostics and maintenance
alerts. It is adaptable to various water sources like rivers, lakes, and tanks. The
paper contributes to sustainable water resource management.

[6] J. Aira, T. Olivares, and F. M. Delicado, "SpectroGLY: A Low-Cost IoT-


Based Ecosystem for the Detection of Glyphosate Residues in Waters," IEEE
Transactions on Instrumentation and Measurement, Jan. 2024.

This study presents SpectroGLY, an IoT-based ecosystem to detect


glyphosate pesticide residues in water. It combines low-cost spectroscopic
sensors with a cloud-based analysis platform. The device is designed for field
deployment and easy scalability. It supports continuous monitoring and early
warning of toxic pollutants. SpectroGLY uses Wi-Fi and Bluetooth
communication for data transfer. The project emphasizes affordability and
accuracy in rural and agricultural settings. The modular design supports future
upgrades and sensor additions. It plays a vital role in ensuring agricultural water
safety. Experimental trials confirm high sensitivity to glyphosate levels. The
system bridges the gap between lab-grade detection and field usability.

16
[7] S. Kartakis, S. Yang, and J. A. McCann, "Reliability or Sustainability:
Optimal Data Stream Estimation and Scheduling in Smart Water
Networks," ACM Transactions on Sensor Networks (TOSN), Mar. 2017.

This research addresses the trade-off between data reliability and energy
sustainability in smart water networks. It proposes algorithms for optimal data
stream scheduling from sensor nodes. The system balances real-time monitoring
needs with limited energy resources. Techniques include predictive sampling and
adaptive data transmission. The study demonstrates improved network lifetime
without compromising on accuracy. Case studies validate the approach using
simulated water systems. The findings are crucial for designing energy-efficient
IoT deployments. It also considers wireless network latency and bandwidth
constraints. The approach supports fault tolerance and resilience in harsh
environments. The paper is significant for long-term deployments in remote
areas.

[8] G. Hajgató, G. Paál, and B. Gyires-Tóth, "Deep Reinforcement Learning


for Real-Time Optimization of Pumps in Water Distribution Systems,"
Journal of Water Resources Planning and Management, Oct. 2020.

The paper proposes the use of deep reinforcement learning (DRL) to


optimize pump operations in real time. The DRL model adjusts pump speeds and
schedules based on water demand patterns. It minimizes energy consumption
while maintaining adequate pressure. The simulation environment replicates
realistic urban water systems. Results show improved operational efficiency and
reduced cost. The model adapts to dynamic supply conditions and demand
fluctuations. It can be integrated with existing supervisory control and data
acquisition (SCADA) systems. The paper advances the application of AI in water
infrastructure. It also highlights the scalability of DRL for large-scale utilities.
Future work includes real-world validation and broader application.

17
[9] F. R. Ishengoma, "A Novel Design of IEEE 802.15.4 and Solar Based
Autonomous Water Quality Monitoring Prototype using ECHERP,"
International journal of Computer Science & Network Solutions, Oct. 2014.

This paper presents a solar-powered water quality monitoring prototype


using the IEEE 802.15.4 protocol. The system features an energy-efficient
routing algorithm, ECHERP, to extend network lifetime. Sensors detect
parameters like pH, conductivity, and turbidity. It is suitable for deployment in
off-grid or remote areas. The design ensures continuous operation using
renewable energy sources. Data is wirelessly transmitted to a monitoring station.
The solution is cost-effective and environmentally friendly. The prototype
demonstrates reliable data collection and power efficiency. It contributes to
sustainable monitoring in developing regions. The approach supports disaster-
prone or infrastructure-limited areas.

[10] S. Valai Ganesh, V. Suresh, S. G. Barnabas, and S. Rajakarunakaran,


"Innovative Solid Waste Management Strategies for Smart Cities in Tamil
Nadu: Challenges, Technological Solutions, and Sustainable Prospects,"
Discover Applied Sciences, vol. 6, no. 660, Dec. 2024.

Though focused on solid waste, this paper is relevant to water projects due
to its smart city context. It discusses the role of IoT and automation in managing
urban services. Technological interventions include smart bins, sensor networks,
and data platforms. Lessons can be applied to water distribution and quality
monitoring systems. The paper identifies administrative, financial, and
behavioural challenges. It emphasizes the need for integrated smart city
strategies. Policy recommendations are offered for sustainable infrastructure
development. The research promotes technology-driven solutions for urban
challenges. It encourages interdisciplinary approaches to public service
optimization. The findings highlight Tamil Nadu's potential as a model for smart
governance.

18
19
CHAPTER 3
SYSTEM IMPLEMENTATION

3.1 EXISTING SYSTEM


The traditional water distribution and quality management systems rely on
manual monitoring and conventional infrastructure, which have several
limitations: Manual Water Quality Testing – Water quality is checked periodically
by collecting samples and testing them in laboratories, leading to delays in
identifying contamination or quality issues. Fixed Water Distribution Schedules –
Water supply is managed based on pre-defined schedules rather than real-time
demand, which can lead to inefficient distribution and water shortages.

3.2 PROPOSED SYSTEM


Lack of Real-Time Monitoring : Authorities rely on periodic inspections and
consumer complaints to detect leaks, contamination, or pipeline failures, often
resulting in delayed responses.
High Water Wastage : Leakages and pipeline bursts go unnoticed for extended
periods, causing significant water loss before repairs are carried out.
Reactive Maintenance : Repairs and maintenance are performed only after
issues are reported, leading to costly emergency fixes and prolonged service
disruptions.
Limited Data Analysis : Decision-making is based on historical records and
assumptions rather than real-time insights, making it difficult to optimize
resource allocation effectively.
Due to these limitations, traditional water management systems struggle to
ensure a reliable, safe, and efficient water supply.
The need for automation, real-time monitoring, and predictive maintenance
highlights the importance of upgrading to a smart water distribution and quality
management system that integrates IoT and cloud-based analytics.

20
3.3 DESIGN

Water Level Monitoring : A Water Level Sensor continuously tracks the water
level inside the tank.
Water Quality Assessment : Temperature sensor measure water quality
parameters and send data to the Arduino Board.
Automated Pump Regulation :
• Pump 1 activates to fill the tank when the water level is low and stops when
it reaches a predefined threshold.

• Pump 2,3 distributes water to the outlet Zone 1 Zone 2.

IoT Integration : The system uses a Wi-Fi module to connect to an IoT web
server for remote monitoring.

21
3.4 BLOCK DIAGRAM

3.5 BLOCK DESCRIPTION


The block diagram represents an IoT-based smart water management
system using an Atmega 328p as the central processing unit.
The system incorporates a Water Level Sensor to monitor the water tank
level and a TDS (Total Dissolved Solids) Sensor to measure the quality of
water. Data from both sensors are processed by the Arduino Board, which
then displays the results on an LCD Display for local monitoring.
Simultaneously, the Arduino communicates with an IoT Web Server via a
Wi-Fi module, enabling real-time remote access and monitoring over a
wireless medium.
Based on sensor inputs and programmed logic, the Arduino controls a
Motor Driver that operates four DC Motor Pumps. Pump 1 fills the main
Water Tank, while Pumps 2, 3, distribute water to Zone 1, Zone 2
respectively.

22
This intelligent system ensures efficient and automated water distribution
and quality management across multiple zones.
3.6 CIRCUIT DIAGRAM

23
12VCC

TR1
BR1 5VCC

1 3
R1
VI VO
1k
C1 7805 C2

G N D
1000u U2 470u LED

2
BRIDGE

TRAN-2P2S

LCD1
LM016L

12V
12 Vcc
VDD
VSS
VEE
RW
RS

D 0
D 1
D 2
D 3
D 4
D 5
D 6
D 7

12Vcc RL1
E

12V
1
1
2
3
4
5
6
7
8
9
10
11
12
13
14

From 1C

U1 Pump 1
13 2 U3
PD0/RXD/PCINT16 PB0/ICP1/CLKO/PCINT0
12 3 9 12Vcc
PD1/TXD/PCINT17 PB1/OC1A/PCINT1 COM
11 5 1 16 12Vcc
PD2/INT0/PCINT18 PB2/SS/OC1B/PCINT2 1B 1C
10 4 2 15
PD3/INT1/OC2B/PCINT19 PB3/MOSI/OC2A/PCINT3 2B 2C
9 2 3 14
PD4/T0/XCK/PCINT20 PB4/MISO/PCINT4 3B 3C
8
PD5/T1/OC0B/PCINT21 PB5/SCK/PCINT5
3 4
4B 4C
13 12Vcc RL2
7 5 1 2 5 12 12V
PD6/AIN0/OC0A/PCINT22 PB6/TOSC1/XTAL1/PCINT6 5B 5C
7
PD7/AIN1/PCINT23 PB7/TOSC2/XTAL2/PCINT7
4 16MHZ 6
6B 6C
11
From 2C
7 10
7B 7C
7 13
AREF PC0/ADC0/PCINT8
1 12 ULN2003A
AVCC PC1/ADC1/PCINT9
11
PC2/ADC2/PCINT10
7
7
ADC6
ADC7
PC3/ADC3/PCINT11
PC4/ADC4/SDA/PCINT12
10
9 5VCC Pump 2
8
PC5/ADC5/SCL/PCINT13
7
PC6/RESET/PCINT14
12Vcc

ATMEGA328P Ultrasonic Sensor


12Vcc RL3
12V
GND From 3C
5VCC
5VCC
Pump 3
Wi-FI(ESP8266) Temperature Sensor

GND
GND

24
3.7 CIRCUIT DESCRIPTION

The circuit diagram illustrates an IoT-based automated water pump control


and monitoring system using an Arduino Uno. A 16x2 LCD (LM016L) is
interfaced with the Atmega 328p to display system status, connected through
digital pins 2 to 7.
A 10kΩ potentiometer (R1) is used to adjust the contrast of the LCD.
Sensors like the water level sensor and temperature sensor are connected to the
analog input pins A0 and A1 respectively for real-time monitoring.
A Wi-Fi module is interfaced to the Atmega328p through digital pins 0
(RX) and 1 (TX) to enable wireless communication and remote monitoring.
The output control to pumps is managed via a ULN2003A driver IC, which
amplifies the control signals from the Arduino.
The pumps are controlled through four relays (RL1 to RL3) connected to
the ULN2003A's outputs. Digital pins 8, 9, 10, and 11 of the microcontroller are
connected to the driver inputs to control Pump 1 (water tank filling) and Pumps 2
to (Zone 1, Zone 2,).
The system operates with a 12V supply for the pumps and relays, while
sensors and the Arduino operate at 5V, ensuring safe and efficient performance.

25
CHAPTER 4
HARDWARE DETAILS

4.1 ATMEGA 328 :

ATMEGA 328 microcontroller, which acts as a processor for the arduino


board. Nearly it consists of 28 pins. From these 28 pins, the inputs can be
controlled by transmitting and receiving the inputs to the external device. It also
consists of pulse width modulation (PWM). These PWM are used to transmit the
entire signal in a pulse modulation. Input power supply such as Vcc and Gnd are
used. These IC mainly consists of analog and digital inputs. These analog and
digital inputs are used for the process of certain applications.

DESCRIPTION OF INPUT:

ANALOG INPUT:

Arduino atmega-328 microcontroller board consist of 6 analog inputs pins.


These analog inputs can be named from A0 to A5. From these 6 analog inputs
pins, we can do the process by using analog inputs. Analog inputs can be used in
the operating range of 0 to 5V. Analog signal is considered as the continuous time
signal, from which these analog signal can be used for certain applications. These
are also called as non-discrete time signal. Inputs such as voltage, current etc..,
26
are considered to be either analog signal or digital signal only by analysing the
time signal properties. Various applications of arduino microcontroller can use
only an analog input instead of digital inputs. For these applications, analog input
ports or pins can be used.

DIGITAL INPUT:

Digital inputs can be defined as the non-continuous time signal with


discrete input pulses. It can be represented as 0’s and 1’s. These digital inputs can
be either on state or in off state. Arduino atmega328 microcontroller also consists
of 12 digital input pins. It can be stated as D0 to D11. Nearly 12 inputs can be
used for digital input/output applications. The working of the digital input ports
is where the discrete input pulses can be triggered and supplied to the ports.
These ports receive the input and therefore the port can be used for both input
and output process. These digital pins can access only the digital inputs.

ATMEGA-328 IC:

This ATMEGA-328 integrated chip consists of 28 pins. It consists of 6


analog inputs that are shown in the pin diagram.
27
Analog inputs can be represented as PC0 to PC5. These analog input pins
possess the continuous time signal which acts as an analog input for the system.
Further it also consists of 12 digital inputs. It can be represented as PD1 to PD11
which act as a digital input ports based on pulse width modulation (PWM). These
PWM, which transmits the signal in the form of discredited form. Both analog
and digital input ports can be used for various applications for the input power
supply, VCC and GND pins are used. Pins PB6 and PB7, which acts as a crystal
to generate a clock signal. By using these crystal, we can generate the clock
signals and by these clock signals, we can use this clock signals for input
sources. PC6 pin are the one where it can be used for the reset option. Resetting
the program can be done by using this PC6 pin.

The table below gives a description for each of the pins, along with their
function.
Pin
Description Function
Number
1 PC6 Reset
2 PD0 Digital Pin (RX)
3 PD1 Digital Pin (TX)
4 PD2 Digital Pin
5 PD3 Digital Pin (PWM)
6 PD4 Digital Pin
7 Vcc Positive Voltage (Power)
8 GND Ground
9 XTAL 1 Crystal Oscillator
10 XTAL 2 Crystal Oscillator
11 PD5 Digital Pin (PWM)
12 PD6 Digital Pin (PWM)
13 PD7 Digital Pin
14 PB0 Digital Pin
15 PB1 Digital Pin (PWM)
16 PB2 Digital Pin (PWM)
28
17 PB3 Digital Pin (PWM)
18 PB4 Digital Pin
19 PB5 Digital Pin
Positive voltage for ADC
20 AVCC
(power)
21 AREF Reference Voltage
22 GND Ground
23 PC0 Analog Input
24 PC1 Analog Input
25 PC2 Analog Input
26 PC3 Analog Input
27 PC4 Analog Input
28 PC5 Analog Input

FEATURES:

 High Performance, Low Power Design


 8-Bit Microcontroller Atmel® AVR® advanced RISC architecture
o 131 Instructions most of which are executed in a single clock cycle
o Up to 20 MIPS throughput at 20 MHz
o 32 x 8 working registers
o 2 cycle multiplier
 Memory Includes
o 32KB of programmable FLASH
o 1KB of EEPROM
o 2KB SRAM
o 10,000 Write and Erase Cycles for Flash and 100,000 for EEPROM
o Data retention for 20 years at 85°C and 100 years at 25°C

29
o Optional boot loader with lock bits
 In System Programming (ISP) by via boot loader
 True Read-While-Write operation
o Programming lock available for software security
 Features Include
o 2 x 8-bit Timers/Counters each with independent prescaler and
compare modes
o A single 16-bit Timer/Counter with an independent prescaler, compare
and capture modes
o Real time counter with independent oscillator
o 10 bit, 6 channel analog to digital Converter
o 6 pulse width modulation channels
o Internal temperature sensor
o Serial USART (Programmable)
o Master/Slave SPI Serial Interface – (Philips I2C compatible)
o Programmable watchdog timer with independent internal oscillator
o Internal analog comparator
o Interrupt and wake up on pin change
 Additional Features
o Internal calibrated oscillator
o Power on reset and programmable brown out detection
o External and internal interrupts
o 6 sleep modes including idle, ADC noise reduction, power save,
power down, standby, and extended standby

 I/O and Package


30
o 23 programmable I/O lines
o 28 pin PDIP package
 Operating voltage:
o 1.8 – 5.5V
 Operating temperature range:
o -40°C to 85°C
 Speed Grades:
o 0-4 MHz at 1.8-5.5V
o 0-10 MHz at 2.7-5.5V
o 0-20 MHz at 4.5-5.5V
 Low power consumption mode at 1.8V, 1 MHz and 25°C:
o Active Mode: 0.3 mA
o Power-down Mode: 0.1 μA
o Power-save Mode: 0.8 μA (Including 32 kHz RTC)

APPLICATIONS:

 DIY project prototyping.


 Developing varied varieties of projects that require a code based control.
 Automation System development.
 Learning AVR programming.
 Entry level circuit designing.

31
4.2 ULTRASONIC SENSOR :

The UTR (Ultrasonic Transmitter / Receiver) is a hybrid circuit that allows


to realize an ultrasonic detector adding few external components. Detection is
based on amplitude variation of received ultrasonic signal (40 KHz) due to the
movement of an object. It shows stable electric characteristics thanks to the
"Thick film hybrid" technology.
Ultrasonic sensors have an acoustic transducer which is vibrating at
ultrasonic frequencies. The pulses are emitted in a cone-shaped beam and aimed
at a target object. Pulses reflected by the target to the sensor are detected as
echoes. The device measures the time delay between each emitted and echo pulse
to accurately determine the sensor-to-target distance.

THEORY OF OPERATION :
The PING))) sensor detects objects by emitting a short ultrasonic burst and
then "listening" for the echo. Under control of a host microcontroller (trigger
pulse), the sensor emits a short 40 kHz (ultrasonic) burst. This burst travels
through the air at about 1130 feet per second, hits an object and then bounces
back to the sensor. The PING))) sensor provides an output pulse to the host that
will terminate when the echo is detected, hence the width of this pulse
corresponds to the distance to the target.

32
HC-SR04 Ultrasonic (US) sensor is a 4 pin module, whose pin names are
Vcc, Trigger, Echo and Ground respectively. This sensor is a very popular sensor
used in many applications where measuring distance or sensing objects are
required. The module has two eyes like projects in the front which forms the
Ultrasonic transmitter and Receiver. The sensor works with the simple high
school formula that

Distance = Speed × Time

The Ultrasonic transmitter transmits an ultrasonic wave, this wave travels


in air and when it gets objected by any material it gets reflected back toward the
sensor this reflected wave is observed by the Ultrasonic receiver module as
shown in the picture below

Now, to calculate the distance using the above formulae, we should know
the Speed and time. Since we are using the Ultrasonic wave we know the
universal speed of US wave at room conditions which is 330m/s. The circuitry
inbuilt on the module will calculate the time taken for the US wave to come back
and turns on the echo pin high for that same particular amount of time, this way
we can also know the time taken. Now simply calculate the distance using a
microcontroller or microprocessor.
33
FEATURES :
• Supply Voltage – 5 VDC
• Supply Current – 30 mA typ; 35 mA max
• Range – 2 cm to 3 m (0.8 in to 3.3 yrds)
• Input Trigger – positive TTL pulse, 2 uS min, 5 µs typ.
• Echo Pulse – positive TTL pulse, 115 uS to 18.5 ms
• Echo Hold-off – 750 µs from fall of Trigger pulse
• Burst Frequency – 40 kHz for 200 µs
• Burst Indicator LED shows sensor activity

34
• Delay before next measurement – 200 µs

APPLICATIONS :
• Car Alarm systems
• Residential and commercial security systems
• Automatic doors opening systems

4.3 RELAY DRIVER :

CIRCUIT DIAGRAM :

35
DRIVER :
Driver is used for drive the relay. ULN2003A IC is used as driver. This IC
has some special features
 Seven Darlington’s per package
 output current 500ma per driver (600ma peak)
 output voltage 50v
 integrated suppression diodes for inductive loads
 outputs can be paralleled for higher current
 ttl/cmos/pmos/dtl compatible inputs

DESCRIPTION :
The ULN2001A, ULN2002A, ULN2003 and ULN2004Aare high voltage,
high current Darlington arrays each containing seven open collector dar-lington
pairs with common emitters. Each channel rated at 500mAand can withstand
peak currents of 600mA. Suppression diodes are included for inductive load
driving and the inputs are pinned opposite the outputs to simplify board layout.
The four versions interface to all common logic families

36
ULN2001A General Purpose, DTL, TTL, PMOS, CMOS
ULN2002A 14-25V PMOS
ULN2003A 5V TTL, CMOS
ULN2004A 6-15V CMOS, PMOS

These versatile devices are useful for driving a wide range of loads
including solenoids, relays DC motors; LED displays filament lamps, thermal
print-head sand high power buffers ULN2001A/2002A/2003Aand 2004A is sup-
plied in 16 pin plastic DIP packages with a copper lead frame to reduce thermal
resistance. They are available also in small outline package (SO-16) as
ULN2001D/2002D/2003D/2004D.
PIN DIAGRAM – ULN 2003

37
The ULN2003A is a high voltage, high current, Darlington Arrays each
containing seven open collection Darlington pairs with common emitters. Each
channel rated at 500mA and can withstand peak currents of 600mA. Suppression
diodes are included for inductive load driving and the inputs are pinned opposite
to outputs to simplify layout. It is a 5V TTL, CMOS. This versatile device is
useful for driving a wide range of loads including solenoids, relays, DC motors,
LED displays, and high power buffers. Outputs can be paralleled for higher
current.
The output of MC is applied to the input of relay driver transistor at its
phase terminals. When the input base voltage is reduced so that the relay is de-
energized, the collector current falls to zero abruptly. This sudden switching off
the relay current induces a very high back emf in the relay coils, which may be
high enough to puncture the collector-emitter junction at the transistor and damage
it. A large capacitor connected in parallel with the relay coil absorbs this transient
and protects the transistor. However large capacitor connected in parallel with the

38
relay coil absorbs this transient, protects the transistor and sluggish the relay
operations.
In an alternative method, a diode is connected in parallel with relay coil
instead of the capacitor. During normal operation, the diode is reversed biased and
has no effects on circuit performance, but, when the high back emf is induced, it
has the proper polarity for the diode to conduct. The diode there after conducts
heavily and absorbs all the transient voltage. The use of a diode is parallel with the
relay coil is highly recommended.

WORKING OF ULN2003 IC:

The ULN2003 IC consists of eight NPN Darlington pair which provides the
proper current amplification required by the loads. We all know that the
transistors are used to amplify the current but here Darlington transistor pairs are
used inside the IC to make the required amplification.

A Darlington pair is two transistors that act as a single transistor providing


high current gain. In this pair the current amplified by the first transistor is
further amplified by the next transistor providing high current to the output
terminal.
When no base voltage is applied that when no signal is given to the input
pins of the IC, there will be no base current and transistor remains in off state.
When high logic is fed to the input both the transistors begin to conduct
providing a path to ground for the external load that the output is connected.
39
Thus when an input is applied corresponding output pin drops down to zero there
by enabling the load connected to complete its path.

FEATURES:
 Output Voltage: 50 V
 Input Voltage (for ULN2002A/D - 2003A/D - 2004A/D): 30 V
 Continuous Collector Current: 500 mA
 Continuous Base Current: 25 mA
 Operating Ambient Temperature Range: – 20 to 85 °C
 Storage Temperature Range: – 55 to 150 °C
 Junction Temperature: 150 °C

4.4 RELAY :

RELAY PIN DIAGRAM :

40
Relays are switching devices. Switching devices are the heart of
industrial electronic systems. When a relay is energized or activated, contacts are
made or broken. They are used to control ac or dc power. They are used to
control the sequence of events in the operation of a system such as an electronic
heater, counter, welding circuits, and X-ray equipment, measuring systems, alarm
systems and telephony. Electromagnetic relays are forms of electromagnets in
which the coil current produces a magnetic effect. It pulls or pushes flat soft iron
armatures or strips carrying relay contacts. Several relay contact can be operated
to get several possible ON/OFF combinations.

OPERATION OF ELECTROMAGNETIC RELAY :


Relays are usually dc operated. When dc is passed to the coil, the core gets
magnetized. The iron armature towards the core contacts 1 and 2 open and
contacts 2 and 3 close. When coil current is stopped, the attraction is not there
and hence the spring tension brings 1 and 2 to closed position, opening the other
set 2 and 3.

Electromagnetic Relay

Relay Contacts and Identification

41
The heart of the relay is the ‘junction’ of the contact points. The relay
contact points may be flat, spherical, pointed and combination of all these. Flat
contacts require more pressure for perfect contact closing. Half round contacts
are better because the surface contamination will be minimum. The twin contacts
give reliable operation.
Relay contacts are made of silver and silver alloys in small power
applications. For large relays, contacts are made up of copper. Certain relays use
silver – palladium of platinum – ruthenium alloys for contacts. The special types
mentioned above give long life, carry moderate currents and keep shape for long
time.
To identify relay contacts, some important contact arrangements must be
remembered.
SPST - Single Pole Single Throw
SPDT - Single Pole Double Throw
NO - Normally Opened
NC - Normally Closed
Break - Relay action opens or breaks contacts
Make - Relay action makes or closes contacts

Relays are electromagnetic device by which operation of one or more


circuits can be controlled by the operation of some other circuit. Relay is a type
of switch where switching completely depends upon the electromagnetism.
When winding of insulted wire is made on soft iron rod and apply is given
across its end then magnetic field develops around the rod and due to this
magnetic field, magnetism also becomes magnet.
In this way, can be said that on giving supply to the coil winded over a core,
it becomes magnet. This magnet is known as electromagnet.
Relay is a device which can turn ON/OFF any external circuit in some
special circumstances. The principal relay is a one pole 2 way switch. The

42
difference is that simple switch is manual switch where as relay is an automatic
switch to some extent. It has a coil in it.
When this coil gets enough supply then it becomes electromagnet and
attracts the strip of pole towards itself and changes the position of switch. When
supply cuts off then coil demagnetizes and thus switch comes in its normal
position. In telephony, the relays are used widely. The relay that we used in this
circuit has two states.
 Normally closed state (NC)
 Normally opened state (NO)

The control circuit of the relay transistor is shown in figure. When the input
to transistor is logic 0, the transistor will be open. So the relay will be holding
+12 and which will be in normally closed state.
Relays are electro mechanical switches and are electrically operated power
switches. A relay consists of an electromagnet which when energized pulls the
armature. The armature carries heavy electrical contacts that make or break an
electric circuit. General purpose relays can handle current of five or ten amperes.
Relays that have contact ratings of about 25A or more are known as contactors. A
single relay can make or break a number of contacts simultaneously.
The amount of electrical power required to drive a relay is very small. Most
Voltage stabilizers use relay coils of 720mw.It means that 12v relay coil will have
resistance of 200 ohms and operated up to 60mA.The same relay with 450 ohms
coil will operate on 18v with 40mA.Transistor circuits can easily supply this
much of power and this much of power and thus control large amount of power
through relay contacts.
When the relay is not activated (ie.) in the reenergized state, NC contacts
are closed and NO connections are opened. When the relay is activated (ie.)in the
energized state, NC contacts broken and NO contacts are made. When the relay is
de energized the original states of the contacts are returned.
The Above relays are single contact relays. This means that the relays have
one common point, one NO contact and one NC contact.

43
Double contact relays are also present. These relays have a set of common
points, a set of NO contacts and set of NC contacts. In single contact relay, only
one relay independent load or a series of different loads can be connected.
In double contact relay, two independent loads can be connected at two
different contacts and these two different and these two loads can be operated as
desired.

4.5 WI-FI MODULE (ESP8266)


The ESP8266 WiFi Module is a self-contained SOC with integrated TCP/IP
protocol stack that can give any microcontroller access to your WiFi network.
The ESP8266 is capable of either hosting an application or offloading all Wi-Fi
networking functions from another application processor. Each ESP8266 module
comes pre-programmed with an AT command set firmware, meaning, you can
simply hook this up to your Arduino device and get about as much WiFi-ability
as a WiFi Shield offers (and that’s just out of the box)! The ESP8266 module is
an extremely cost effective board with a huge, and ever growing, community.

This module has a powerful enough on-board processing and storage


capability that allows it to be integrated with the sensors and other application
specific devices through its GPIOs with minimal development up-front and
minimal loading during runtime. Its high degree of on-chip integration allows for
44
minimal external circuitry, including the front-end module, is designed to occupy
minimal PCB area. The ESP8266 supports APSD for VoIP applications and
Bluetooth co-existence interfaces, it contains a self-calibrated RF allowing it to
work under all operating conditions, and requires no external RF parts.

The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP


stack and microcontroller capability produced by Shanghai-based Chinese
manufacturer, Espressif Systems.

The chip first came to the attention of western makers in August 2014 with
the ESP-01 module, made by a third-party manufacturer, Ai-Thinker. This small
module allows microcontrollers to connect to a Wi-Fi network and make simple
TCP/IP connections using Hayes-style commands. However, at the time there
was almost no English-language documentation on the chip and the commands it
accepted. The very low price and the fact that there were very few external
components on the module which suggested that it could eventually be very
inexpensive in volume, attracted many hackers to explore the module, chip, and
the software on it, as well as to translate the Chinese documentation.

The ESP8285 is an ESP8266 with 1 MiB of built-in flash, allowing for


single-chip devices capable of connecting to Wi-Fi.

WI-FI PROTOCOLS :

• 802.11 b/g/n support


45
• 2 x Wi-Fi interface, supports infrastructure BSS Station mode / P2P mode /
SoftAP mode support
• Hardware accelerators for CCMP (CBC-MAC, counter mode), TKIP (MIC,
RC4), WAPI (SMS4), WEP (RC4), CRC
• 802.11n support (2.4 GHz)
• Supports MIMO 1×1 and 2×1, STBC, and 0.4 μs guard interval
• WMM
• UMA compliant and certified
• Antenna diversity and selection (software managed hardware)
• Configurable packet traffic arbitration (PTA) with dedicated slave processor
based design provides flexible and exact timing Bluetooth co-existence support
for a wide range of Bluetooth Chip vendor.

SPECIFICATIONS :

46
4.6 INTERNET OF THINGS (IOT) :
47
The Internet of Things (IoT) is the network of physical objects or "things"
embedded with electronics, software, sensors, and network connectivity, which
enables these objects to collect and exchange data.
IoT allows objects to be sensed and controlled remotely across existing
network infrastructure, creating opportunities for more direct integration between
the physical world and computer-based systems, and resulting in improved
efficiency, accuracy and economic benefit.
"Things," in the IoT sense, can refer to a wide variety of devices such as
heart monitoring implants, biochip transponders on farm animals, electric clams
in coastal waters, automobiles with built-in sensors, DNA analysis devices for
environmental/food/pathogen monitoring or field operation devices that assist
fire-fighters in search and rescue operations.
These devices collect useful data with the help of various existing
technologies and then autonomously flow the data between other devices.

HOW IOT WORKS?

Internet of Things is not the result of a single novel technology; instead,


several complementary technical developments provide capabilities that taken
together help to bridge the gap between the virtual and physical world.
These capabilities include:
 Communication and cooperation
 Addressability
 Identification
 Sensing
 Actuation
 Embedded information processing
 Localization
 User interfaces

48
THE STRUCTURE OF IOT :
The IoT can be viewed as a gigantic network consisting of networks of
devices and computers connected through a series of intermediate technologies
where numerous technologies like RFIDs, wireless connections may act as
enablers of this connectivity.
 Tagging Things: Real-time item traceability and addressability by RFIDs.
 Feeling Things: Sensors act as primary devices to collect data from the
environment.
 Shrinking Things: Miniaturization and Nanotechnology has provoked the
ability of smaller things to interact and connect within the “things” or
“smart devices.”
 Thinking Thing: Embedded intelligence in devices through sensors has
formed the network connection to the Internet. It can make the “things”
realizing the intelligent control.

IOT AS A NETWORK OF NETWORKS :

These networks connected with added security, analytics, and management


capabilities. This will allow IoT to become even more powerful in what it can
help people achieve.
49
APPLICATIONS:

 Building and Home automation


 Manufacturing
 Medical and Healthcare systems
 Media
 Environmental monitoring
 Infrastructure management
 Energy management
 Transportation
 Better quality of life for elderly

Internet of Things is the next stage of the information revolution and


referenced the inter-connectivity of everything from urban transport to medical
devices to household appliances.
Integration with the Internet implies that devices will use an IP address as a
unique identifier. However, due to the limited address space of IPv4 (which
allows for 4.3 billion unique addresses), objects in the IoT will have to use IPv6
to accommodate the extremely large address space required.
Objects in the IoT will not only be devices with sensory capabilities, but
also provide actuation capabilities (e.g., bulbs or locks controlled over the
Internet).
On the other hand, IoT systems could also be responsible for performing
actions, not just sensing things. Intelligent shopping systems, for example, could
monitor specific users' purchasing habits in a store by tracking their specific
mobile phones. These users could then be provided with special offers on their
favourite products, or even location of items that they need, which their fridge
has automatically conveyed to the phone.
Additional examples of sensing and actuating are reflected in applications
that deal with heat, electricity and energy management, as well as cruise-assisting

50
transportation systems. Other applications that the Internet of Things can provide
is enabling extended home security features and home automation.
ENABLING TECHNOLOGIES

RFID Sensor Smart Tech Nano Tech

RFID :
To identify and track the data of things.
Sensor :
To collect and process the data to detect the changes in the physical status
of things.
Smart Tech :
To enhance the power of the network by devolving processing capabilities
to different part of the network.
Nano Tech :
To make the smaller and smaller things have the ability to connect and interact .

IOT – ADVANTAGES :

 Improved Customer Engagement : Current analytics suffer from blind-


spots and significant flaws in accuracy; and as noted, engagement remains
passive. IoT completely transforms this to achieve richer and more effective
engagement with audiences.
 Technology Optimization : The same technologies and data which
improve the customer experience also improve device use, and aid in more
potent improvements to technology. IoT unlocks a world of critical
functional and field data.

51
 Reduced Waste : IoT makes areas of improvement clear. Current analytics
give us superficial insight, but IoT provides real-world information leading
to more effective management of resources.

 Enhanced Data Collection : Modern data collection suffers from its


limitations and its design for passive use. IoT breaks it out of those spaces,
and places it exactly where humans really want to go to analyze our world.
It allows an accurate picture of everything.

IOT – DISADVANTAGES :

 Security : IoT creates an ecosystem of constantly connected devices


communicating over networks. The system offers little control despite any
security measures. This leaves users exposed to various kinds of attackers.
 Privacy : The sophistication of IoT provides substantial personal data in
extreme detail without the user's active participation.
 Complexity : Some find IoT systems complicated in terms of design,
deployment, and maintenance given their use of multiple technologies and
a large set of new enabling technologies.
 Flexibility : Many are concerned about the flexibility of an IoT system to
integrate easily with another. They worry about finding themselves with
several conflicting or locked systems.
 Compliance : IoT, like any other technology in the realm of business, must
comply with regulations. Its complexity makes the issue of compliance
seem incredibly challenging when many consider standard software
compliance a battle.

52
IOT SOFTWARE :
IoT software addresses its key areas of networking and action through
platforms, embedded systems, partner systems, and middleware. These individual
and master applications are responsible for data collection, device integration,
real-time analytics, and application and process extension within the IoT
network. They exploit integration with critical business systems (e.g., ordering
systems, robotics, scheduling, and more) in the execution of related tasks.

 Data Collection :
This software manages sensing, measurements, light data filtering, light
data security, and aggregation of data. It uses certain protocols to aid sensors in
connecting with real-time, machine-to-machine networks. Then it collects data
from multiple devices and distributes it in accordance with settings. It also works
in reverse by distributing data over devices. The system eventually transmits all
collected data to a central server.
 Device Integration :
Software supporting integration binds (dependent relationships) all system
devices to create the body of the IoT system. It ensures the necessary cooperation
and stable networking between devices. These applications are the defining
software technology of the IoT network because without them, it is not an IoT
system. They manage the various applications, protocols, and limitations of each
device to allow communication.
 Real-Time Analytics :
These applications take data or input from various devices and convert it
into viable actions or clear patterns for human analysis. They analyze information
based on various settings and designs in order to perform automation-related
tasks or provide the data required by industry.
 Application and Process Extension :

53
These applications extend the reach of existing systems and software to
allow a wider, more effective system. They integrate predefined devices for
specific purposes such as allowing certain mobile devices or engineering
instruments access. It supports improved productivity and more accurate data
collection.
4.7 LCD DISPLAY :
Liquid Crystal Displays (LCDs) have materials, which combine the
properties of both liquid and crystals. Rather than having a melting point, they
have a temperature range within which the molecules are almost as mobile as
they would be in a liquid, but are grouped together in an ordered form similar to
a crystal. An LCD consists of two glass panels, with the liquid crystal material
sand witched in between them. The inner surface of the glass plates are coated
with transparent electrodes which define the character, symbols or patterns to be
displayed polymeric layers are present in between the electrodes and the liquid
crystal, which makes the liquid crystal molecules to maintain a defined
orientation angle. One each polarizer are pasted outside the two glass panels.
This polarizer would rotate the light rays passing through them to a definite
angle, in a particular direction. When the LCD is in the off state, light rays are
rotated by the two polarizer and the liquid crystal, such that the light rays come
out of the LCD without any orientation, and hence the LCD appears transparent.
When sufficient voltage is applied to the electrodes, the liquid crystal molecules
would be aligned in a specific direction.

The LCDs are lightweight with only a few millimeters thickness. Since the
LCD’s consume power, they are compatible with low power electronic circuits,
54
and can be powered for long durations. The LCD does don’t generate light and so
light is needed to read the display. By using backlighting, reading is possible in
the dark. The LCD’s have long life and a wide operating temperature range.
Changing the display size of the layout size is relatively simple which makes the
LCD’s more customers friendly.
The LCD’s used exclusively in watches, calculators and measuring
instruments are the simple seven-segment displays, having a limited amount of
numeric data. The recent advances in technology have resulted in better legibility,
more information displaying capability and a wider temperature range. These
have resulted in the LCDs being extensively used in telecommunications and
entertainment electronics. The LCDs have even started replacing the cathode ray
tubes (CRTs) used for the display of text and graphics, and also in small TV
applications.

LCD MODULE 16×4 :

It has 16 pins and can be operated in 4-bit mode or 8-bit mode. Here we are
using the LCD module in 4-bit mode. Before going in to the details of the
project, let’s have a look at the JHD162A LCD module.

Pin of the JHD162A LCD module is given below.


Pin1 (Vss): Ground pin of the LCD module.
Pin2 (Vcc): +5V supply is given to this pin.
Pin3 (VEE): Contrast adjustment pin. This is done by connecting the ends of a
10K potentiometer to +5V and ground and then connecting the slider pin to the
VEE pin. The voltage at the VEE pin defines the contrast. The normal setting is
between 0.4 and 0.9V.
Pin4 (RS): Register select pin. The JHD162A has two registers namely
command register and data register. Logic HIGH at RS pin selects data register
and logic LOW at RS pin will select command register. If we make the RS pin
55
HIGH and put a data on the data lines (DB0 to DB7) it will be recognized as a
data. If we make the RS pin LOW and put a data on the data lines, then it will be
taken as a command.
Pin5 (R/W): Read/Write modes. This pin is used for selecting between read and
write modes. Logic HIGH at this pin activates read mode and logic LOW at this
pin activates write mode.
Pin6 (E): This pin is meant for enabling the LCD module. A HIGH to LOW
signal at this pin will enable the module.
Pin7 (DB0) to Pin14 (DB7): These are data pins. The commands and data are
put on these pins.
Pin15 (LED+): Anode of the back light LED. When operated on 5V, a 560 ohm
resistor should be connected in series to this pin. In arduino based projects the
back light LED can be powered from the 3.3V source on the arduino board.
Pin16 (LED-): Cathode of the back light LED.

4.8 SOLENOID VALVE :


A solenoid valve is an electromechanically operated valve used to control
the flow of liquids or gases. These valves consist of a solenoid, which is an
electric coil with a movable ferromagnetic core (plunger) in its center. When an
electric current passes through the coil, it creates a magnetic field that moves the
plunger, opening or closing the valve.

Solenoid valves come in various types, including two-way and three-way


valves. A two-way valve has two ports (inlet and outlet) and can be normally
open (NO) or normally closed (NC). A three-way valve has three ports and can
switch the flow between different paths. Solenoid valves are widely used in
various applications, such as irrigation systems, dishwashers, and industrial
processes, due to their fast switching, high reliability, and compact design.

APPLICATIONS:

56
1. Manufacturing Systems: Solenoid valves are used to control machines,
dose, mix, or restrict the flow of liquids or gases. For example, in beverage
factories, they measure the exact amount of drink to be poured into bottles.
2. Agriculture: Solenoid valves are found in irrigation devices such as
automatic sprinklers and motorized farm machines to dose substances.
They control the flow of water and can operate sprinklers autonomously.
3. Automotive Applications: Solenoid valves regulate the flow of automotive
fluids such as oil, brake fluid, or fuel. They are used in functions like
limiting fuel flow to reduce vehicle speed or shutting off fuel flow to stop a
vehicle.
4. Vacuum Systems: Solenoid valves are used in vacuum applications,
including electronics manufacturing, vacuum pumps, and automation
systems.
5. Home Heating Units: They control the flow of heating fluids in home
heating systems.
6. Refrigeration Appliances: Solenoid valves are used to control the flow of
refrigerants in refrigeration systems.
7. Car Washing Machines: They control the flow of water and cleaning
agents in car washing systems.
8. Air Compressor Units: Solenoid valves regulate the flow of air in air
compressor systems.

TECHNICAL SPECIFICATIONS:

 Operating Principle: Electromagnetic (noiseless)


 Coil Voltage Rating: 24 V DC
 Ways: 2/2 way
 End Connection: 1/2" NPT (F)
57
 Body Material: SS316 bar stock
 Trim Material: SS-316
 Duty: Suitable for continuous energization
 Sealing: Airtight and leak-proof
 Ambient Temperature: 0 - 50° C
 Fluid Temperature: 0-75° C (approx.)
 Coil Enclosure: Stainless Steel
 Insulation: Class-H
 Coil Casing: IP-65 (Explosion proof for NEC Class-1, Division-1 area)
 Mounting: On pipe or on panel
 Cable Connection: 1/2” NPT
 Accessories: Cable glands, SS Tag plate
 Approval: UL listed
 Working Pressure: 1-20 kg/cm²

4.9 SINGLE POWER SUPPLY:

Power supply gives supply to all components. It is used to convert AC


voltage into DC voltage. Transformer used to convert 230V into 12V AC.12V
AC is given to diode. Diode range is 1N4007, which is used to convert AC
voltage into DC voltage. AC capacitor used to charge AC components and
discharge on ground. LM 7805 regulator is used to maintain voltage as constant.
Then signal will be given to next capacitor, which is used to filter unwanted AC
component. Load will be LED and resister. LED voltage is 1.75V.if voltage is
above level beyond the limit, and then it will be dropped on resister.

58
POWER SUPPLY:

Most electronic circuits require DC voltage sources or power supplies. If


the electronic device is to be portable, then one or more batteries are usually
needed to provide the DC voltage required by electronic circuits. But batteries
have a limited life span and cannot be recharged. The solution is to convert the
alternating current lose hold line voltage to a DC voltage source.

BLOCK DIAGRAM FOR POWER SUPPLY:

59
Block diagram of AC to DC power Supply consists,
1. Transformer: Steps the household line voltage up or down as required.
2. Rectifier: Converts ac voltage into dc voltage.
3. Filter: Smooth the pulsating DC voltage to a varying DC voltage.
4. Regulator: Fix the output voltage to constant value.

BRIEF INTRODUCTION TO AN ELECTRICAL


TRANSFORMER:

A Transformer is an electrical device that takes electricity of one voltage


and changes it into another voltage. In AC circuits, AC voltage, current and
waveform can be transformed with the help of Transformers. Transformer plays
an important role in electronic equipment. AC and DC voltage in Power supply
equipment are almost achieved by transformer’s transformation and
commutation. Figure 1 shows the Transformer.

Basically, a Transformer changes electricity from high to low voltage or


low to high voltage using two properties of electricity. In an electric circuit, there
is magnetism around it. Second, whenever a magnetic field changes (by moving
or by changing strength) a voltage is made.
A Transformer takes in electricity at a higher voltage and lets it run through
lots of coils wound around an iron core. “. A single-phase Transformer can
operate to either increase or decrease the voltage applied to the primary winding.
Because the current is alternating, the magnetism in the core is also alternating.
Also around the core is an output wire with fewer coils.

60
The magnetism changing back and forth makes a current in the wire.
Having fewer coils means less voltage. When it is used to “decrease” the voltage
on the secondary winding with respect to the primary it is called a Step-down
Transformer. When a Transformer is used to “increase” the voltage on its
secondary winding with respect to the primary, it is called a Step-up
Transformer.
However, a third condition exists in which a transformer produces the same
voltage on its secondary as is applied to its primary winding. In other words, its
output is identical with respect to input. This type of Transformer is called an
“Impedance Transformer” and is mainly used for impedance matching or the
isolation of adjoining electrical circuits.

4.10 RECTIFIERS:
A rectifier circuit converts an AC voltage into a pulsating DC voltage. This
is accomplished by using one or more diodes because diodes conduct current in
only one direction.

4.11 FILTERS:
The 121% ripple in the output of the half-wave rectifier and 48% in the full-
wave rectifier is more than can be normally tolerated. In the full wave filtering,
wherein the frequency of the ripple is 100Hz for a 50Hz ac line voltage. This is
an advantage where either an inductor is used to prevent the passage of the ripple
current(due to its high inductive reactance to ac but quite low resistance to dc), or

61
a capacitor is used to ‘short’ the ripple to ground but leave the dc to appear at the
output. Various combinations of L and C are also used.

4.13 REGULATORS:
The simplest regulator is a large capacitor in parallel with the load. The
capacitor stores DC voltage while the load voltage increases to its peak value.
The capacitor converts the pulsating DC voltage of a rectifier into a smooth Dc
load voltage.
Two important parameters of a capacitor regulator are its working voltage
and its capacitance. The working voltage must be at least equal to no-load output
voltage of power supply. The capacitance determines the amount of ripple that
appears on the Dc output when current is drawn from the circuit. The amount of
ripple decreases with increase in capacitance.

4.14 CAPACITANCE REGULATOR CIRCUIT :

L-REGULATOR CIRCUIT :
This circuit consists of a series inductor and a capacitance in parallel with
load. The L-regulator is often used in high-power DC supplies.
MC 7800 and 7900 Regulators standard application circuit:
The Mc 7800 is a 3 terminal, positive, fixed voltage integrated circuit
regulator. These regulators employ internal current limiting, thermal shutdown
and safe area compensation. The Mc 7900 is a 3 terminal, negative, fixed voltage
integrated circuit regulator. Mc 7800 and Mc 7900 series requires no external
components.
The input voltage must be at least two volts higher than the output voltage
capacitor c1 is required if the regulator is located far from the power supply.
Capacitor c2 improve the transient response. Both series available in To-220
plastic package and T01-3 metal package.

PIN DETAILS:
IC 7805:

62
FEATURES:
 Suitable for TTL, DTL, HTL, C-MOS Power supply.
 Internal short-circuit current limiting.
 Internal Thermal Overload Protection.
 Maximum Output Current of 150mA.
 Packaged in TO-92.
ELECTRICAL CHARACTERISTICS:
Input voltage :5V~15V.
Power dissipation :600 mW.
Operating Junction Temperature :-30~150 °C.
Operating Temperature :-30~75 °C.

4.15 OTHER COMPONENTS:

4.15.1 CAPACITORS:

63
FEATURES:
 Enabled high ripple current by a reduction of impedance at high frequency
range.
 Load Life : 105°C 2000~5000hours.
 Operating Temperature Range :-40~+105°C
 Rated Voltage Range :6.3~100V.DC
 Capacitance Tolerance :±20%(20°C, 120Hz).

4.15.2 RESISTORS:

1st 2nd 3rd band 4th band Temp.


Color
band band (multiplier) (tolerance) Coefficient
Black 0 0 ×100
Brown 1 1 ×101 ±1% (F) 100 ppm
Red 2 2 ×102 ±2% (G) 50 ppm
Orange 3 3 ×103 15 ppm
Yellow 4 4 ×104 25 ppm
Green 5 5 ×105 ±0.5% (D)
Blue 6 6 ×106 ±0.25% (C)
Violet 7 7 ×107 ±0.1% (B)
Gray 8 8 ×108 ±0.05% (A)
White 9 9 ×109
Gold ×10−1 ±5% (J)
Silver ×10−2 ±10% (K)
None ±20% (M)
FEATURES:
64
 Temperature Range -55°C ~ +155°C
 ±5% tolerance
 High quality performance at economical prices
 Compatible with automatic insertion equipment
 Flame retardant type available
 Tin coated annealed copper wire

4.15.3 LIGHT EMITTIND DIODE (LED):

FEATURES:
 Choice of various viewing angles
 Available on tape and reel.
 Reliable and robust
 Consumes very power.

ELECTRICAL CHARACTERISTICS:
 Forward Current (IF) : 15 mA
 Operating Temperature (Topr) : -40 to +85 ℃
 Storage Temperature (Tstg) : -40 to +100 ℃
 Soldering Temperature( Tsol) : 260 ± 5 ℃
 Power Dissipation (Pd) : 45 mW
 Peak Forward Current (IF Peak) :50 mA
 Reverse Voltage (VR) :5 V
65
4.16 MOTOR DRIVER L298D:

The L298D is a dual H-bridge motor driver IC designed to control the


speed and direction of two DC motors or one stepper motor. It acts as a current
amplifier, taking low-current control signals from a microcontroller and
providing higher current outputs to drive motors. The H-bridge configuration
allows for bidirectional control by changing the polarity of the voltage applied to
the motor. This IC is widely used in robotics and automation due to its versatility
and ease of use.

PIN DETAILS:

66
TECHNICAL SPECIFICATIONS :

 Operating Voltage: 5V to 46V


 Output Current: Up to 2A per channel (3A peak for short durations)
 Number of Channels: 2 (can control two DC motors independently)
 Logic Voltage: 5V (TTL compatible)
 Power Dissipation: 25W (at Tcase = 75°C)
 Operating Temperature: -25°C to +130°C
 Built-in Protection: Includes internal flyback diodes to protect against
back EMF
 Enable Pins: Allows control of motor operation (on/off) without altering
logic inputs

APPLICATIONS:

 Robotics: Used to control the movement of robot wheels or arms.


 Home Automation: Drives motors in automated systems like curtains or
fans.
 Industrial Automation: Controls conveyor belts, pumps, and other
machinery.
 Educational Projects: Ideal for learning motor control in embedded
systems.
 Stepper Motor Control: Can drive bipolar stepper motors in addition to
DC motors.

LIMITATIONS:

 Current Limitation: Can only handle up to 2A per channel, which may


not be sufficient for high-power motors.
67
 Heat Generation: Prolonged operation at high currents can cause the IC to
overheat, requiring additional cooling mechanisms.
 Efficiency: Not as efficient as modern motor drivers, especially for high-
current applications.
 External Components: Requires external components like capacitors for
stable operation.
 Limited Features: Lacks advanced functionalities like current sensing or
feedback control, which are available in more sophisticated motor drivers.

4.17 DC PUMP :
A pump is a mechanical device used to move fluids (in this case, water)
from one place to another by increasing the fluid's pressure. In your water tap
system, the pump plays a central role by transferring water from the storage
tank to the tap when the system is activated through the foot lever mechanism.

68
CONSTRUCTION & DESIGN :
Material: Typically made from durable materials like stainless steel, plastic, or a
combination to withstand prolonged submersion and exposure to water.
Size: Compact and lightweight, making it easy to install and handle.
Impeller: Equipped with an impeller that helps in drawing water and pushing it
out through the outlet.

WORKING PRINCIPLE :
Submersion: The pump is designed to be submerged in the fluid it is meant to
pump.
Motor: Driven by a DC motor that operates on a 12V power supply.
Impeller Action: The motor drives the impeller, creating a centrifugal force that
draws water into the pump and then pushes it out through the discharge outlet.
69
Cooling: Water surrounding the pump also acts as a cooling agent for the motor,
preventing overheating.

FEATURES:
Low Voltage Operation: Operates on a 12V DC supply, making it energy
efficient and safe to use in various applications.
High Efficiency: Capable of delivering a consistent and powerful water flow.
Durability: Resistant to corrosion and wear, ensuring long-lasting performance.
Quiet Operation: Produces minimal noise during operation.

APPLICATIONS:
Aquariums: Used to circulate and filter water in fish tanks.
Fountains: Ideal for water features and garden fountains.
Irrigation: Suitable for small-scale irrigation systems in gardens and
greenhouses.
Water Transfer: Efficient for transferring water from one location to another,
such as draining water from basements or containers.
RVs and Boats: Commonly used in recreational vehicles and boats for pumping
water.

MAINTENANCE :
Regular Cleaning: Periodic cleaning of the impeller and inlet to prevent
clogging and ensure smooth operation.
Lubrication: Ensuring the motor and moving parts are properly lubricated to
reduce wear and tear.

70
Inspection: Regular inspection for any signs of damage or corrosion to prolong
the pump's lifespan.

ADVANTAGES :
Energy Efficient: Consumes low power while delivering high performance.
Compact and Portable: Easy to install and transport.
Versatile: Suitable for a wide range of applications.
Reliable: Offers consistent performance and is designed for long-term use.

71
CHAPTER 5
SOFTWARE DETAILS

5.1 ARDUINO IDE SOFTWARE:

The software that is used to program the microcontroller, is open-source-


software and can be downloaded for free on www.arduino.cc. With this “Arduino
software” you can write little programs witch the microcontroller should
perform. This programs are called “Sketch”.
In the end the sketches are transferred to the microcontroller by USB cable.
More on that later on the subject “programming”.

INSTALLATION :
Now one after another the Arduino software and the USB driver for the
board have to be installed.

INSTALLATION AND SETUP OF THE ARDUINO SOFTWARE:


Download the Arduino software on www.arduino.cc and install it on the
computer (The microcontroller NOT connected to the PC). After that you open
the software file and start the program named arduino.exe.

72
Two set ups on the program are important and should be considered.

a) The board that you want to connect, has to be selected on the arduino software.
The “Funduino Uno” is here known as “Arduino / Genuino Uno”.

b) You have to choose the right “Serial-Port”, to let the Computer know to which
port the board has been connected. That is only possible if the USB driver has
been installed correctly.
It can be checked this way:
At the moment the Arduino isn't connected to the PC. If you now choose “Port”,
under the field “Tool”, you will already see one or more ports here (COM1/
COM2/ COM3…).
The quantity of the shown ports doesn't depend on the quantity of the USB ports
on the computer. When the board gets connected to the computer, YOU WILL
FIND ONE MOREPORT.

INSTALLATION OF THE USB DRIVER :


How it should be:
1. You connect the board to the computer.
2. The Computer recognizes the board and suggests to install a driver
automatically.

73
ATTENTION: Wait a second! Most of the time the computer can't find the
driver automatically to install it. You might choose the driver by your own to
install it. It can be found in the Arduino file under “Drivers”.
CONTROL: At the control panel of the Computer you can find the “Device
manager”. If the board has been installed successfully, it should appear here.
When the installation has failed, there is either nothing special to find or you will
find an unknown USB device with a yellow exclamation mark.
In this case: Click on the unknown device and choose “update USB driver”.
Now you can start over with the manual installation.

5.2 PROGRAMMING :
Now we can start properly. Without to much theoretical information we
start directly with programming. Learning by doing. On the left side you can find
the “sketches”, on the right the accompanying explanation for the commands in
grey. If you work through the tutorials with this system, you will soon understand
the code and be able to use it by yourself. Later on you can familiarize yourself
with other features. These tutorials are only meant as first steps to the Arduino
world. All possible program features and codes are referred onwww.arduino.cc
under „reference“.
First of all a short explanation for possible error reports that can appear while
working with the Arduino software. The two most common ones are:

1.) The board is not installed right or the wrong board is selected. After uploading
the sketch, there will appear an error report underneath the sketch. It looks like
the one in the picture on the right. The note “not in sync” shows up in the error
report.

74
2.) There is a mistake in the sketch.
For example, a word is misspelled or a bracket is missing. In the example on the
left the last semicolon in the sketch is missing. In this Case the error report often
starts with “excepted..”. This means that the program is still expecting something
that is missing.

5.3 BASIC STRUCTURE OF A SKETCH:


A sketch can be divided in three parts.
1.Name variable:
In the first part elements of the program are named. This part is not
absolutely necessary.
2. Setup (absolutely necessary for the program)
75
The setup will be performed only once. Here you are telling the program
for example what Pin (slot for cables) should be an input and what should be an
output on the boards.
Defined as Output: The pin should put out a voltage.
For example: With this pin a LED is meant to light up.
Defined as an Input: The board should read out a voltage.
For example: A switch is actuated.
The board recognized this, because it gets a voltage on the Input pin.
3. Loop (absolutely necessary for the program)
This loop part will be continuously repeated by the board. It assimilates the
sketch from beginning to end and starts again from the beginning and so on.
CHAPTER 6
ADVANTAGES AND APPLICATIONS

6.1 ADVANTAGES:
 Reliable
 Efficient
 Durable
 Automated
 Accurate

6.2 APPLICATIONS:
 Irrigation
 Manufacturing
 Automotive
 Refrigeration
 Heating

76
77
CHAPTER 7

CONCLUSION

The implementation of an IoT-based water level monitoring and supply


system stands as a transformative solution for the Tamil Nadu Water and
Drainage Sector (TWAD).

By leveraging advanced IoT technology, the proposed system addresses the


pressing issues of water scarcity, inefficient resource management, and wastage.

Real-time monitoring, automated control, and user-friendly interfaces


ensure optimal water distribution, enhancing the sustainability of water resources
and improving the overall well-being of the community.

The scalable and cost-effective nature of the system makes it a viable


option for widespread adoption.

Through this innovative approach, the project aims to contribute


significantly to sustainable water management practices, paving the way for a
more resilient and efficient future.

78
APPENDICES

PROGRAM CODE:
#include<LiquidCrystal.h>
LiquidCrystal lcd(8,9,4,5,6,7);
#include <SoftwareSerial.h>
SoftwareSerial ESP11 = SoftwareSerial(2,3); // RX, TX
#define ONE_WIRE_BUS A2 // DS18B20 Data pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int tempC=0;
#define DEBUG true
// WIFI SHIELD DECLARATION
String ssid = "\"wifi005\"";
String pass = "\"12345678\"";
String tcp = "\"TCP\"";
String remoteip = "\"iot-projects.eweb.org.in\"";
String portnum = "80";
int gs=0;
int lvl=0;
float distance=0;
float duration=0;
int TRIG_PIN=A0;
int ECHO_PIN=A1;
int v=0;
79
int v1=0;
int v2=0;
int p=0;
int level= 0;
void setup() {

Serial.begin(115200);
ESP11.begin(115200);
lcd.begin(16,2);
sensors.begin();
pinMode(10,OUTPUT);
digitalWrite(10,LOW);
pinMode(11,OUTPUT);
digitalWrite(11,LOW);
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
pinMode(12,OUTPUT);
digitalWrite(12,LOW);
pinMode(TRIG_PIN,OUTPUT);
digitalWrite(TRIG_PIN,LOW);
pinMode(ECHO_PIN,INPUT);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Loading!....");
sendData("AT+CWMODE=3\r\n",2000,DEBUG); // configure as access point
and Client
80
lcd.setCursor(0,1);
lcd.print(" 20% ");
sendData("AT+RST\r\n",2000,DEBUG); // reset module

lcd.setCursor(0,1);
lcd.print(" 40% ");
sendData("AT+CWLAP\r\n",3000,DEBUG); // List all available AP's*/
lcd.setCursor(0,1);
lcd.print(" 60% ");
sendData("AT+GMR\r\n",2000,DEBUG); // View version Info
lcd.setCursor(0,1);
lcd.print(" 90% ");
sent();
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Water");
lcd.setCursor(0,1);
lcd.print("Distribution");

void loop() {
sensors.requestTemperatures();
tempC = sensors.getTempCByIndex(0);
level = measureWaterLevel();
81
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Water Lvl:");
lcd.setCursor(11,0);
lcd.print(level);
lcd.setCursor(0, 1);
lcd.print("Temp: ");
lcd.print(tempC);
sent();
if (level>=90)
{p=0; digitalWrite(10,LOW);}

else if((level>=20)&&(level<=95))
{
digitalWrite(A5,HIGH);
digitalWrite(11,HIGH);
v=1;sent();
delay(5000);
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
v=0;v1=1;
delay(5000);
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
v=0;v1=0;v2=1;

82
delay(5000);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
digitalWrite(A5,LOW);
v=0;v1=0;v2=0;
delay(10000);
}
else if(level<=19)
{
digitalWrite(12,LOW); digitalWrite(11,LOW);
digitalWrite(13,LOW);digitalWrite(A5,LOW);
digitalWrite(10,HIGH);
p=1;v=0;v1=0;v2=0;
}
sent();
delay(1000);
}
int measureWaterLevel() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
long duration = pulseIn(ECHO_PIN, HIGH);
int distance = duration * 0.034 / 2;

83
int level = map(distance, 0, 30, 100, 0); // Adjust "30" for tank depth
return constrain(level, 0, 100);
}
void sent()
{

sendData("AT+CIPSTART="+ tcp +"," + remoteip + "," + portnum + "\r\


n",1000,DEBUG); // Start connecting to localhost <link id>,<type>,<remote
IP>,<Port Number>
String getStr = "GET
https://iot-projects.eweb.org.in/GCE/water_dis/update.php?lvl="; // Getting info
from my online database through my online website
getStr+=level;
getStr+="&pump=";
getStr+=p;
getStr+="&v=";
getStr+=v;
getStr+="&v1=";
getStr+=v1;
getStr+="&v2=";
getStr+=v2;
getStr+="&temp=";
getStr+=tempC;
getStr += "\r\n\r\n";
String cmd;
String closeCommand = "AT+CIPCLOSE";
closeCommand+="\r\n";
84
}

85
REFERENCE

[1] M. S. Islam, M. S. Hossain, & N. S. Islam, "A Smart IoT Based


Water Quality Monitoring System Using MQTT Protocol," 2019
International Conference on Robotics, Electrical and Signal Processing
Techniques (ICREST), Dhaka, Bangladesh, 2019, pp. 378-382.
[2] R. Al-Ali, I. Zualkernan, & F. Aloul, "A Mobile GPRS-Sensors
Array for Air Pollution Monitoring," IEEE Sensors Journal, vol. 10, no. 10,
pp. 1666-1671, Oct. 2010.
[3] S. K. S. Tyagi, A. Agarwal, & P. Maheshwari, "A Conceptual
Framework for IoT-Based Water Management in Smart Cities," 2016
International Conference on Internet of Things and Applications (IOTA),
Pune, India, 2016, pp. 374-379..
[4] M. A. Mazidi, S. N. Simic, & S. A. Gadsden, "A Survey of Smart
Water Quality Monitoring and Management," IEEE Access, vol. 8, pp.
110904-110923, 2020.
[5] M. Abdellatif, M. M. Dessouky, & H. M. El-Bakry, "An Efficient
IoT-Based Smart Water Quality Monitoring System," Multimedia Tools and
Applications, vol. 82, no. 5, pp. 1-21, 2023.
[6] J. Aira, T. Olivares, & F. M. Delicado, "SpectroGLY: A Low-Cost
IoT-Based Ecosystem for the Detection of Glyphosate Residues in Waters,"
IEEE Transactions on Instrumentation and Measurement, Jan. 2024.
[7] S. Kartakis, S. Yang, & J. A. McCann, "Reliability or
Sustainability: Optimal Data Stream Estimation and Scheduling in Smart

86
Water Networks," ACM Transactions on Sensor Networks (TOSN), Mar.
2017.
[8] G. Hajgató, G. Paál, & B. Gyires-Tóth, "Deep Reinforcement
Learning for Real-Time Optimization of Pumps in Water Distribution
Systems," Journal of Water Resources Planning and Management, Oct.
2020.
[9] F. R. Ishengoma, "A Novel Design of IEEE 802.15.4 and Solar
Based Autonomous Water Quality Monitoring Prototype using ECHERP,"
International journal of Computer Science & Network Solutions, Oct. 2014.
[10] S. Valai Ganesh, V. Suresh, S. G. Barnabas, & S.
Rajakarunakaran, "Innovative Solid Waste Management Strategies for
Smart Cities in Tamil Nadu: Challenges, Technological Solutions, and
Sustainable Prospects," Discover Applied Sciences, vol. 6, no. 660, Dec.
2024.

87

You might also like