0% found this document useful (0 votes)
5 views

Project Document

The document is a capstone project report by A. Sandeep Kumar Reddy on 'WSN for Water Parameters Monitoring Using Sensors,' submitted for a Master of Technology degree in Electronics and Communication Engineering. It details the development of a real-time water quality monitoring system using IoT devices and various sensors to address water contamination issues in India. The project aims to provide efficient monitoring and alert systems for water quality assessment and is guided by Dr. P. Janardhan Sai Kumar.
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)
5 views

Project Document

The document is a capstone project report by A. Sandeep Kumar Reddy on 'WSN for Water Parameters Monitoring Using Sensors,' submitted for a Master of Technology degree in Electronics and Communication Engineering. It details the development of a real-time water quality monitoring system using IoT devices and various sensors to address water contamination issues in India. The project aims to provide efficient monitoring and alert systems for water quality assessment and is guided by Dr. P. Janardhan Sai Kumar.
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
You are on page 1/ 115

AUDISANKARA COLLEGE OF ENGINEERING AND TECHNOLOGY

(AUTONOMOUS)
A Capstone Project Report on

WSN FOR WATER PARAMETERS MONITORING USING SENSORS

Submitted in a partial fulfillment for the award of the degree

Master of Technology

IN

ELECTRONICS AND COMMUNICATION ENGINEERING


Submitted by
A. SANDEEP KUMAR REDDY - 23G21D5501

Under the esteemed Guidance of


Dr. P. JANARDHAN SAI KUMAR, M.Tech, Ph.D.,
Professor, Dept. of ECE

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

AUDISANKARA COLLEGE OF ENGINEERING AND TECHNOLOGY


Accredited by NAAC with ‘A+’ Grade | Accredited by NBA Approved by AICTE | Affiliated to JNTUA
NH5 Bypass Road, Gudur – 524101, Tirupati (DT.), Andhra Pradesh
www.audisankara.ac.in
2025
AUDISANKARA COLLEGE OF ENGINEERING AND TECHNOLOGY
(AUTONOMOUS)
Accredited by NAAC with ‘A+’ Grade | Accredited by NBA Approved by AICTE | Affiliated to JNTUA
NH5 Bypass Road, Gudur – 524101, Tirupati (DT.), Andhra Pradesh

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CERTIFICATE

This is to certify that the Full Semester Project report entitled “WSN FOR WATER
PARAMETERS MONITORING USING SENSORS” is the bonafide work done by the
student A. SANDEEP KUMAR REDDY (23G21D5501), in partial fulfillment of the
requirements for the award of the degree of Master of Technology in Embedded system
in Electronics and Communication Engineering, from Jawaharlal Nehru Technological
University Anantapur, Anantapuramu, during the year 2024-2025.
ASCET, GUDUR - TIRUPATI(DT).

Project Guide
Dr. P. Janardhan Sai Kumar, Head of the Department
M.Tech, Ph.D., Prof. J. Amarendra, M.Tech, (Ph.D.,)
Professor, Associate Professor,
Department of ECE, Department of ECE,
ASCET, GUDUR - TIRUPATI(DT).

Submitted for the viva-voce Examination held on:

Internal Examiner External Examiner


AUDISANKARA COLLEGE OF ENGINEERING AND TECHNOLOGY
(AUTONOMOUS)
Accredited by NAAC with ‘A+’ Grade | Accredited by NBA Approved by AICTE | Affiliated to JNTUA
NH5 Bypass Road, Gudur – 524101, Tirupati (DT.), Andhra Pradesh

DECLARATION

I, A. SANDEEP KUMAR REDDY, hereby declare that the Project Work entitled –
WSN FOR WATER PARAMETERS MONITORING USING SENSORS done by us under
the esteemed Guidance of Dr. P. JANARDHAN SAI KUMAR, M. Tech, Ph.D., Professor,
Dept. Of ECE. The Full Semester Project report is submitted in partial fulfillment of the requirements
for the award of the master’s degree in Electronics and Communication Engineering.

Date:

Place:

A. SANDEEP KUMAR REDDY


23G21D5501
ACKNOWLEDGEMENT

We express our deepest gratitude to Dr. VANKI PENCHALAIAH, M.A., M.L., Ph.D.,,
Chairman of AUDISANKARA COLLEGE OF ENGINEERING AND TECHNOLOGY,
for providing us with an excellent academic environment and unwavering support throughout
our Project.

We extend our heartfelt thanks to Smt. VANKI ANUSHA, Vice Chairperson, for her
encouragement and continuous motivation, which have been instrumental in our academic
journey.

We sincerely appreciate the guidance and support of Dr. J. RAJA MURUGADOSS,Ph.D.,


Director(Engg.,& Principal), whose leadership and vision have inspired us to strive for
excellence.

Our sincere gratitude goes to Prof. J. AMARENDRA, Associate Professor - ECE, Head of
the Department, ECE, for valuable insights, motivation, and support, which greatly
contributed to the successful completion of our Project.

We are thankful to Dr. A. IMMANUEL, Institute Project Coordinator, for his expert guidance
and coordination, which played a key role in shaping our Project.
We also extend our appreciation to Dr. P. JANARDHAN SAI KUMAR, M.Tech, Ph.D.,
Department Project Guide, for providing valuable feedback and ensuring the smooth progress
of our Project.

We express our gratitude to our department faculty for their constant encouragement, technical
guidance, and mentorship throughout this journey.

Our special thanks to the non-teaching faculty for their assistance and support in various
aspects of our Project work.

We would like to extend our heartfelt appreciation to our parents and friends, whose
encouragement, patience, and moral support have been our driving force in completing this
capstone Project successfully.

Finally, we acknowledge the collaborative efforts of our team members, whose dedication and
hard work made this Project possible.

A. SANDEEP KUMAR REDDY


23G2A05501
ABSTRACT
The main objective of this Project is to determine the quality of water continuously monitoring
using IoT devices like Node MCU. This system makes use of a Water quality monitoring sensor,
cloud and Web UI, IOT Node MCU ESP8266, Temperature sensor, PH sensor, turbidity and
TDS sensors, Arduino, Fast alerts and Buzzer. In India, water contamination is a serious
environmental issue. Untreated sewage is the main cause of water contamination in India. Most
Indian rivers, lakes, and surface waters are polluted by uncontrolled small-scale industries. In
conventional systems, the monitoring procedure include manually gathering sample water from
various places, followed by testing and analysis in a lab. This method is inefficient because it is
laborious, takes a longtime, and doesn't yield results right away. Instead, create a low-cost
system for real-time water monitoring using wireless sensors network (WSN). Node MCU has a
connected built-in Wi- Fi module that enables internet access and sends sensor data
measurements to the systems. To evaluate the quality of water from aquatic bodies, a number of
sensors are employed to monitor a variety of factors like Ph value, TDS, Turbidity, temperature
and water level to determine if the water is appropriate or not, the results are saved in the cloud.
A warning message is sent to the master kit from WSN for monitoring and also to the PWD
department if dirty water is found.
CONTENTS
Abstract i
Contents ii
List of Figures iii
List of Tables iv
CHAPTER 1 INTRODUCTION 1-2
CHAPTER 2 LITERATURE REVIEW 3-4
CHAPTER 3 EXISTING SYSTEM 5
CHAPTER 4 PROPOSED SYSTEM 6-7
4.1 BLOCK DIAGRAM 6
4.2 REMOTE STATION 6
4.3 COMMUNICATION USING IOT 7
4.4 MONITORING STATION 7
CHAPTER 5 HARDWARE DESCRIPTION 8-37
5.1 NODEMCU (ESP-8266 12E) Wi-Fi Module 8
5.1.1 Family of Breakout Boards (ESP-NN) 9
5.1.2 Features 10
5.1.3 Applications 10
5.2 TEMPERATURE AND HUMIDITY MODULE DHT11 11
5.2.1 Technical Specification 12
5.2.2 Dimensions 13
5.2.3 Applications 13
5.2.4 Working and Storage conditions 13
5.2.5 Effect of exposure to chemical substances 14
5.2.6 Temperature Effect 14
5.2.7 Recovery Process 14
5.2.8 Soldering Information 14
5.3 ULTRASONIC SENSOR 15
5.3.1 Features of Ultrasonic Sensor 17
5.3.2 Three Applications involving Ultrasonic Detection 17
5.3.3 Ultrasonic Distance Measurement 17
5.3.4 Ultrasonic Sensor construction and work 18
5.3.5 Technical specifications of Ultrasonic sensor 19
5.3.6 Ultrasonic sensor Applications 19
5.3.7 Ultrasonic transducer for water level detection 20
5.3.8 Block Diagram for contactless liquid level controller 20
5.3.9 Features 21
5.3.10 Specifications 21
5.4 DS18B20 TEMPERATURE SENSOR 22
5.4.1 Pin Assignment 23
5.4.2 DS18B20 Block Diagram 24
5.4.3 Features of DS18B20 25
5.4.4 Applications 26
5.5 I2C MODULE (INTER INTEGRATED CIRCUIT) 26
5.5.1 Two wire communication 26
5.6 LCD (LIQUID CRYSTAL DISPLAY) 27
5.6.1 LCD Pin Description 29
5.6.2 Advantages of an LCD 30
5.6.3 Disadvantages of an LCD 30
5.6.4 Applications of LCD 31
5.7 RF TRANSCEIVERS 31
5.7.1 Block Diagram of RF Transceivers 32
5.7.2 RF Transmitter 33
5.7.3 RF Receiver 33
5.7.4 Pin Description 34
5.7.4.1 RF Transmitter 34
5.7.4.2 RF Receiver 35
5.7.5 Applications of RF Transceiver 35
5.8 BUZZER 36
5.8.1 Electromechanical 36
5.8.2 Piezoelectric 36
5.8.3 Mechanical 37
5.8.4 Applications 37
CHAPTER 6 SOFTWARE DESCRIPTION 38-51
6.1 ARDUINO IDE 38
6.1.1 Hardware Specification 38
6.1.2 Board types 39
6.1.2.1 Arduino boards based on ATMEGA328 40
6.1.3 Arduino Board Description 42
6.2 ARDUINO INSTALLATION 45
6.2.1 Step 1 Arduino Board 45
6.2.2 Step2 Download Arduino IDE Software 46
6.2.3 Step 3 power up the board 46
6.2.4 Step 4 Launch Arduino IDE 47
6.2.5 Step 5 Open your first Project 47
6.2.6 Step 6 Select your Arduino board 49
6.2.7 Step 7 Select your serial port 50
6.2.8 Step 8 Upload the Project to your board 51
CHAPTER 7 BLYNK 52-54
7.1 BLYNK 52
7.2 FEATURES 54
7.3 CHARACTERISTICS OF BLYNK 54
CHAPTER 8 SOURCE CODE 55-61
8.1 TRANSMITTING SECTION CODE 55
8.2 RECEIVING SECTION CODE 61
CHAPTER 9 RESULTS AND DISCUSSION 62-67
9.1 Overall view of the Project 62
9.2 Remote Station or Transmitting Section 63
9.3 Monitoring Station or Receiving Section 63
9.4 Water Parameters 64
9.5 16*2 LCD Display 64
9.6 Water Level Increases 65
9.7 Water Level Increasing Alert Message 65
9.8 River Water has High Dust 66
9.9 High Turbidity Alert Message 66
9.10 Water and Atmospheric Temperature 67
9.11 pH value of Water 67
CHAPTER 10 CONCLUSION AND FUTURE SCOPE 68-69
10.1 CONCLUSION 68
10.2 FUTURE SCOPE 69
REFERENCES 70-71
LIST OF FIGURES

Figure 4.1 Block Diagram 6


Figure 5.1 NodeMCU (ESP8266-12E) 8
Figure 5.2 DHT11 Temperature and Humidity Sensor 12
Figure 5.3 DHT11 Dimensions 13
Figure 5.4 Transducer 15
Figure 5.5 Frequency Range of the Sound 16
Figure 5.6 Ultrasound reaches Object 17
Figure 5.7 Ultrasonic Distance Sensor 18
Figure 5.8 Ultrasonic Sensor Construction 18
Figure 5.9 Piezoelectric Crystals 19
Figure 5.10 Ultrasonic Detection 20
Figure 5.11 Contactless liquid level controller 20
Figure 5.12 Ultrasonic Obstacle Sensor 21
Figure 5.13 DS18B20 Temperature Sensor 22
Figure 5.14 DS18B20 Pin Assignment 23
Figure 5.15 DS18B20 Block Diagram 24
Figure 5.16 Two wires Communication 26
Figure 5.17 LCD 27
Figure 5.18 16*2 LCD 28
Figure 5.19 16*2 LCD Display Module 29
Figure 5.20 RF Transceiver 31
Figure 5.21 RF Transceiver Module 32
Figure 5.22 RF Transceiver Block Diagram 33
Figure 5.23 RF Transmitter and Receiver 34
Figure 5.24 Buzzer 36
Figure 6.1 Arduino Board 42
Figure 6.2 USB Cable 45
Figure 6.3 Download Arduino IDE Software 46
Figure 6.4 Launch Arduino IDE 47
Figure 6.5 Open First Project 48
Figure 6.6 Open Existing System 48
Figure 6.7 Select Arduino Board 49
Figure 6.8 Select Serial Port 50
Figure 6.9 Upload Program to the Board 51
Figure 7.1 Blynk App Overview 53
Figure 7.2 Working of Blynk App 54
Figure 9.1 Overall view of the Project 63
Figure 9.2 Remote Station or Transmitting Section 64
Figure 9.3 Monitoring Station or Receiving Section 64
Figure 9.4 Water parameters 65
Figure 9.5 16*2 LCD Display 65
Figure 9.6 Water Level Increases 66
Figure 9.7 River Water has High Dust 67
Figure 9.10 pH value of Water 67
LIST OF TABLES

Table 5.1 Technical Specification 1


2
Table 5.2 DS18B20 Temperature Sensor Pin Description 2
3
Table 5.3 LCD Pin Description 3
0
Table 5.4 RF Transmitter 3
4
Table 5.5 RF Receiver 3
5
Table 6.1 Arduino boards based on ATMEGA328 4
microcontroller 1
CHAPTER 1
INTRODUCTION
In recent years, there have been a tremendous number of flood instances due to the altered
rainfall pattern. Flood catastrophes cause harm to the economy and to people's lives. Floods
affect millions of people each year. To reduce flood casualties, the government was
compelled by this to develop a flood forecasting method. The installation of alert systems
near any significant body of water or water region gives vital wealth of knowledge that can
both save lives and protect property. Some places are more prone to flooding than other
places. Of course, the most effective flood warning systems cost a lot of money, require a
lot of upkeep and require highly skilled personnel to operate them.
Every human being in the world needs access to water as one of their basic needs. A human
life can be severely impacted by the poor management of a water storage system. The
proposed model was created as a result of technological advancement to control water
storage facilities like dams and lakes using sensor signals that are located remotely. Sensors
placed in storage regions estimate the lakes' and dam's durability and capacity for storage.
This increases the accuracy of flood predictions in river routes and enables the oncoming
dam to release some water outside to make room for arriving waters. For the purpose of
analysing water flow management, the data produced dams that are connected to one
another are stored in the cloud. To prevent cable connections, using an IoT platform,
sensors in a lake or dam are connected. As a result, this model prevents unexpected floods
occur when it rains, which assures the lake's and dam's physical strength through ongoing
monitoring. In the case of a flood, rivers that are close to populous or strategically
significant places can harm property and put people at danger of injury. Radar and
ultrasonic sensors used in conventional river flood monitoring systems might not be
entirely reliable as well as usually need on site human calibration. One of the natural
disasters that cannot be prevented is flooding. It happened too quickly and had a huge
impact on both people and property. Flooding is a natural occurrence that sparks interest
around the world. Both lives are lost and the ecosystem is severely damaged as a result.
Flooding is caused by heavy rains, faulty structures and a variety of human factors.
Precipitation levels and rates, topography, geology, land use and pre- existing moisture

1
conditions all play a role in floods. Prior to this, the majority of the

2
systems that have been developed only concentrated on a few areas. In addition, because
they lack information and data on the weather, the bulk of the population is unable to track
and is unaware of when a flood will occur. All the issues with the current system will be
resolved by using the IoT monitoring system. This is appropriate for urban and rural
locations. Additionally, if a member of the public has internet access, they can keep track of
events and foresee the possibility of a web server flood. Its design is affordable and upkeep
is simple. By doing so, the web server's water level will be updated and the system will
inform the public to evacuate so that quick, required action may be done. New low power
wide area network (LPWAN) methods are being used as part of the plans of Internet of
Things (IoT) systems, which has been a set of circumstances that is constantly evolving, for
monitoring systems and to prevent future risks with smaller and less unaffordable
structures. To provide the possibility to interface various types of sensors without
significantly altering the proposed node architecture's hardware, the entire system is created
from a modular perspective. The data is stored in a sensor and microcontroller equipped
device that is linked to LoRa wireless module for data transmission, after then it is analysed
as well as saved via a web application framework where the flood alert feature is
implemented. However, the system cannot solve flooding issues on its own. Public
institutions must operate in tandem with civil society, volunteers, organized volunteer work
organizations and community organisations. In order to decrease the danger of fatalities,
property damage and environmental degradation, this paper can provide information to the
relevant emergency services along with authorities.

One of the most frequent and dangerous natural disasters is flooding. A better response to
flood threats is required given the growing number of flood related deaths as well as
financial losses seen every year around the world. It's interesting that in the past ten years,
there have been numerous academic endeavors looking at how camera footage and wireless
sensor data from IoT networks could improve flood management. The presented work
sheds light on the potential for creating an alarm system to reduce the risk of flooding. It is
able to estimate how quickly the flood will occur by sending the user an alarm message
along with the timing and pace of the water rise. Additionally, it has undergone testing in a
controlled setting to gauge performance.

3
CHAPTER 2
LITERATURE SURVEY
As in [1], a novel architecture for the transceiver is proposed in order to increase the service
range of IEEE 802.11ah, which is necessary for the long-range IoT communication of
emergency messages in emergency situations. Experimental results show that the presented
architecture is suitable for the long-range IoT communication of emergency alert messages.

As in [2], a wireless sensor network system could remotely monitor the real time data of
water condition in the identified areas. To monitor the water conditions such as water level,
flow and precipitation level, a wireless sensor network system is developed.

As in [3], GRAB, designed for robust data delivery in face of unreliable nodes and failable
wireless link. GRAB forwards data along a band of interleaved mesh.

As in [4], in Wireless Sensor Networks (WSN) the user requirements are often desired to be
evolvable, whether driven by changes of the monitored parameters or WSN properties of
configuration, structure, communication capacities, node density and energy among many
others.

As in [5], the Functionality is supported by the reflective and component-based Grid Kit
middleware, which provides support for both WSN and Grid application domains.

As in [6], a distributed system is proposed using water level monitoring sensors named
Shonabondhu. The sensing nodes are distributed all across the country and the servers that
collect data from sensors are spread around various regions. The servers use a function of
rainfall and current water level that indicate a particular gradient to that sensor.

As in [7], a Proposed cooperative monitoring algorithm based on the node location


information. Basically, IoT is a part of WSN but sometimes there are problems with
connectivity end-to-end devices because there are varieties of devices used in the network
architecture. A consistent design system is needed to implement, where the main
application requirements for low cost, fast deployment of large numbers of sensors, and
reliable and long unattended service are considered at all levels.
4
As in [8], the system must be able to handle the variety of data types, providing
interoperability among all the components. This is because the various environments of the
IoT device give a different perspective in terms of information processing, communication
capabilities, and data transferring that comes from the devices. The communication device
is important in the system example using the ZigBee network protocol. The protocol had
free communication frequency and used low power consumption for communication that
saves the hardware cost instead of using GPRS and reduces the cost of the whole system.
The advantages of the ZigBee network is it can achieve mutual communication sensor
nodes. It helps the system discover sensor nodes within the range of monitoring stations in
a short time, reduce the scanning time to collect data, and improve the reliability of the
information collection and transmission.

As in [9], the various remote sensing technologies used for the detection, monitoring, and
assessment of oil spills, emphasizing the crucial role these technologies play in effectively
managing oil spill incidents.

As in [10], provide a thorough exploration of embedded system design, detailing the


modelling techniques, synthesis tools, and verification methods essential for developing
reliable and efficient embedded systems.

As in [11], underscores the importance of utilizing a multisensor approach to improve the


classification of oil spill thicknesses. By integrating data from optical, SAR, and thermal
infrared sensors.

5
CHAPTER 3
EXISTING SYSTEM
An IoT early flood detection and alert system using the Arduino is thus a proposed solution
to this problem. The system consists of various sensors which are temperature, humidity,
water level, flow and ultrasonic sensors and also includes an Arduino controller, a GSM
Module, an LCD, an IoT remote server-based platform and an android application with
constructed user-friendly GUI relaying all the vital information involved in the picture in a
visual format. This model set up the GSM board near the dam and DHT sensor and
ultrasonic sensor, float sensors are connected to it. DHT sensor gives the Humidity and
Temperature in the air and Ultrasonic sensor gives the water level. Based on this and some
other parameters we may decide if the flood is going to occur or not. We connect them to
the cloud from where we connect this to the mobile application and we can see the output
in our application too.

Pollutants detected in water are increasingly leveraging the Internet of Things (IoT) to
enhance accuracy and efficiency. IoT-enabled sensors are deployed in various water
sources, continuously monitoring water quality in real-time. These sensors detect a range of
pollutants, such as heavy metals, chemicals, and microbial contaminants, by measuring
parameters like pH, turbidity, and conductivity. Data collected by these sensors is
transmitted wirelessly to cloud-based platforms, where it is analysed using advanced
algorithms.

This real-time data allows for immediate detection of pollution events, enabling swift
responses to contamination. Additionally, IoT systems facilitate remote monitoring of water
bodies, reducing the need for manual sampling and laboratory analysis. Smart sensors can
be integrated with automated treatment systems, which adjust processes based on detected
pollution levels, ensuring optimal water quality. IoT networks also provide valuable data
for long-term environmental monitoring and research, helping to identify pollution sources
and trends over time. water quality monitoring becomes more efficient, accurate, and
proactive, significantly improving the management of water resources and public health
protection.

6
CHAPTER 4

PROPOSED SYSTEM

4.1 BLOCK DIAGRAM

Figure 4.1 Block Diagram


The main objective of this Project is to determine the quality of water continuously
monitoring using IoT devices like Node MCU. This system makes use of a Water quality
monitoring sensor, IOT Node MCU ESP8266, Temperature sensor, PH sensor, turbidity
and TDS sensors, Arduino, Fast alerts and Buzzer.

4.2 REMOTE STATION

⮚ Solar Panels and Batteries: These provide power to the remote station, ensuring it

can operate independently and sustainably.

⮚ DHT-11: The DHT11 is a Digital Temperature and Humidity sensor. Measures

ambient temperature and humidity. The sensor outputs a digital signal, making it
easy to interface with microcontrollers like the NodeMCU ESP8266.
7
⮚ Ultrasonic Sensor: Used for measuring the water level or detecting the presence of

an object.

⮚ pH Sensor: Determines the acidity or alkalinity of the water. pH sensor is useful in

both aquatic and terrestrial ecosystems.

⮚ Turbidity Sensor: Measures the clarity of the water by detecting suspended

particles. High turbidity levels indicate pollutant, sediment runoff, or other


environmental disturbances.

⮚ DS18B20 Temperature Sensor: Specifically measures water temperature. It can

measure temperatures in the range of -55°C to 125°C.

⮚ NODEMCU (ESP-8266): This microcontroller unit processes the data collected

from the sensors and sends the data to another NodeMCU present in the monitoring
station.

8
4.3 COMMUNICATION USING IOT

The data processed by the NODEMCU at the remote station is sent to the monitoring
station via IoT communication protocols. NodeMCU devices are used to enable real-time
data transfer for water quality monitoring via IoT. NodeMCU, equipped with sensors,
collects data and publishes it to an MQTT broker over a Wi-Fi network. Another
NodeMCU subscribes to the broker, receiving and processing the sensor data. This setup
ensures continuous, wireless monitoring of water pollutants, enhancing the efficiency and
accuracy of environmental management.

4.4 MONITORING STATION

⮚ NODEMCU (ESP-8266): Similar to the remote station, it receives and processes

the data. The NodeMCU in monitoring station processes the received date and
transfer the data to 16*2 LCD displays.

⮚ I2C Module: Interfaces with other components for data display and alerts. I2C is a

serial communication protocol that allows multiple devices to communicate over a


common bus.

⮚ 16*2 LCD: A 16*2 LCD modules consist of 16 characters per line and 2 lines.

Displays the real-time data received from the remote station.

⮚ Buzzer: Acts as an alarm system, which can be triggered if the pollutant levels

exceed predefined safe thresholds.

9
CHAPTER 5
HARDWARE DESCRIPTION

5.1 NODEMCU (ESP-8266 12E) Wi-Fi Module


ESP-8266 12E Wi-Fi module is developed by Ai-thinker Team. core processor ESP8266 in
smaller sizes of the module encapsulates Tensilica L106 integrates industry leading ultra-
low power 32-bit MCU micro, with the 16-bit short mode, Clock speed support 80 MHz,
160 MHz, supports the RTOS, integrated Wi-Fi MAC/BB/RF/PA/LNA, on-board antenna.
The module supports standard IEEE802.11 b/g/n agreement, complete TCP/IP protocol
stack. Users can use the add modules to an existing device networking, or building a
separate network controller. ESP8266 is high integration wireless SOCs, designed for space
and power constrained mobile platform designers. It provides unsurpassed ability to embed
Wi-Fi capabilities within other systems, or to function as a standalone application, with the
lowest cost, and minimal space requirement.

ESP8266EX offers a complete and self-contained Wi-Fi networking solution; it can be used
to host the application or to offload Wi-Fi networking functions from another application
processor. When ESP8266EX hosts the application, it boots up directly from an external
flash. ESP8266EX is among the most integrated Wi-Fi chip in the industry; it integrates the
antenna switches, RF balun, power amplifier, low noise receive amplifier, filters, power
management modules, it requires minimal external circuitry, and the entire solution,
including front-end module, is designed to occupy minimal PCB area.

10
Figure 5.1: NodeMCU (ESP8266-12E)

11
The ESP8266 has seen a wide adoption as a cost-effective solution for IOT and Wi-Fi-
capable devices. The ESP8266 was developed by Shangai-based Espressif systems, as a
Serial (UART) to Wi-Fi SoC (System on a Chip) based around a Tensilica Xtensa
LX3DPU. This tiny IC includes an RF front end, RAM, and (usually) an onboard TCP/IP
stack that allows it to connect to a nearby Access Point, to act as an Access Point itself, or
both.

5.1.1 Family of Breakout Boards (ESP-NN)

Quickly after launch, a variety of breakout boards for the ESP8266 started becoming
available. The most popular ones have been the ESP-NN series, which typically integrate
the SOC along with Flash RAM, a crystal, and even an onboard antenna. The most salient
distinction between different ESP-NN models are the pins that are broken out from the
ESP8266

As the ESP8266 was developed as a Serial to Wi-Fi adapter, its firmware implemented an
interpreter for AT commands. Thus initial usage of the IC was limited to using either a
USB to Serial adapter, or a separate microcontroller (e.g., ATmega328) to issue AT
commands over the ESP8266's Serial UART interface. For this reason, the ESP-01 board
quickly became popular amongst the ESP8266 community because of its 2×4, 0.1in-pitch
connector that can be easily wired to a USB to Serial adapter.

The connector gave access to the pins used for serial communication, namely RX and TX,
as well as 4 control pins, GPIO0, GPIO2, CH_PD and RST (reset), along with VCC and
GND.

However, other ESP-NN boards offer access to a wider variety of pins, although their
packaging is of a custom Surface-Mount Device, with castellated pins as seen in the
documentation page linked above. From the different ESP-NN boards, we began to
experiment with the ESP-12E. The main reason is that this module was the one chosen by
the developers of the Node MCU Project for their hardware Dev Kit 1.0. Because the
ESP8266 provides a cost-effective solution to the rapidly growing market of internet-
connected Projects and devices (i.e., the so-called Internet of Things), it has become one of
the most popular development platforms over the past year and a half. In consequence,
12
A dedicated community has formed around the platform which has been focused on
improving its functionality.

For starters, different firmware options have been ported to run on the ESP8266, effectively
taking it from a simple Serial to Wi-Fi adapter into a fully functional microcontroller with
access to its GPIO and hardware-based functions like PWM, I2C, 1-Wire communication,
and ADC; all this, of course, in addition to maintaining its Wi- Fi capabilities.

5.1.2 Features

● 802.11 b/g/n

● Integrated low power 32-bit MCU

● •Integrated 10-bit ADC

● Integrated TCP/IP protocol stack

● Integrated TR switch, balun, LNA, power amplifier and matching network

● Integrated PLL, regulators, and power management units

● Supports antenna diversity

● Wi-Fi 2.4 GHz, support WPA/WPA2

● Support STA/AP/STA+AP operation modes

● Support Smart Link Function for both Android and IOS devices

● SDIO 2.0, (H) SPI, UART, I2C, I2S, IRDA, PWM, GPIO

● STBC, 1x1 MIMO, 2x1 MIMO

● A-MPDU & A-MSDU aggregation and 0.4s guard interval Shenzhen Anxinke
Technology

● Deep sleep power < 5uA

● Wake up and transmit packets in < 2ms

● Standby power consumption of < 1.0mW (DTIM3)

13
∙ +20dBm output power in 802.11b mode

● Operating temperature range -40C ~ 125C

5.1.3 Applications

● Smart power plugs

● Home automation

14
● Mesh network

● Industrial wireless control

● Baby monitors

● IP Cameras

● Sensor networks

● Wi-Fi location-aware devices

● HVAC control

● Wi-Fi position system beacons

● Smart lighting

● Security ID tags

5.2 TEMPERATURE AND HUMIDITY MODULE DHT11

DHT11 digital temperature and humidity sensor is a calibrated digital signal output of the
temperature and humidity combined sensor. It uses a dedicated digital module capture
technology and the temperature and humidity sensor technology to ensure products with
high reliability and excellent long-term stability. Sensor includes a resistive element and a
sense of wet NTC temperature measurement devices and with a high-performance 8-bit
microcontroller connected.

DHT11 output calibrated digital signal. It utilizes exclusive digital-signal- collecting-


technique and humidity sensing technology, assuring its reliability and stability. Its sensing
elements are connected with an 8-bit single-chip computer. Every sensor of this model is
temperature compensated and calibrated in an accurate calibration chamber and the
calibration-coefficient is saved in OTP memory. Small size & low consumption & long
transmission distance (20m) enable DHT11 to be suited in all kinds of harsh application
occasions. Single-row packaged with four pins, making the connection very convenient.
15
The DHT11 sensor measures ambient temperature and humidity. The sensor outputs a
digital signal, making it easy to interface with microcontrollers like the NodeMCU
ESP8266. It provides relative humidity values in percentage (ranging from 20% to 90%
RH) and temperature values in degrees Celsius (from 0°C to 50°C).

16
Figure 5.2: DHT11 Temperature and Humidity Sensor

5.2.1 Technical Specification


Table 5.1: Technical Specification

MODEL DHT11
Power supply 3-5.5V DC
Output signal digital signal via single-bus
Sensing element Polymer resistor

Measuring range humidity 20-90%RH; temperature 0-50


Celsius

Accuracy humidity +-4%RH (Max +-


5%RH); temperature +-2.0Celsius

Resolution or sensitivity humidity 1%RH; temperature 0.1Celsius

Repeatability humidity +-1%RH; temperature


+-1Celsius

Humidity hysteresis +-1%RH


Long-term Stability +-0.5%RH/year
Sensing period Average: 2s
Interchangeability fully interchangeable

Dimensions size 12*15.5*5.5mm

17
5.2.2 Dimensions: (unit mm)

Front view Back view Side view

Figure 5.3: DHT11 Dimensions

5.2.3 Applications

● HVAC

● Dehumidifiers

● Testing and Inspection Equipment

● Consumer Goods

● Data Loggers

● Weather Stations

● Home Appliances

● Humidity Regulator

● Medical and

● Other Relevant Humidity Measurement

5.2.4 Working and storage conditions

18
The proposed scope of work may result in up to 3% RH temporary drift of the signal.
Return to normal working conditions, the sensor calibration status will slowly recover. To
speed up the recovery process can be found in "recovery process." The use of the product
will accelerate the aging process for a long time under abnormal operating conditions.
Avoid placing components on a long-term condensation and dry conditions and the
following environments.

19
A. Smoke Acid or oxidizing gases such as sulfur dioxide, hydrochloric acid
Recommended
B. Storage Environment Temperature:10~40℃ Humidity:60% RH or less
5.2.5 Effects of exposure to chemical substances
Sensing a resistive humidity sensor will be disturbed chemical vapor layer, the diffusion
layer in the induction of chemicals may cause drift and measurement sensitivity. In a clean
environment, slowly release contaminants out. The recovery process described below to
accelerate the process. High concentrations of chemical pollution can cause damage to the
sensor sensing layer completely.

5.2.6 Temperature Effect

Relative humidity of the gas is largely dependent on temperature. Therefore, when


measuring the humidity it should be possible to ensure that the humidity sensor works at
the same temperature. If you share a printed circuit board with electronic components, heat
released in the sensor should be installed as far as possible away from the electronic
components, and installed at the bottom of the heat source, while maintaining a well-
ventilated enclosure. To reduce the thermal conductivity sensor and a copper plating layer
of the printed circuit board should be as minimal as other portions, and leave a gap between
them.

5.2.7 Recovery Process

Placed under extreme operating conditions or chemical vapor sensors, through the
following process, you can return it to the state calibration. 45 ℃ and humidity under 70%
RH conditions were maintained for more than 5 hours. The calibration coefficients are
stored as programs in the OTP memory, which is the sensor's internal signal detecting
process.

5.2.8 Soldering Information

Manual welding, at a temperature of 300 ℃ maximum contact time must be less than 10
seconds. The sensor communicates using a one wire protocol and provides data in a 40-bit
format. Its pinout includes VCC(Power supply), DATA(Digital output), NC(Not

20
Connected) and GND(Ground).

21
5.3 ULTRASONIC SENSOR

The ultrasonic sensor is a transducer which converts electrical energy into sound waves and
vice versa. These sound waves fall above the normal range of human hearing and hence it
is known as ultrasonic waves. These types of waves are above the frequency of about
18000 Hz.

An ultrasonic sensor transmits ultrasonic waves into the air and detects reflected waves
from an object. There are many applications for ultrasonic sensors, such as in intrusion
alarm systems, automatic door openers and backup sensors for automobiles. Accompanied
by the rapid development of information processing technology, new fields of application,
such as factory automation equipment and car electronics, are increasing and should
continue to do so.

Ultrasonic sensors are wonderful creatures. Blind from the eyes and yet a vision so precise
that could distinguish between a moth and a broken leaf even when flying at full speed. No
doubt the vision is sharper than ours and is much beyond human capabilities of seeing, but
is certainly not beyond our understanding. Ultrasonic ranging is the technique used by bats
and many other creatures of the animal kingdom for navigational purposes. In a bid to
imitate the ways of nature to obtain an edge over everything, we humans have not only
understood it but have successfully imitated some of these manifestations and harnessed
their potential to the greatest extent.

Figure 5.4: Transducer


22
Ultrasonic sensors are devices that use the electrical–mechanical energy transformation, the
mechanical energy being in the form of ultrasonic waves, to measure distance from the
sensor to the target object. Ultrasonic waves are longitudinal mechanical waves which
travel as a succession of compressions and rarefactions along the direction of wave
propagation through the medium. Any sound wave above the human auditory range of
20,000 Hz is called ultrasound. Depending on the type of application, the range of
frequencies has been broadly categorized as shown in the figure:

Figure 5.5: Frequency Range of the Sound

When ultrasonic waves are incident on an object, diffused reflection of the energy takes
place over a wide solid angle which might be as high as 180 degrees. Thus some fraction of
the incident energy is reflected back to the transducer in the form of echoes and is detected.
The distance to the object (L) can then be calculated through the speed of ultrasonic waves
(v) in the medium by the relation.

The frequency range of the human hearing sound is from 16Hz to 19KHz. The
conventional power ultrasound is from 20KHz to 100KHz and the extended range of the
sonochemistry is from 20KHz to 2MHz and the diagnostic ultrasound is from 5MHz to
10MHz.

Where ‘t’ is the time taken by the wave to reach back to the sensor and the angle between
the horizontal and the path taken as shown in the figure. If the object is in motion,
instruments based on Doppler shift are used.

23
Figure 5.6: Ultrasound reaches Object
5.3.1 Features of Ultrasonic Sensor

● Compact and light-weight

● High sensitivity

● High sound pressure

● High reliability

5.3.2 Three Applications involving Ultrasonic detection


The distance of obstacles or discontinuities in metals is related to velocity of sound waves
in a medium through which waves are passed and the time taken for echo reception. Hence
ultrasonic detection can be used for finding the distances between particles, for detecting
the discontinuities in metals and for indicating the liquid level.
5.3.3 Ultrasonic Distance Measurement
Ultrasonic sensors are used for distance measuring applications. These gadgets regularly
transmit a short burst of ultrasonic sound to a target, which reflects the sound back to the
sensor. The system then measures the time for the echo to return to the sensor and
computes the distance to the target using the speed of sound within the medium. Different
sorts of transducers are utilized within industrially accessible ultrasonic cleaning devices.
An ultrasonic transducer is affixed to a stainless-steel pan which is filled with a solvent and
a square wave is applied to it, conferring vibration energy on the liquid.

24
Figure 5.7: Ultrasonic Distance Sensor
The ultrasonic distance sensors measure distance using sonar; an ultrasonic (well above
human hearing) beat is transmitted from the unit and distance-to-target is determined by
measuring the time required for the echo return. Output from the ultrasonic sensor is a
variable-width beat that compares to the distance to the target.

5.3.4 Ultrasonic Sensor or distance sensor construction and working

Figure 5.8: Ultrasonic Sensor Construction


• There are two main parts in the sensor viz. transmitter and receiver.
• The transmitter part converts electrical energy into sound and transmits it.
• The receiver part receives the echo and turns this received sound waves into electrical
energy.
• This returned echo is measured and used for distance calculation by the ultrasonic
sensor. Basically, this sensor calculates the time interval between signal transmission
and reception of echo and determines the distance of the object from the sensor.

25
As this sensor is used for distance measurement it is known as distance sensor.

• Piezoelectric crystals are used in the ultrasonic sensor construction due to the fact that
these crystals oscillate at a higher range of frequencies.

Figure 5.9: Piezoelectric Crystals


The figure-2 depicts a pin diagram of an ultrasonic sensor or distance sensor. As shown there are
four pins viz. +5V (Vcc pin), GND, Trigger pin and Echo pin.

5.3.5 Technical specifications of Ultrasonic Sensor


Following are the typical specifications of an ultrasonic sensor.

• Nominal Frequency output: 40 KHz

• Coverage range: 0.2 to 6 meters

• Receiver sensitivity: -67 dB (minimum)

• Sound pressure level: 112 dB (minimum)

• Maximum voltage input: 20 V(rms)


5.3.6 Ultrasonic or distance sensor applications

● It is used in automatic car parking system

● It is used in WSN FOR WATER PARAMETERS MONITORING USING SENSORS


design

● It is used in Traffic management


26
● It can be used in Environmental monitoring

27
5.3.7 Ultrasonic transducer for water level detection

Figure 5.10: Ultrasonic Detection


5.3.7.1 Block diagram for contactless liquid level controller

Figure 5.11: Block Diagram of Contactless liquid level controller

28
In the above circuit diagram the contactless liquid level controller in this diagram ultrasonic
sensor module is interfaced with the microcontroller. Whenever level distance measured in
cm falls down below a set point the pump starts by sensing the signal coming out and
receiving level coming to the ultrasonic transducer which is fed to the microcontroller.
When the microcontroller receives the signal from the ultrasonic transducer it activates the
relay through a MOSFET that operates the pump ON or OFF.

Figure 5.12: Ultrasonic Obstacle Sensor

5.3.9 Features

● Power consumption of 20mA

● Pulse in/out communication

● Narrow acceptance angle

● Provides exact, non-contact separation estimations within 2cm to 3m

● The explosion point LED shows estimations in advancement

● 3-pin header makes it simple to connect utilizing a servo development link

5.3.10 Specifications

● Power supply: 5V DC

● Quiescent current: <15mA

● Effectual angle: <15°


29
● Ranging distance: 2cm – 350 cm

● Resolution: 0.3 cm

● Output cycle: 50ms

30
5.4 DS18B20 TEMPERATURE SENSOR
The DS18B20 Digital Thermometer provides 9 to 12-bit (configurable) temperature
readings which indicate the temperature of the device. Information is sent to/from the
DS18B20 over a 1-Wire interface, so that only one wire (and ground) needs to be
connected from a central microprocessor to a DS18B20. Power for reading, writing, and
performing temperature conversions can be derived from the data line itself with no need
for an external power source. Because each DS18B20 contains a unique silicon serial
number, multiple DS18B20s can exist on the same 1-Wire bus. This allows for placing
temperature sensors in many different places. Applications where this feature is useful
include HVAC environmental controls, sensing temperatures inside buildings, equipment
or machinery, and process monitoring and control.

Figure 5.13: DS18B20 Temperature Sensor

The DS18B20 provides a digital temperature reading, eliminating the need for an analog to
digital converter (ADC). It offers an accuracy of ±0.5°C over a range of -10°C to +85°C,
making it reliable for most temperature measurement applications. It can measure
temperatures from -55°C to +125°C, suitable for a variety of environments. The DS18B20
is robust and suitable for harsh environments, especially when enclosed in a waterproof
31
casing.

32
5.4.1 Pin Assignment

Figure 5.14: Pin Assignment

5.4.1.1 Pin Description

GND - Ground

DQ - Data In/Out

VDD - Power supply voltage NC -

No connect

Table 5.2: DS18B20 Temperature

Sensor Pin Description

33
5.4.2 DS18B20 Block Diagram

Figure 5.15: DS18B20 Block Diagram

The block diagram of Figure shows the major components of the DS18B20. The DS18B20
has four main data components: 1) 64-bit layered ROM, 2) temperature sensor,
3) non-volatile temperature alarm triggers TH and TL, and 4) a configuration register. The
device derives its power from the 1-Wire communication line by storing energy on an
internal capacitor during periods of time when the signal line is high and continues to
operate off this power source during the low times of the 1-Wire line until it returns high to
replenish the parasite (capacitor) supply.

As an alternative, the DS18B20 may also be powered from an external 3 volt - volt supply.
Communication to the DS18B20 is via a 1-Wire port. With the 1-Wire port, the memory and
control functions will not be available before the ROM function protocol has been established.
The master must first provide one of five ROM function commands: 1) Read ROM, 2) Match
ROM, 3) Search ROM, 4) Skip ROM, or 5) Alarm Search.
These commands operate on the 64-bit layered ROM portion of each device and can single
out a specific device if many are present on the 1-Wire line as well as indicate to the bus
master how many and what types of devices are present. After a ROM function

34
sequence has been successfully executed, the memory and control functions are accessible
and the master may then provide any one of the six memory and control function
commands.

One control function command instructs the DS18B20 to perform a temperature


measurement. The result of this measurement will be placed in the DS18B20’s scratch- pad
memory, and may be read by issuing a memory function command which reads the
contents of the scratchpad memory. The temperature alarm triggers TH and TL consist of
1byte EEPROM each. If the alarm search command is not applied to the DS18B20, these
registers may be used as general purpose user memory.

The scratchpad also contains a configuration byte to set the desired resolution of the
temperature to digital conversion. Writing TH, TL, and the configuration byte is done using
a memory function command. Read access to these registers is through the scratchpad. All
data is read and written at least a significant bit first.

5.4.3 Features of DS18B20

● Unique 1-Wire® Interface Requires Only One Port Pin for Communication ƒ

● Each Device has a Unique 64-Bit Serial Code Stored in an On-Board ROM

● Multidrop Capability Simplifies Distributed Temperature-Sensing Applications ƒ

● Requires No External Components ƒ

● Can Be Powered from Data Line; Power Supply Range is 3.0V to 5.5V ƒ

● Measures Temperatures from -55°C to +125°C (-67°F to +257°F) ƒ

● ±0.5°C Accuracy from -10°C to +85°C ƒ

● Thermometer Resolution is User Selectable from 9 to 12 Bits ƒ

● Converts Temperature to 12-Bit Digital Word in 750ms (Max) ƒ

● User-Definable Nonvolatile (NV) Alarm Settings ƒ


35
● Alarm Search Command Identifies and Addresses Devices Whose Temperature is

Outside Programmed Limits (Temperature Alarm Condition) ƒ

● Available in 8-Pin SO (150 mils), 8-Pin μSOP, and 3-Pin TO-92 Packages ƒ

● Software Compatible with the DS1822 ƒ

36
5.4.4 Applications

● Thermostatic Controls

● Industrial Systems

● Consumer Products

● Thermometers

5.5 I2C MODULE (INTER INTEGRATED CIRCUIT)

5.5.1 Two wires communication

The two wires, or lines are called Serial Clock (or SCL) and Serial Data (or SDA). The
SCL line is the clock signal which synchronizes the data transfer between the devices on
the I2C bus and it’s generated by the master device. The other line is the SDA line which
carries the data.

The two lines are “open-drain” which means that pull up resistors need to be attached to
them so that the lines are high because the devices on the I2C bus are active low.
Commonly used values for the resistors are from 2K for higher speeds at about 400 kbps, to
10K for lower speed at about 100 kbps.

37
Figure 5.16: Two wires Communication

38
5.6 LCD (LIQUID CRYSTAL DISPLAY)

A liquid crystal display or LCD draws its definition from its name itself. It is a combination
of two states of matter, the solid and the liquid. LCD uses a liquid crystal to produce a
visible image. Liquid crystal displays are super-thin technology display screens that are
generally used in laptop computer screens, TVs, cell phones and portable video games.
LCD’s technologies allow displays to be much thinner when compared to cathode ray tube
(CRT) technology.

Liquid crystal display is composed of several layers which include two polarized panel
filters and electrodes. LCD technology is used for displaying the image in notebook or
some other electronic devices like mini computers. Light is Projected from a lens on a layer
of liquid crystal. This combination of colored light with the grayscale image of the crystal
(formed as electric current flows through the crystal) forms the colored image. This image
is then displayed on the screen.

Figure 5.17: LCD

An LCD is either made up of an active matrix display grid or a passive display grid. Most
of the Smartphone’s with LCD display technology uses active matrix display, but some of
the older displays still make use of the passive display grid designs. Most of the electronic
devices mainly depend on liquid crystal display technology for their display. The liquid has
a unique advantage of having low power consumption than the LED or cathode ray tube.

39
Liquid crystal display screens work on the principle of blocking light rather than emitting
light. LCD’s require backlight as they do not emit light by them. We always use devices
which are made up of LCD’s displays which are replacing the use of cathode ray tubes.
Cathode ray tubes draw more power compared to LCD’s and are also heavier and bigger.

LCD (Liquid Crystal Display) screen is an electronic display module and finds a wide
range of applications. A 16x2 LCD display is a very basic module and is very commonly
used in various devices and circuits. These modules are preferred over seven segments and
other multi segment LEDs. The reasons being: LCDs are economical; easily programmable;
have no limitation of displaying special & even custom characters (unlike in seven
segments), animations and so on.

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this
LCD each character is displayed in a 5x7 pixel matrix. This LCD has two registers, namely,
Command and Data. The command register stores the command instructions given to the
LCD. A command is an instruction given to LCD to do a predefined task like initializing it,
clearing its screen, setting the cursor position, controlling display etc. The data register
stores the data to be displayed on the LCD. The data is the ASCII value of the character to
be displayed on the LCD.

Figure 5.18: 16*2 LCD


40
5.6.1 LCD Pin Description

Probably this very post should have come before the number of other posts related to 8051
LCD interfacing, but it's never too late. This post will describe the pins of LCD normally
available in the market. It looks almost like the one shown below. As you guys can see,
there are 8 data pins along with 3 control pins. One ground and two power pins are also
there. Let's study about these pins of LCD.

Figure 5.19: 16*2 LCD Display Module


A 16x2 LCD (Liquid Crystal Display) is a widely used electronic display module that can
display 16 characters per line on two lines. It features a total of 16 pins, each serving a
specific function. Pin 1 (VSS) is connected to ground, while Pin 2 (VDD) is connected to
the +5V power supply. Pin 3 (V0) is used to adjust the display contrast, typically connected
to a potentiometer. Pin 4 (RS) selects the register, distinguishing between command
(instruction) and data modes. Pin 5 (RW) determines the read or write operation, though it
is often grounded to set the module to write mode permanently. Pin 6 (E) is the enable pin,
which triggers the LCD to read the data lines. Pins 7 to 14 (D0- D7) are the data pins used
for sending data or commands to the LCD, with only D4-D7 being used in 4-bit
communication mode to save I/O pins. Pin 15 (LED+) and Pin 16 (LED-) are for the
backlight, typically connected to +5V and ground, respectively, with a current-limiting
resistor in series with the anode.

41
Table 5.3: LCD Pin Description
P
Function Name
i
n
N
o
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable VEE
resistor
4 Selects command register when low; and data Regist
register when high er
Select
5 Low to write to the register; High to read from the Read/write
register
6 Sends data to data pins when a high to low pulse is Enable
given
7 DB0
8 DB1
9 DB2
10 8-bit data pins DB3
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-

5.6.2 Advantages of an LCD

● LCD’s consumes less amount of power compared to CRT and LED

● LCD’s are consist of some microwatts for display in comparison to some milli watts for
LED’s

● LCDs are of low cost

● Provides excellent contrast

● LCD’s are thinner and lighter when compared to cathode ray tube and LED

42
5.6.3 Disadvantages of an LCD

● Require additional light sources

● Range of temperature is limited for operation

● Low reliability

● Speed is very low

● LCD’s need an AC drive

43
5.6.4 Applications of Liquid Crystal Display
Liquid crystal technology has major applications in the field of science and engineering as
well on electronic devices.

● Liquid crystal thermometer

● Optical imaging

● The liquid crystal display technique is also applicable in visualization of the radio
frequency waves in the waveguide

● Used in the medical application

5.7 RF TRANSCEIVERS

Figure 5.20: RF Transceiver

Generally, an RF module is a small size electronic device that is used to transmit or receive
radio signals between two devices. The main application of the RF module is an embedded
system to communicate with another device wirelessly. This communication may be
accomplished through radio frequency communication. For various applications the
medium of choice is radio frequency since it does not need line of sight. The applications of
RF modules mainly involve low volume and medium volume products for consumer
applications like wireless alarm systems, garage door openers, smart sensor applications,
wireless home automation systems and industrial remote controls. This article discusses the
block diagram of the RF transceiver module and its applications.

A transceiver is a blend of a transmitter and a receiver in a single package. The name

44
applies to wireless communication devices like cellular telephones, handheld two- way
radios, cordless telephone sets, and mobile two-way radios. Sometimes the term is used in
reference to the transmitter or receiver devices in optical fibre systems or cables.

45
Figure 5.21: RF Transceiver Module

In a radio transceiver, the receiver is silenced while transmitting. An electronic switch


permits the transmitter and receiver to be allied to the same antenna and stops the o/p of the
transmitter from injuring the receiver. With this kind of a transceiver, it is difficult to get
signals while transmitting and this mode is named as half duplex.
Some kind of transceivers are designed to let reception of signals through transmission
periods. This mode is called full duplex, and needs that the transmitter (TX) and receiver
(RX) work on considerably different frequencies so the signal which is transmitted doesn’t
interfere with reception. Communication devices use this mode. Satellite communication
networks frequently employ full-duplex transceivers at the surface based subscriber points.
The transceiver-to-satellite (transmitted) signal is called the uplink, and the satellite-to-
transceiver (received) signal is called the downlink.

5.7.1 Block Diagram of RF Transceivers

In general, the designer of wireless systems has two overriding limitations: it must work
over a convinced distance and transfer a convinced amount of information within a data
rate. The size of the RF modules is very small and have an extensive range of an operating
voltage that is 3V to 12V.
Basically, these modules are 433 MHz RF TX and RX modules. The transmitter (TX)
draws no power when transferring logic zero while fully destroying the carrier frequency,
thus consuming considerable low power in battery operation. When logic1 is sent the
carrier is fully on to about 4.5mA with a 3V power supply. The information is sent

46
serially from the transmitter (TX) which is received by the receiver. Transmitter (TX) and
the receiver (RX) are duly interfaced to two Microcontrollers for transferring the data.

Figure 5.22: RF Transceiver Block Diagram

RF modules can be applied for various types, sizes and shapes of electronic circuit boards.
It can also be useful for modules across a vast variety of capacity and functionality. These
modules typically include a PCB, TX circuit or RX circuit, antenna and serial interface for
communication to the main processor. The types of RF modules mainly include RF
transmitter module, RF receiver module, RF transceiver module and SOC module. There
are 3-types of signal modulation techniques commonly used in RF transmitter and receiver
modules such as ASK-amplitude shift keying, OOK-On-Off Keying and FSK-frequency
shift keying. An RF transceiver module includes both a transmitter and receiver. The circuit
of RF transceiver modules is typically designed for half-duplex operation and although full-
duplex modules are available, typically at a higher cost due to the added complexity.
5.7.2 RF Transmitter
An RF transmitter module is a small size PCB capable of transferring a radio wave and
modulating radio waves to carry data. RF transmitter modules are usually applied along
with a microcontroller, which will offer data to the module which can be transmitted.
5.7.3 RF Receiver
An RF receiver module takes the modulated RF signal to demodulate it. There are two
kinds of RF receiver modules, namely the super-regenerative receivers and super -

47
heterodyne receivers. Usually, super-regenerative modules are low power designs and low cost
using a series of amplifiers to remove modulated data from a carrier wave. These modules vary,
generally inaccurate as their operation of frequency significantly with power supply voltage and
temperature. The main advantage of Super heterodyne receiver modules is a high performance
over super-regenerative. They offer increased stability and accuracy over a large temperature and
voltage range. This stability comes from a stable crystal design which in turn leads to a relatively
more expensive product.

Figure 5.23: RF Transmitter and Receiver

5.7.4 Pin Description

5.7.4.1 RF Transmitter

Table 5.4: RF Transmitter

Pin
Function Name
No
1 Ground (0V) Ground
2 Serial data input pin Data
3 Supply voltage; 5V Vcc
4 Antenna output pin ANT
48
5.7.4.2 RF Receiver

Table 5.5: RF Receiver

Pin
Function Name
No
1 Ground (0V) Ground
2 Serial data output pin Data
3 Linear output pin; not connected NC
4 Supply voltage; 5V Vcc
5 Supply voltage; 5V Vcc
6 Ground (0V) Ground
7 Ground (0V) Ground
8 Antenna input pin ANT

RF transceiver module is used in a particular device where both the transmitter and receiver
are housed in a single module. Such devices transmit and receive RF signals, so that is
named as RF Transceiver. Mostly the position of RF Transceiver module is in between
Power amplifier/Low Noise Amplifier and Baseband MODEM in any wireless
communication system. Baseband Modem houses chip sets of several analog or digital
modulation techniques and analog to digital conversion or digital to analog conversion
chips.
5.7.5 Applications of RF Transceiver

● RF transceiver module is used in wireless communication. The main application of


this transceiver is to make information in the form of data/ voice / video apt to be
transmitted over the wireless medium.

● The main intention of this device is to alter IF frequency to RF frequency and vice
versa.

● RF transceiver module is used in for radio transmission, satellite communication,


for television signal transmission, reception and in Wimax or WLAN, Zigbee or

49
ITE networks.

50
5.8 BUZZER
A buzzer is an electromechanical device that produces a buzzing or beeping sound. It's
commonly used in various electronic devices, appliances, and systems to provide audible
alerts or notifications. The basic principle behind a buzzer is the conversion of electrical
energy into mechanical energy, which creates sound vibrations.

5.8.1 Electromechanical
The electric buzzer was invented in 1831 by Joseph Henry. They were mainly used in early
doorbells until they were phased out in the early 1930s in favour of musical chimes, which
had a softer tone.

Figure 5.24: Buzzer

Early devices were based on an electromechanical system identical to an electric bell


without the metal gong. Similarly, a relay may be connected to interrupt its own actuating
current, causing the contacts to buzz. Often these units were anchored to a wall or ceiling to
use it as a sounding board. The word "buzzer" comes from the rasping noise that
electromechanical buzzers made. Also known as solid-state buzzers, these devices consist
of an electronic oscillator circuit and a speaker or transducer. The oscillator generates an
alternating current at an audible frequency, which is then converted into sound waves by
the speaker.

The buzzer contains a coil of wire wrapped around a magnetic core. When an electric
current flows through this coil, it generates a magnetic field around the core, turning it into
an electromagnet. The contact is usually a small metal disc or strip that is attracted to the
electromagnet when current flows through the coil. When the contact is pulled towards the
electromagnet, it creates tension in the diaphragm, causing it to bend or vibrate.
51
5.8.2 Piezoelectric
Piezoelectric buzzers, or piezo buzzers, as they are sometimes called, were invented by
Japanese manufacturers and fitted into a wide array of products during the 1970s to 1980s.
This advancement mainly came about because of cooperative efforts by Japanese
manufacturing companies. In 1951, they established the Barium Titanate Application
Research Committee, which allowed the companies to be "competitively cooperative" and
bring about several piezoelectric innovations and inventions. These buzzers utilize the
piezoelectric effect, where certain materials generate an electric charge when subjected to
mechanical stress. When an electric current is applied to a piezoelectric element, it vibrates
and produces sound waves. Piezoelectric buzzers are known for their compact size and high
efficiency.

5.8.3 Mechanical

A joy buzzer is an example of a purely mechanical buzzer and they require drivers. Other
examples of them are doorbells. These buzzers typically consist of an electromagnet, a
vibrating diaphragm, and a contact. When an electric current passes through the coil of the
electromagnet, it generates a magnetic field that attracts the contact, causing the diaphragm
to vibrate and produce sound. Attached to the armature is a flexible diaphragm, often made
of metal or plastic. When the armature moves towards the electromagnet, it pushes or pulls
the diaphragm, causing it to vibrate.

5.8.4 Applications

● Security Systems

● Fire Alarm Systems

● Medical Equipment

● Industrial Machinery

● Home Appliances

52
● Educational Tools

● Consumer Electronics

53
CHAPTER 6
SOFTWARE DESCRIPTION
6.1 ARDUINO IDE

Arduino is an open-source electronics platform based on easy-to-use hardware and


software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or
a Twitter message - and turn it into an output - activating a motor, turning on an LED,
publishing something online. You can tell your board what to do by sending a set of
instructions to the microcontroller on the board. To do so you use the Arduino
programming language (based on Wiring), and the Arduino Software (IDE), based on
Processing.

Over the years Arduino has been the brain of thousands of Projects, from everyday objects
to complex scientific instruments. A worldwide community of makers - students, hobbyists,
artists, programmers, and professionals - has gathered around this open-source platform,
their contributions have added up to an incredible amount of accessible knowledge that can
be of great help to novices and experts alike.

Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and programming. As
soon as it reached a wider community, the Arduino board started changing to adapt to new
needs and challenges, differentiating its offer from simple 8-bit boards to products for IoT
applications, wearable, 3D printing, and embedded environments. All Arduino boards are
completely open-source, empowering users to build them independently and growing
through the contributions of users worldwide.
6.1.1 Hardware Specifications

● Microcontroller: ATmega328

● Operating Voltage: 5V

● Input Voltage (recommended):7-12V

54
● Input Voltage (limits): 6- 20V

● Digital I/O Pins: 14 (of which 6 provide PWM output)

55
● Analog Input Pins: 6 • DC Current per I/O Pin: 40 mA

● DC Current for 3.3V Pin: 50 mA

● Flash Memory: 32 KB (ATmega328)

● SRAM: 2 KB (ATmega328)

● EEPROM: 1 KB (ATmega328)

● Clock Speed: 16 MHz

6.1.2 Board Types

Various kinds of Arduino boards are available depending on different microcontrollers


used. However, all Arduino boards have one thing in common: they are programmed
through the Arduino IDE. The differences are based on the number of inputs and outputs
(the number of sensors, LEDs, and buttons you can use on a single board), speed, operating
voltage, form factor etc. Some boards are designed to be embedded and have no
programming interface (hardware), which you would need to buy separately. Some can run
directly from a 3.7V battery, others need at least 5V.

Arduino boards are a family of open-source microcontroller-based development platforms


designed for creating interactive Projects. These boards, such as the Arduino Uno, Mega,
and Nano, are known for their simplicity, affordability, and versatility, making them
popular among hobbyists, educators, and professionals. At their core, Arduino boards
feature a microcontroller, typically from the Atmel AVR family or the ARM-based
processors for more advanced models. The boards are equipped with a variety of input and
output pins, allowing users to connect sensors, actuators, and other electronic components
to create a wide range of Projects, from simple LED blinkers to complex home automation
systems.

Arduino boards also support various communication protocols, including UART, I2C, and
SPI, enabling them to interact with other microcontrollers, computers, and peripherals. This
capability is crucial for creating sophisticated Projects that require data exchange, such as
56
IoT applications where the board might send sensor data to a cloud server or receive
commands from a smartphone app.

57
Here is a list of different Arduino boards available.

6.1.2.1 Arduino boards based on ATMEGA328 microcontroller

Table 6.1: Arduino boards based on ATMEGA328 microcontroller

Boa Opera Clo Digi Ana P U Programmin


rd ting ck ta l log W A g Interface
Na Volt Spe i/o Inp R
me ed uts M T
Ardui 5V 16MH 14 6 6 1 USB via
no z ATMega16U
Uno 2
R3
Arduino 5V 16MH 14 6 6 1 USB via
Uno z ATMega16U
2
R3
SMD
Red 5V 16MH 14 6 6 1 USB via
Board FTDI
z

Arduino 3.3V 8 8 14 6 6 1 FTDI


Pro MHz
Compatible
3.3v/8 Header
MHz

58
Arduin 5V 16MH 14 6 6 1 FTDI
o Pro z Compatible
5V/16 Header
MH
z

Ardui 5V 16M 14 8 6 1 FTDI


no H
Compatibl
mini z e Header
05
Arduino 3.3V 8MHz 14 8 6 1 FTDI
Pro Compatibl
e Header
mini
3.3v/8m
hz
Arduino 5V 16M 14 8 6 1 FTDI
Pro H
Compatibl
z e Header
mini
5v/16m
hz
Ardui 5V 16M 14 6 6 1 FTDI
no H
Compatibl
Ether z e Header
net

59
Ardui 3.3V 8MHz 14 8 6 1 FTDI
no Compatibl
Fio e Header

LilyP 3.3V 8MHz 14 6 6 1 FTDI


ad Compatibl
Ardui e Header
no
328

main
board
LilyP 3.3V 8MHz 9 4 5 0 FTDI
ad Compatibl
Ardui e Header
no
simpl
y
board

60
6.1.3 Arduino Board Description
We will learn about the different components on the Arduino board. We will study the
Arduino UNO board because it is the most popular board in the Arduino board family. In
addition, it is the best board to get started with electronics and coding. Some boards look a
bit different from the one given below, but most Arduino’s have the majority of these
components in common.

Figure 6.1: Arduino Board

● Power USB
An Arduino board can be powered by using the USB cable from your computer. All you
need to do is connect the USB cable to the USB connection (1).

61
● Power (Barrel Jack)

Arduino boards can be powered directly from the AC mains power supply by connecting it
to the Barrel Jack (2).

● Voltage Regulator

The function of the voltage regulator is to control the voltage given to the Arduino board
and stabilize the DC voltages used by the processor and other elements.

● Crystal Oscillator

The crystal oscillator helps Arduino in dealing with time issues. How does Arduino
calculate time? The answer is, by using the crystal oscillator. The number printed on top of
the Arduino crystal is 16.000H9H. It tells us that the frequency is 16,000,000 Hertz or 16
MHz

5, 17. Arduino Reset

You can reset your Arduino board, i.e., start your program from the beginning. You can
reset the UNO board in two ways. First, by using the reset button (17) on the board.
Second, you can connect an external reset button to the Arduino pin labeled RESET (5).

6, 7, 8, 9. Pins (3.3, 5, GND, Vin)

● 3.3V (6): Supply 3.3 output volt

● 5V (7): Supply 5 output volt

● Most of the components used with Arduino boards work fine with 3.3 volt and 5 volt.

● GND (8)(Ground): There are several GND pins on the Arduino, any of which can

be used to ground your circuit.

● Vin (9): This pin also can be used to power the Arduino board from an external

power source, like AC mains power supply.


62
10. Analog pins

The Arduino UNO board has five analog input pins A0 through A5. These pins can read the
signal from an analog sensor like the humidity sensor or temperature sensor and convert it
into a digital value that can be read by the microprocessor.

11. Main microcontroller

Each Arduino board has its own microcontroller (11). You can assume it as the brain of
your board. The main IC (integrated circuit) on the Arduino is slightly different from board
to board. The microcontrollers are usually of the ATMEL Company. You must know what
IC your board has before loading up a new program from the Arduino IDE. This
information is available on the top of the IC. For more details about the IC construction and
functions, you can refer to the data sheet.

12. ICSP pin

Mostly, ICSP (12) is an AVR, a tiny programming header for the Arduino consisting of
MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an SPI (Serial
Peripheral Interface), which could be considered as an "expansion" of the output. Actually,
you are slaving the output device to the master of the SPI bus.

13. Power LED indicator

This LED should light up when you plug your Arduino into a power source to indicate that
your board is powered up correctly. If this light does not turn on, then there is something
wrong with the connection.

14. TX and RX LEDs

On your board, you will find two labels: TX (transmit) and RX (receive). They appear in
two places on the Arduino UNO board. First, at the digital pins 0 and 1, to indicate the pins
responsible for serial communication. Second, the TX and RX led (13). The TX led flashes
with different speeds while sending the serial data. The speed of flashing depends on the
baud rate used by the board. RX flashes during the receiving process.

63
15. Digital I / O

The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide PWM (Pulse
Width Modulation) output. These pins can be configured to work as input digital pins to
read logic values (0 or 1) or as digital output pins to drive different modules like LEDs,
relays, etc. The pins labelled “~” can be used to generate PWM.

16. AREF

AREF stands for Analog Reference. It is sometimes used to set an external reference
voltage (between 0 and 5 Volts) as the upper limit for the analog input pins.

6.2 ARDUINO INSTALLATION

After learning about the main parts of the Arduino UNO board, we are ready to learn how
to set up the Arduino IDE. Once we learn this, we will be ready to upload our program on
the Arduino board. In this section, we will learn in easy steps how to set up the Arduino
IDE on our computer and prepare the board to receive the program via USB cable.

6.2.1 Step 1

First you must have your Arduino board (you can choose your favourite board) and a USB
cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or
Decimals, you will need a standard USB cable (A plug to B plug), the kind you would
connect to a USB printer as shown in the following image.

64
Figure 6.2: USB Cable

65
6.2.2 Step 2: Download Arduino IDE Software.

You can get different versions of Arduino IDE from the Download page on the Arduino
Official website. You must select your software, which is compatible with your operating
system (Windows, IOS, or Linux). After your file download is complete, unzip the file.

Figure 6.3: Download Arduino IDE Software

6.2.3 Step 3: Power up the board.

The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from
either the USB connection to the computer or an external power supply. If you are using an
Arduino Diecimila, you have to make sure that the board is configured to draw power from
the USB connection. The power source is selected with a jumper, a small piece of plastic
that fits onto two of the three pins between the USB and power jacks. Check that it is on the
two pins closest to the USB port. Connect the Arduino board to your computer using the
USB cable. The green power LED (labelled PWR) should glow.

66
6.2.4 Step 4: Launch Arduino IDE

After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the
folder, you can find the application icon with an infinity label (application.exe). Double-
click the icon to start the IDE.

Figure 6.4: Launch Arduino IDE

6.2.5 Step 5: Open your first Project.

Once the software starts, you have two options:

● Create a new Project.

67
● Open an existing Project example.

To create a new Project, select File --> New.

68
Figure 6.5: Open First Project

To open an existing Project example, select File -> Example -> Basics -> Blink.

Figure 6.6: Open Existing Project

69
Here, we are selecting just one of the examples with the name Blink. It turns the LED on
and off with some time delay. You can select any other example from the list.

70
6.2.6 Step 6: Select your Arduino board.

To avoid any error while uploading your program to the board, you must select the correct
Arduino board name, which matches with the board connected to your computer. Go to
Tools -> Board and select your board

Figure 6.7: Select Arduino Board

Here, we have selected the Arduino Uno board according to our tutorial, but you must
71
select the name matching the board that you are using.

72
6.2.7 Step 7: Select your serial port.

Select the serial device of the Arduino board. Go to Tools -> Serial Port menu. This is
likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial
ports). To find out, you can disconnect your Arduino board and re-open the menu, the entry
that disappears should be of the Arduino board. Reconnect the board and select that serial
port.

Figure 6.8: Select Serial Port

73
6.2.8 Step 8: Upload the program to your board.

Before explaining how we can upload our program to the board, we must demonstrate the
function of each symbol appearing in the Arduino IDE toolbar.

Figure 6.9: Upload Program to the Board

Now, simply click the "Upload" button in the environment. Wait a few seconds; you will
see the RX and TX LEDs on the board, flashing. If the upload is successful, the message
"Done uploading" will appear in the status bar.

74
CHAPTER 7
BLYNK APP

7.1 BLYNK
Blynk was designed for the Internet of Things. It can control hardware remotely, it can
display sensor data, it can store data, visualize it and do many other cool things.
Blynk is a platform with iOS and Android apps to control Arduino, Raspberry Pi and the
likes over the Internet. It's a digital dashboard where you can build a graphic interface for
your Project by simply dragging and dropping widgets. It's really simple to set everything
up and you'll start tinkering in less than 5 mins. Blynk is not tied to some specific board or
shield. Instead, it's supporting hardware of your choice. Whether your Arduino or
Raspberry Pi is linked to the Internet over Wi-Fi, Ethernet or this new ESP8266 chip,
Blynk will get you online and ready for the Internet Of Your Things.

Figure 7.1: Blynk App Overview

75
There are three major components in the platform:

● Blynk App - allows you to create amazing interfaces for your Projects using various
widgets we provide.

● Blynk Server - responsible for all the communications between the Smartphone and
hardware. You can use our Blynk Cloud or run your private Blynk server locally. Its
open-source, could easily handle thousands of devices and can even be launched on a
Raspberry Pi.

● Blynk Libraries - for all the popular hardware platforms - enable communication with
the server and process all the incoming and out coming commands.
Blynk was designed for the Internet of Things. It can control hardware remotely, it can
display sensor data, it can store data, visualize it and do many other cool things.
Now imagine: every time you press a Button in the Blynk app, the message travels to
the Blynk Cloud, where it magically finds its way to your hardware. It works the same in
the opposite direction and everything happens in a blynk of an eye.

76
Figure 7.2: Working of Blynk App

77
7.2 FEATURES

Similar API & UI for all supported hardware & devices Connection to the cloud using:

● Wifi

● Bluetooth and BLE

● Ethernet

● USB (Serial)

● GSM

● Set of easy-to-use Widgets

● Direct pin manipulation with no code writing

● Easy to integrate and add new functionality using virtual pins

● History data monitoring via History Graph widget

● Device-to-Device communication using Bridge Widget

● Sending emails, tweets, push notifications, etc.

7.3 CHARACTERISTICS OF BLYNK


Similar API & UI for all supported hardware & devices Connection to the cloud can be
done using Ethernet, Wi-Fi, Bluetooth, BLE and USB (Serial) Set of easy-to-use Widgets
Direct pin manipulation with no code writing Easy to integrate and add new functionality
using virtual pins History data monitoring via History Graph widget Device- to-Device
communication using Bridge Widget Sending emails, tweets, push notifications, etc. Blynk
offers an intuitive drag-and-drop interface that allows users to easily design their mobile
apps without needing extensive coding knowledge. Blynk supports various hardware
platforms such as Arduino, Raspberry Pi, ESP8266, ESP32, and others, making it versatile
for different IoT Projects. It provides cloud connectivity, enabling users to remotely control
and monitor their IoT devices from anywhere with an internet connection. Blynk ensures
secure communication between the hardware and mobile app using protocols like HTTPS,
78
TCP/IP, and MQTT, protecting user data and privacy. Blynk has an active community of
developers and enthusiasts who contribute to forums, tutorials, and libraries, providing
support and resources for users.

79
CHAPTER 8
SOURCE CODE
8.1 TRANSMITTING SECTION CODE

#define BLYNK_TEMPLATE_ID "TMPL3mj8RSDfk"


#define BLYNK_TEMPLATE_NAME "WATER PARAMETERS"
#define BLYNK_AUTH_TOKEN "faY8SPjli68WlW4KEQ5w5GxTAy0Xr1IH"

char auth[] = BLYNK_AUTH_TOKEN;


char ssid [] = "ProjectECE";
char pass [] = "NECN.2024";

#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h> #include
<BlynkSimpleEsp8266.h> #include
<SimpleTimer.h> #include
<OneWire.h>
#include <DallasTemperature.h> #include
<DHT.h>
BlynkTimer timer;

#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
float Fahrenheit=0;
#define sensor_pin A0 //turbidity int
read_ADC;
int ntu;

80
SimpleTimer timer_2;

81
#define DHTPIN 5 // D1 to dht-11 sensor
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);


//BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App. void
sendSensor()
{
float h = dht.readHumidity(); float t
= dht.readTemperature();

if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!"); return;
}
Blynk.run();
Blynk.virtualWrite(V6, t);
Blynk.virtualWrite(V7, h);

}
void gettempData()
{
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0); // Celcius Fahrenheit =
DS18B20.toFahrenheit(temp); // Fahrenheit Serial.println(temp);
Serial.println(Fahrenheit);

82
Blynk.run();
Blynk.virtualWrite(V5,temp);
}
int count;
int modes=1;

void getSendData() { count+


+; Serial.print(count);
if(count>15)
{
modes++;
// if(modes==6)modes=1;

count=0;
}
}

void setup()
{
Blynk.begin(auth, ssid, pass);
dht.begin();
DS18B20.begin();
Serial.begin(115200);
timer_2.setInterval(1000L, getSendData);
pinMode(sensor_pin, INPUT);
pinMode(D3,OUTPUT); //TRIGGER
pinMode(D5,INPUT); //ECHO
pinMode(D6,OUTPUT); //rf tx water
pinMode(D7,OUTPUT); //rf tx turbidity
pinMode(D8,OUTPUT); //buzzer

83
digitalWrite(D6,HIGH);

84
digitalWrite(D7,HIGH);
}
void loop()
{
timer_2.run();
switch(modes)
{
case 1: read_ADC = analogRead(sensor_pin);
float time, distance,level;
digitalWrite(D3,LOW);
delayMicroseconds(2);
digitalWrite(D3,HIGH);
delayMicroseconds(10);
digitalWrite(D3,LOW);
delayMicroseconds(2);
digitalWrite(D3,HIGH);
delayMicroseconds(10);
time=pulseIn(D5,HIGH);
distance=time*340/20000;

if(read_ADC>208)read_ADC=208; ntu =
map(read_ADC, 0, 208, 300, 0);
Blynk.run();
Blynk.virtualWrite(V3,distance);
Blynk.virtualWrite(V4,ntu); if(ntu>=70 )
{
digitalWrite(D6,LOW);
digitalWrite(D8,HIGH);
}
else if (distance<5)
break;
85
digitalWrite(D7,LOW); digitalWrite(D8,HIGH);
}
else
{
digitalWrite(D6,HIGH);
digitalWrite(D7,HIGH);
digitalWrite(D8,LOW);
}

case 2:
sendSensor();
Blynk.run(); modes++;
break;

case 3:
gettempData();
modes=1;
break;
}
}

86
8.2 RECEIVING SECTION CODE
#include<LiquidCrystal.h> #include
<LiquidCrystal_I2C.h>
LiquidCrystal_I2C Lcd(0x27,16,2);
#include <Wire.h>
void setup()
{
Serial.begin(115200);
pinMode (D5,INPUT); //RF RX 1
pinMode (D6,INPUT); //RF RX 2
pinMode (D7,OUTPUT); //BUZZER
Lcd.begin(); Lcd.setCursor(0,0);
Lcd.print(" WELCOME TO ");
Lcd.setCursor(0,1);
Lcd.print(" WSN FOR WATER ");
delay(3000);
digitalWrite(D7,HIGH);
delay(700);
digitalWrite(D7,LOW);
delay(700);
digitalWrite(D7,HIGH);
delay(700);
digitalWrite(D7,LOW);
delay(700);
digitalWrite(D7,HIGH);
delay(700);
digitalWrite(D7,LOW);
delay(700);
}
void loop() {

87
int S,V; S=digitalRead(D5);
V=digitalRead(D6); if(S==0)
{
digitalWrite(D7,HIGH);
Lcd.setCursor(0,0);
Lcd.print(" * RIVER WATER *");
Lcd.setCursor(0,1); Lcd.print("LEVEL
INCREASING");
delay(300);
}
else if(V==0)
{
digitalWrite(D7,HIGH);
Lcd.setCursor(0,0);
Lcd.print(" * RIVER WATER *");
Lcd.setCursor(0,1);
Lcd.print(" HAS HIGH DUST ");
delay(300);
}
else
{
digitalWrite(D7,LOW);
Lcd.setCursor(0,0);
Lcd.print(" WSN FOR WATER ");
Lcd.setCursor(0,1); Lcd.print("LEVEL
MONITORING");
delay(300);
}
Lcd.clear();
}

88
CHAPTER – 9
RESULTS AND DISCUSSION
The pollutant detection in aquatic environments using IOT the quality of water
continuously monitoring using IoT devices like Node MCU. In this system, varieties of
sensors are used to detect current physical conditions, and send the data to a microcontroller
(Node MCU ESP8266). This system makes use of a Water quality monitoring sensor, Node
MCU ESP8266, Temperature sensor, PH sensor, Turbidity sensors,16*2 LCD Display, Fast
alerts and Buzzer. This system has two stations, they are Remote station and Monitoring
station. In Remote station, the Node MCU ESP8266, Ph sensor, Turbidity sensor,
Ultrasonic sensor, RF Transmitter, Solar panel and Battery are integrated. These sensors are
used and send the status of those sensors to Node MCU. Then, the data will be processed by
Node MCU and transferred to the Monitoring station through Internet of things (IOT). The
Monitoring station consist of Node MCU ESP8266, RF Receiver, 16*2 LCD Display and
Buzzer. The Node MCU in the Monitoring station is similar to the remote station, it
receives and processes the data. The 16*2 LCD Displays the real-time data received from
the remote station. The buzzer acts as an alarm, which can be triggered if the pollutant
levels exceed predefined safe thresholds.

89
Figure 9.1: Overall view of the Project

90
Figure 9.2: Remote Station or Transmitting Section

91
Figure 9.3: Monitoring Station or Receiving Section

92
Here, the Blynk is used to display sensor data such as Water Level, Water Turbidity, Water
Temperature, Atmosphere Temperature and Atmosphere Humidity.

Figure 9.4: Water parameters

When we provide power supply for both the Transmitting section and Receiving section then
16*2 LCD displays as shown in the below figures.

93
Figure 9.5: 16*2 LCD Display

94
When the floods occur then the flow of water increases. so that, the level of water increases
then the distance between the water and ultrasonic sensors decreases. Then the Node MCU
in the Remote station send the data the Node MCU in the Monitoring station and 16*2 LCD
displays that “RIVER WATER LEVEL INCREASING”.

Figure 9.6: Water Level Increases

Figure 9.7: Water Level Increasing Alert Message


95
When the floods occur or any industry releases pollutants into the river water, then the
water gets polluted due to increase in inorganic components and harmful substances in the
water. Turbidity sensors measure the clarity of water by detecting suspended particles. Any
change occurs in water clarity, then that data will be collected by the Node MCU in the
Remote station and send that data to the Node MCU in the Monitoring station. The 16*2
LCD displays that “RIVER WATER HAS HIGH DUST “.

Figure 9.8: River Water has High Dust

96
Figure 9.9: High Turbidity Alert Message

97
Here, the water temperature and atmospheric temperature are measured. The third gauge
displays a water temperature and the fourth gauge displays the atmospheric temperature.

Figure 9.10: Water and Atmospheric Temperature

When the pH meter is placed in the water, it measures the pH value of the water and displays it.

Figure 9.10: pH value of Water


98
CHAPTER 10
CONCLUSION AND FUTURE SCOPE
10.1 CONCLUSION
The potential to create an alarm system that will mitigate the risk of flooding is highlighted
in this Project. In the case of a flood or other dangerous natural disaster, it might also
support a variety of governmental bodies or authority, which might aid society and
humanity. The suggested model has been tried out and is functioning as described in this
Project. It will keep an eye on all potential sources of flooding. It will quickly transmit a
warning if the water level increases along with the speed. Additionally, it makes dealing
with and recovering from this disastrous situation more accessible. In conclusion, it will aid
the neighbourhood in making quick judgments and preparing for this tragedy.

10.2 FUTURE SCOPE

The future scope of pollutant detection in aquatic environments using IoT (Internet of
Things) holds great promise for environmental monitoring and sustainability. Here are
some key aspects:

1. Real-time Monitoring and Data Collection

IoT-enabled sensors can provide continuous, real-time monitoring of water quality


parameters such as pH, temperature, turbidity, dissolved oxygen, and the presence of
specific contaminants (e.g., heavy metals, nitrates, phosphates). This real-time data
allows for immediate detection of pollution events, enabling swift response to
mitigate impacts.

2. Enhanced Data Analytics and Predictive Modelling

The vast amounts of data collected by IoT sensors can be analyzed using advanced data
analytics and machine learning algorithms. This can help in:

● Predicting future pollution events based on historical data and patterns.

● Identifying pollution sources and pathways.


99
● Optimizing water treatment processes and resource allocation.

100
3. Improved Decision-Making and Policy Development

Access to accurate, real-time data can assist policymakers and environmental


agencies in making informed decisions. It can support the development of targeted
regulations and policies aimed at pollution prevention and control, and aid in
compliance monitoring.

4. Smart Water Management Systems

IoT can facilitate the development of integrated water management systems that
optimize the use and conservation of water resources. These systems can include
smart irrigation, automated water treatment plants, and efficient wastewater
management, all driven by real-time data.

5. Community and Stakeholder Engagement

IoT technologies can empower local communities by providing them with


accessible information about their water quality. Mobile apps and web platforms
can
display data from IoT sensors, promoting transparency and public awareness. This
can also foster community-driven conservation efforts.

6. Technological Advancements and Integration

Future advancements in sensor technology, such as increased sensitivity,


selectivity, and durability, will enhance the reliability and accuracy of pollutant
detection. Integration with other emerging technologies like blockchain for data
security, drones for expanded monitoring reach, and edge computing for real-time
data processing can further revolutionize aquatic environment monitoring.

7. Cost Reduction and Scalability

As IoT technology matures, the cost of sensors and deployment is expected to


decrease, making widespread implementation more feasible. This scalability can
enable comprehensive monitoring of larger water bodies, including oceans, rivers,
and lakes, as well as smaller, localized water sources.
101
REFERENCES
• [1] K. S. Adu-Manu, N. Adam, C. Tapparello, H. Ayatollahi, and W. Heinzelman,
‘‘Energy-harvesting wireless sensor networks (EHWSNs): A review,’’ ACM Trans.
Sensor Netw., vol. 14, no. 2, pp. 1–50, Apr. 2018.

• [2] Z. Asif, Z. Chen, C. An, and J. Dong, ‘‘Environmental impacts and challenges
associated with oil spills on shorelines,’’ J. Mar. Sci. Eng., vol. 10, no. 6, p. 762, May
2022.
• [3] A.-L. Balogun, S. T. Yekeen, B. Pradhan, and K. B. W. Yusof, ‘‘Oil spill trajectory
modelling and environmental vulnerability mapping using GNOME model and GIS,’’
Environ. Pollut., vol. 268, Jan. 2021, Art. no. 115812.

• [4] A. M. Bernabeu, M. Plaza-Morlote, D. Rey, M. Almeida, A. Dias, and A. P. Mucha,


‘‘Improving the preparedness against an oil spill: Evaluation of the influence of
environmental parameters on the operability of unmanned vehicles,’’ Mar. Pollut. Bull.,
vol. 172, Nov. 2021, Art. no. 112791.
• [5] M. Bhuyan, Intelligent Instrumentation: Principles and Applications. Boca Raton,
FL, USA: CRC Press, 2013.
• [6] C. M. Bishop, Pattern Recognition and Machine Learning (Information science
and Statistics), 1 st ed. Springer, 2006.

• [7] H. Denkilkian, A. Koulakezian, R. Ohannessian, M. S. Chalfoun, M. K. W. Joujou,


A. Chehab, and I. H. Ilahi, “Wireless sensor for continuous real-time oil spill thickness
and location measurement,”IEEE Trans. Instrum. Meas., vol. 58, no. 12, pp. 4001-4011,
Dec. 2009.
• [8] R. C. Eberhart and Y. Shi, Computational Intelligence: Concepts to
Implementations, 1st ed. San Mateo, CA, USA: Morgan Kaufmann, 2007.
• [9] M. Fingas and C. Brown, ‘‘A review of oil spill remote sensing,’’ Sensors, vol. 18,
no. 2, p. 91, Dec. 2017.

• [10] D. D. Gajski, G. S. S. Abdi, and A. Gerstlauer, Embedded System Design:


Modeling, Synthesis and Verification, 1st ed. Springer, 2009.

• [11] O. Garcia-Pineda, G. Staples, C. E. Jones, C. Hu, B. Holt, V. Kourafalou, G.


Graettinger, L. DiPinto, E. Ramirez, D. Streett, J. Cho, G. A. Swayze, S. Sun, D.
Garcia, and F. Haces-Garcia, ‘‘Classification of oil spill by thicknesses using multiple
remote sensors,’’ Remote Sens. Environ., vol. 236, Jan. 2020, Art. no. 111421.
• [12] I. Goodfellow, Y. Bengio, and A. Courville, Deep Learning (Adaptive
102
Computation and Machine Learning Series). Cambridge, MA, USA: MIT Press, 2016.

• [13] A. Géron, Hands on Machine Learning With Scikit Learn Keras and TensorFlow,
2nd ed. O’Reilly Media, 2019.
• [14] L. Haulin, ‘‘A state-based method to model and analyze the power consumption of
embedded systems,’’ Tech. Rep., 2018.

• [15] R. Hidalgo-Leon, J. Urquizo, C. E. Silva, J. Silva-Leon, J. Wu, P. Singh, and G.


Soriano, ‘‘Powering nodes of wireless sensor networks with energy harvesters for
intelligent buildings: A review,’’ Energy Rep., vol. 8, pp. 3809–3826, Nov. 2022.

• [16] P. Keramea, K. Spanoudaki, G. Zodiatis, G. Gikas, and G. Sylaios, ‘‘Oil spill


modeling: A critical review on current trends, perspectives, and challenges,’’ J. Mar.
Sci. Eng., vol. 9, no. 2, p. 181, Feb. 2021.
• [17] C. Koulamas and M. Lazarescu, ‘‘Real-time embedded systems: Present and
future,’’ Electronics, vol. 7, no. 9, p. 205, Sep. 2018.

• [18] E. A. Lee and S. A. Seshia, Introduction to Embedded Systems: A CyberPhysical


Systems Approach, 2nd ed. Cambridge, MA, USA: MIT Press, 2017.

• [19] I. M. M. El Emary and S. Ramakrishnan, Wireless Sensor Networks: From Theory


to Applications, 2013.

• [20] P. Marwedel, Embedded System Design: Embedded Systems Foundations of


Cyber-Physical Systems, and the Internet of Things, 4th ed. Springer, 2021.

103

You might also like