Instructions For 4-2 B.Tech Project Thesis Preparation

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 95

“FLOOD DETECTION & AVOIDANCE SYSTEM

USING IOT”

A Dissertation

Submitted in partial fulfillment of the requirements for the award of the


degree of

BACHELOR OF TECHNOLOGY
IN
ELECTRONICS & COMMUNICATION ENGINEERING

Submitted By

M.BHAVYA SRI (21JR5A0409)

I.HARSHITHA (20JR1A0469)

J.LAHARI (20JR1A0470)

Under the Guidance of

K. RAMA KRISHNA M.Tech


Asst.Professor

DEPARTMENT OF
ELECTRONICS AND COMMUNICATION ENGINEERING
(NBA Accredited Department)
KKR & KSR INSTITUTE OF TECHNOLOGY AND SCIENCES
(Autonomous)
Vinjanampadu (V), Vatticherukuru (M), Guntur (Dt),
Andhra Pradesh -522017.

APRIL – 2024.
ELECTRONICS AND COMMUNICATION ENGINEERING

KKR & KSR INSTITUTE OF TECHNOLOGY AND SCIENCES


(Autonomous)
(Approved by AICTE New Delhi || Permanently Affiliated to JNTUK, Kakinada)
|| Accredited with ‘A’ Grade by NAAC || NBA Accreditation)
Vinjanampadu (V), Vatticherukuru (M), Guntur (Dt), A.P-522017.

CERTIFICATE

This is to certify that this project report entitled “FLOOD DETECTION &
AVOIDANCE SYSTEM USING IOT” submitted by M.BHAVYA SRI (21JR5A0409),
I.HARSHITHA (20JR1A0469), J.LAHARI (20JR1A0470) to Jawaharlal Nehru University
Kakinada, through KKR & KSR Institute of Technology and Sciences for the award of the
Degree of Bachelor of Technology in Electronics and Communication Engineering is a
bonafide record of project work carried out by them under my supervision during the
academic year 2023 – 2024.

K. Rama Krishna M.Tech Dr.N.Adi Narayana

SUPERVISOR HEAD OF THE DEPARTMENT

INTERNAL EXAMINER EXTERNAL EXAMINER


DECLARATION

We here by declare that the project “Flood Detection & Avoidance system using
IOT” has been carried out by me and this work has been submitted to KKR & KSR Institute
of Technology and Sciences (A), Vinjanampadu, affiliated to Jawaharlal Nehru
Technological University, Kakinada in partial fulfillment of the requirements for the award
of degree of Bachelor of Technology in Electronics and Communication Engineering.

We further declare that this project work has not been submitted in full or part
for the award of any other degree in any other educational institutions.

M.BHAVYA SRI (21JR5A0409)

I.HARSHITHA (20JR1A0469)

J.LAHARI (20JR1A0470)
ACKNOWLEDGEMENT

We would like to express our profound gratitude towards Mr.K.Rama Krishna,


Department of ELECTRONICS AND COMMUNICATION ENGINEERING, who
played a supervisory role to utmost perfection, Enabled us to seek through our IV-II
B.Tech main project and for guidance as an internal guide methodically and
meticulously.
We express our gratitude towards all the faculty members and non-teaching
faculty members, the Department of ELECTRONICS&COMMUNICATION
ENGINEERING.
We are highly indebted to Dr. N.Adi Narayana, Head of the Department,
Electronics and Communication Engineering for providing us with all the necessary
support.
We render our deep sense of gratitude to Dr. P. Babu, Principal and
Dr.K.Hari Babu, Director Academics for permitting us to carry out our main project
works. We would like to express our sincere thanks to Electronics & Communication
Engineering staff for lending us their time to help us complete the work successfully.
We are very much thankful to the college management for their continuous
support and the facilities provided. We would also like to thank our staff, parents, and
friends for their enduring encouragement and assistance whenever required.

M.BHAVYA SRI (21JR5A0409)

I.HARSHITHA (20JR1A0469)

J. LAHARI (20JR1A0470)
INSTITUTE VISION AND MISSION

INSTITUTION VISION

 To produce eminent and ethical Engineers and Managers for society by


imparting quality professional education with an emphasis on human values
and holistic excellence.

INSTITUTION MISSION

 To incorporate benchmarked teaching and learning pedagogies in the


curriculum.
 To ensure the all-around development of through a judicious blend of
curricular, and extra-curricular activities.
 To support the cross-culture exchange of knowledge between industry and
academy.
 To provide higher/continued education and research opportunities to the
employees of the institution.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

VISION OF THE DEPARTMENT


 To develop high qualitative, technically component and socially responsible
Engineers.

MISSION OF THE DEPARTMENT

To provide quality education in the domain of Electronics and Communication


Engineering through

 Enriched curriculum for addressing the needs of industry and society.

 Effective teaching learning processes through congenial environment for life


long learning.

 Gaining contemporary knowledge through research and development, innovation


and incubation.
Program Specific Outcomes (PSOs)

PSO1: Professional Skills:


Apply Electronics Communications, VLSI, Embedded systems knowledge to
arrive cost effective and appropriate solutions.

PSO2: Problem-solving skills:


Able to provide solutions and design Semiconductor Devices, Digital Systems,
Microprocessor and Signal processing for the field of Consumer Electronics, Medical,
defense and space craft Electronics industry.

PSO3: Successful career:


Able to use latest hardware and software tools like VHDL, MATLAB, MULTISIM,
MENTOR GRAPHICS along with analytical skills.

PSO4: Exposure for research and development:


To analyze latest trends in Communication and apply the knowledge for the
improvement in the present technology by doing research through higher education.

Head of the Department.


Program Educational Objectives (PEOs)

Graduates of Electronics & Communication Engineering Shell


PEO1: Develop a strong background in basic science and mathematics and ability to use
these tools in their chosen fields of specialization.

PEO2: Have the ability to demonstrate technical competence in the fields of electronics
and communication engineering and develop solutions to the problems.

PEO3: Attain professional competence through life-long learning such as advanced


degrees, professional registration, and other professional activities.

PEO4: Function effectively in a multi-disciplinary environment and individually, within


a global, societal, and environmental context.

PEO5: Take individual responsibility and to work as a part of a team towards the
fulfillment of both individual and organizational goals.

Head of the Department.


PROGRAM OUTCOMES (POS)

1. Engineering knowledge: Apply the knowledge of mathematics, science,


engineering fundamentals, and an engineering specialization to the solution of
complex engineering problems.

2. Problem analysis: Identify, formulate, research literature, and analyze complex


engineering problems reaching substantiated conclusions using the first principles
of mathematics, natural sciences, and engineering sciences.

3. Design/development of solutions: Design solutions for complex engineering


problems and design system components or processes that meet the specified needs
with appropriate consideration for public health and safety, and cultural, societal,
and environmental considerations.

4. Conduct investigations of complex problems: Use research-based knowledge and


research methods including design of experiments, analysis and interpretation of
data, and synthesis of the information to provide valid conclusions.

5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.

6. The engineer and society: Apply reasoning informed by the contextual knowledge
to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.

7. Environment and sustainability: Understand the impact of professional engineering


solutions in societal and environmental contexts, and demonstrate the knowledge of,
and need for sustainable development.

8. Ethics: Apply ethical principles and commit to professional ethics and


responsibilities and norms of the engineering practice.

9. Individual and team work: Function effectively as an individual, and as a member


or leader in diverse teams, and in multidisciplinary settings.

10. Communication: Communicate effectively on complex engineering activities with


the engineering community and with society at large, such as being able to
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.

11. Project management and finance: Demonstrate knowledge and understanding of


the engineering and management principles and apply these to one’s own work, as a
member and leader in a team, to manage projects and in multidisciplinary
environments.

12. Life-long learning: Recognize the need for, and have the preparation and ability
engage in independent and life-long learning in the broadest context of technological
change.
Course Outcomes (COS):

CO425.1: Analyze the System of Examinations and identify the


problem.

CO425.2: Identify and classify the requirements.

CO425.3: Review the related Literature.

CO425.4: Design and modularize the project.

CO2425.5: Construct, integrate, test and implement the project.

CO425.6: Prepare the project Documentation and present the report using
appropriate method.

Course Outcomes - Program Outcomes mapping

1 2 3 4 5 6 7 8 9 10 1 1 PSO1 PSO2 PSO3


1 2
CO221.1 1 3 2 2 3
CO221.2 3 2 3 3 2
CO221.3 3 2 2 3 2 1
CO221.4 2 3 2 2 1 1 2 3 2
CO221.5 2 2 2 2 2

CO221.6 1 2 3 2 2 2 3

3: High 2: Medium 1: Low

Program Educational Objectives – Program Specific


Outcomes correlation

PSO1 PSO2 PSO3


PEO1 2 1 3
PEO2 3 2
PEO3 1 3
PEO4 3 2
PEO5 1 3 2

3:High 2: Medium 1: Low


CO-PO Mapping with Reasons:

1. CO425.1 is mapped with PO1, PO2 and PO4, PO6, PO7 as basic knowledge of
Engineering and problem Analysis activities are highly essential to conduct
examinations on existing systems which have been using in industries as a part of and to
define the problem of proposed system.

2. CO425.2 is mapped with POI, PO2, PO4 and PO6, PO9, PO10, PO11 as for
identification, gathering analysis and classification of requirements for the proposed
system, basic knowledge of engineering and Analysis steps along with complex problem
analysis through the efforts of team work in order to meet the specific needs of the
customer.

3. CO425.3 is mapped with PO2, POS and PO12 as to conduct the literature review and
to examine the relevant systems to understand and identify the merits and demerits of
each to enhance and develop the proposed as per the need.

4. CO425.4 is mapped with POI, PO2, PO3, PO4, POS and PO7, POS, PO9, PO10
because modularization and design of the project is needed after requirements
elicitation. For modularization and design of the project, Basic knowledge of
Engineering. Analysis capabilities, Design skills and communication is needed between
team members as different modules are designed individually before integration.

5. CO425.5 is mapped with PO3, POS, PO7, PO9, PO11 and PO12 as to construct the
project latest technologies are needed. The development of project is done individually
and in groups with well-defined communication by using the engineering and
management principles.

6. CO425.6 is mapped with PO6, PO10 and PO12 because during and after completion
of the project, documentation is needed along with proper methods of presentation
through understanding and application of engineering and management principles,
which in turn needs well defined communication between the team members with all the
ethical values. Even the project development team defines the future enhancements as a
part of the project development after identifying the scope of the project.
CO-PSOs Mapping with Reasons:

1. CO425.1 is mapped with PSO1 as examining of existing systems and identification of


the problem is a part of Application Development activity and identification of
evolutionary changes in latest technologies.

2. CO425.2 is mapped with PSO1, PSO2 and PSO3as identifying and classifying the
requirements is a part of Application development and evolutionary computing changes
and also follows ethical principles.

3. CO425.3 is mapped with PSO1, PSO3 as review of literature is a part of application


development activity by recognizing the computing technologies and their evolutionary
changes.

4. CO425.4 is mapped with PSOI, PSO3 because modularization and logical design is
also a part of Application development and follows computing changes using Deep
learning technology.

5. CO425.5 is mapped with PSO1, PSO2 as Testing, Development and Integration of


project activities are part of Application development and follows ethical principles.

6. CO425.6 is mapped with PSO2 as for project documentation and presentation; the
project team members apply the professional and leadership qualities
ABSTRACT

The flood detection and alerting system utilizes Arduino and Node MCU as controllers,
with the latter serving as the Wi-Fi module for remote communication. The system
incorporates a raindrop sensor to monitor precipitation levels and categorize them into
three distinct stages: the anticipation of rain, light rain, and heavy rain. Additionally, a
DHT11 sensor measures temperature to provide supplementary environmental data.
Information gathered by these sensors is displayed in real-time on an LCD screen,
offering users immediate insights into weather conditions.

To mitigate the risks associated with flooding, the system features an innovative
mechanism for controlling barrage gates remotely. A motor connected to the Node
MCU serves as a proxy for these gates, enabling automated responses to varying flood
levels. Leveraging a server-based infrastructure, users can initiate gate operations from a
distance, thereby facilitating timely interventions to manage water flow and mitigate
flood-related damages. This integration of remote control capabilities enhances the
system's effectiveness in flood management and response, offering a proactive approach
to safeguarding communities against the adverse effects of inundation.

Keywords: Arduino, LCD, Rain drop sensor, DHT11 sensor, Ultrasonic sensor,
Node MCU
Chapter Title Page No.
No.
1 Introduction i

1.1 Introduction to flood detection system ii

1.2 Embedded System overview iii

1.3 Embedded System Hardware & Software iv

1.4 Combination of both hardware and software for embedded system

1.5 Applications

1.6 Implementation flow

2 Literature Survey

2.1 Introduction

2.2 Reviewing Current Flood detection & Management System

2.3 Potential Improvements

2.4 Conclusion

3 Designing of System
3.1 Existing System
3.2 Proposed System
3.3 Proposed System Block diagram

3.4 Advantages and Applications

4 Hardware Requirements

4.1 Arduino Description & Working

4.2 LCD Working

4.3 Node MCU Description & Working

4.4 DC Motor Working

4.5 Power Supply

4.6 Rectifier

4.7 Capacitors

4.8 Voltage Regulators


4.9 Buzzer Description & Working

4.10 Ultra Sonic Sensor Working

4.11 Rain drop Sensor Working

4.12 DTH Sensor Working

5 Software Requirements

5.1 Arduino IDE

5.2 Boot Loader Working

5.3 Embedded C

6 Testing and Result Analysis

6.1 Code

6.2 Result analysis

7 Conclusions and Future Scope

7.1 Conclusion

7.2 Future Scope

Bibliography
List of Figures
Figure.No. Label PageNo.

1.1 Overview of Embedded Systems

1.2 Block Diagram of Embedded System

2.1 Effects of Floods

3.1 Block Diagram of Proposed System

4.1.1 Micro Controller & Arduino

4.1.2 Pinout Configuration

4.1.3 Atmega 328 Micro Controller

4.2.1 Images of LCD displays

4.2.2 LCD Pin diagram

4.2.3 LCD Block diagram

4.3.1 Over View of Node MCU

4.6.1 Circuit of Rectifier

4.7.1 Capacitor

4.8.1 7085 Voltage Regulator with Pinout

4.9.1 Buzzer

4.10.1 Operation of Ultrasonic sensor

4.11.1 Rain Drop Sensor

4.12.1 DHT Sensor

5.1.1 Installation of IDE


5.1.2 Output visualization

5.1.3 Libraries Installation

5.1.4 Selection of Board

5.2.1 Boot Loader

6.2.1 Heavy Rain Condition

6.2.2 Light Rain at normal temperature

6.2.3 Potential flood Condition


CHAPTER-1
INTRODUCTION
INTRODUCTION

1.1 Introduction to Flood detection System

The "Flood Detection and Avoidance System" is a critical infrastructure designed to


monitor and respond to changing weather conditions, particularly those associated with
heavy rainfall and potential flooding. As climate change continues to exacerbate
extreme weather events, such as storms and floods, there is an urgent need for robust
systems capable of detecting and mitigating these hazards in real-time. This project aims
to address this challenge by leveraging advanced sensor technologies and remote
communication capabilities to provide timely warnings and facilitate proactive flood
management strategies.

At the core of this system are Arduino and Node MCU microcontrollers, which serve as
the brains of the operation. The Arduino board is responsible for interfacing with
various sensors, including the raindrop sensor and DHT11 temperature sensor, to collect
crucial environmental data. Meanwhile, the Node MCU module enables wireless
connectivity via Wi-Fi, allowing the system to transmit information to remote servers
and receive commands for automated responses. This combination of hardware
components forms the foundation for building an intelligent flood detection and alerting
system capable of monitoring weather conditions and taking proactive measures to
mitigate flood risks.

The implementation of this project entails the deployment of sensors in flood-prone


areas, such as riverbanks and low-lying regions susceptible to water overflow. These
sensors continuously monitor rainfall intensity and temperature fluctuations, providing
real-time data that is analyzed by the system's onboard microcontrollers. Through the
integration of an LCD display, users can access up-to-date information on weather
conditions and flood risk levels, enabling informed decision-making and timely
interventions. Additionally, the system's ability to remotely control barrage gates adds
an extra layer of sophistication, allowing authorities to manage water flow and minimize
flood damage in vulnerable areas. Overall, the Flood Detection and Alerting System
represents a proactive approach to disaster management, leveraging IoT technology to
enhance resilience and protect communities from the devastating impacts of flooding.
1.2 Embedded system implementation

1.2.1 Introduction:

An embedded system is one kind of a computer system mainly designed to perform


several tasks like to access, process, and store and also control the data in various
electronics-based systems. Embedded systems are a combination of hardware and
software where software is usually known as firmware that is embedded into the
hardware. One of its most important characteristics of these systems is, it gives the o/p
within the time limits. Embedded systems support to make the work more perfect and
convenient. So, we frequently use embedded systems in simple and complex devices
too. The applications of embedded systems mainly involve in our real life for several
devices like microwave, calculators, TV remote control, home security and
neighborhood traffic control systems, etc.

User interface

Embedded system

Software Hardware

Inputs
Output

Link to other systems

Fig 1.1: Overview of embedded system


1.3 Embedded system:
Embedded system includes mainly two sections, they are

1. Hardware
2. Software

Input devices interfacing

and driver circuits

Timers Memory

Power
Application
supply and Processor Serial specific
oscillator communication circuits
circuits ports

Interrupt Parallel
controller ports

Output devices interfacing

Fig 1.2 Block diagram of embedded system


1.3.1 Embedded System Hardware:

As with any electronic system, an embedded system requires a hardware platform on


which it performs the operation. Embedded system hardware is built with a
microprocessor or microcontroller. The embedded system hardware has elements like
input output (I/O) interfaces, user interface, memory and the display. Usually, an
embedded system consists of:

 Power Supply
 Processor
 Memory
 Timers
 Serial communication ports
 Output/Output circuits
 System application specific circuits

Embedded systems use different processors for its desired operation. Some of the
processors used are

1. Microprocessor

2. Microcontroller

3. Digital signal processor

Microprocessor vs. Microcontroller

Microprocessor

• CPU on a chip.
• We can attach required amount of ROM, RAM and I/O ports.
• Expensive due to external peripherals.
• Large in size
• general-purpose
Microcontroller

• Computer on a chip
• fixed amount of on-chip ROM, RAM, I/O ports
• Low cost.
• Compact in size.
• Specific –purpose

1.3.2 Embedded System Software:

The embedded system software is written to perform a specific function. It is typically


written in a high level format and then compiled down to provide code that can be
lodged within a non-volatile memory within the hardware. An embedded system
software is designed to keep in view of the three limits:

 Availability of system memory


 Availability of processor’s speed
 When the system runs continuously, there is a need to limit power dissipation for
events like stop, run and wake up.

1.4 Bringing software and hardware together for embedded system:

To make software to work with embedded systems we need to bring software


and hardware together. For this purpose we need to burn our source code into
microprocessor or microcontroller which is a hardware component and which takes care
of all operations to be done by embedded system according to our code.

Generally we write source codes for embedded systems in assembly language, but the
processors run only executable files. The process of converting the source code
representation of your embedded software into an executable binary image involves
three distinct steps:

Each of the source files must be compiled or assembled into an object file.
1. All of the object files that result from the first step must be linked together to
produce a single object file, called the re-locatable program.
2. Physical memory addresses must be assigned to the relative offsets within the re-
locatable program in a process called relocation.

The result of the final step is a file containing an executable binary image that is ready
to run on the embedded system.

Source code

Assembler

Linker

Locator

Executable file

Processor

Fig 1.3 Flow of burning source code to processor


1.5 Applications:

Embedded systems have different applications. A few select applications of embedded


systems are smart cards, telecommunications, satellites, missiles, digital consumer
electronics, computer networking, etc.

Embedded Systems in Automobiles

 Motor Control System


 Engine or Body Safety
 Robotics in Assembly Line
 Mobile and E-Com Access

Embedded systems in Telecommunications

 Mobile computing
 Networking
 Wireless Communications

Embedded Systems in Smart Cards

 Banking
 Telephone
 Security Systems

1.6 Implementation flow:

Stage 1: Considering the problems of existing methods and giving solution to that
problem by considering the basic requirements for our proposed system

Stage 2:

Considering the hardware requirement for the proposed system

For this we need to select the below components:

1. Microcontroller
2. Inputs for the proposed system (ex: sensors, drivers etc..,)

3. Outputs (ex: relays, loads)

Stage 3:

After considering hardware requirements, now we need to check out the software requirements.
Based on the microcontroller we select there exists different software for coding, compiling,
debugging. we need to write source code for that proposed system based on our requirements
and compile, debug the code in that software .

After completing all the requirements of software and hardware we need to bring both
together to work our system. For this we need to burn our source code into microcontroller, after
burning our source code to microcontroller then connect all input and output modules as per our
requirement.
CHAPTER-2
LITERATURE SURVEY
2.1 Introduction:
Flood detection and avoidance systems play a crucial role in mitigating the adverse
effects of floods, which can cause significant damage to life and property. Over the
years, various techniques and technologies have been developed and explored in the
realm of flood detection and avoidance. Remote sensing techniques, including satellite
imagery and aerial surveys, have been widely used for early flood detection by
monitoring changes in water levels and identifying flood-prone areas. Additionally,
sensor networks deployed in rivers, streams, and urban areas provide real-time data on
water levels, rainfall intensity, and weather conditions, aiding in timely flood warnings
and evacuation strategies. Machine learning and data analytics techniques are
increasingly being integrated into flood detection systems to improve accuracy and
predictive capabilities based on historical data patterns.

Furthermore, the adoption of Internet of Things (IoT) devices and smart infrastructure
enables automated responses such as activating flood barriers, redirecting traffic, and
managing water flow to minimize flood impacts. Research in this field continues to
focus on enhancing the precision, scalability, and resilience of flood detection and
avoidance systems through interdisciplinary collaborations between engineers,
environmental scientists, and policymakers.
In recent literature, there has been a growing emphasis on integrating advanced
technologies such as artificial intelligence (AI) and unmanned aerial vehicles (UAVs)
into flood detection and avoidance systems.

AI algorithms, particularly deep learning models like convolutional neural networks


(CNNs) and recurrent neural networks (RNNs), are being employed to analyze satellite
images, radar data, and social media feeds for rapid flood mapping, damage assessment,
and resource allocation during emergencies. UAVs equipped with high-resolution
cameras and LiDAR sensors are utilized for detailed aerial surveys, enabling the
creation of accurate digital elevation models (DEMs) and flood risk maps for vulnerable
areas. Furthermore, the emergence of blockchain technology is being explored for
developing decentralized flood monitoring and early warning systems, ensuring data
integrity, transparency, and real-time sharing among stakeholders. Collaborative efforts
between academia, industry, and government agencies are driving innovation in flood
detection and avoidance systems, with a focus on resilience, adaptability, and
community engagement to enhance disaster preparedness and response capabilities.
2.2 Reviewing Current Flood Detection and Management System:
Recent advancements in flood detection and avoidance systems have also leveraged the
power of big data analytics and cloud computing. Big data analytics techniques process
large volumes of heterogeneous data sources, including weather forecasts, hydrological
models, social media feeds, and historical flood data, to generate accurate predictions
and real-time insights. Cloud computing platforms provide scalable and cost-effective
infrastructure for storing and processing such vast amounts of data, enabling rapid
decision-making and coordination among stakeholders during flood events.

Moreover, the integration of Geographic Information Systems (GIS) and simulation


models has enhanced flood risk assessment and management strategies. GIS tools enable
spatial analysis, visualization of flood-prone areas, and simulation of flood scenarios
based on different variables such as land use, soil type, and drainage systems. Coupling
GIS with hydraulic and hydrological models allows for simulating flood propagation,
evaluating flood impact on infrastructure and communities, and optimizing emergency
response plans.

2.3 Potential Improvements:


In addition to technological innovations, community-based approaches and citizen
science initiatives are gaining prominence in flood detection and avoidance. Engaging
local communities, leveraging crowd-sourced data, and incorporating indigenous
knowledge can improve the accuracy of flood early warning systems and foster
community resilience. Public awareness campaigns, training programs, and participatory
mapping exercises empower communities to take proactive measures, such as building
flood-resistant structures, developing evacuation plans, and preserving natural
floodplains, contributing to sustainable flood risk reduction strategies.

Overall, the literature reflects a multifaceted approach to flood detection and avoidance,
integrating cutting-edge technologies, data-driven insights, community participation,
and policy interventions to build more robust and adaptive flood resilience frameworks
at local, regional, and global scales. Ongoing research and collaborations across
disciplines continue to drive innovation and enhance the effectiveness of flood risk
management strategies in the face of climate change and urbanization challenges.
2.4 Conclusion :
In conclusion, the literature survey on flood detection and avoidance systems highlights
a diverse range of approaches and technologies aimed at mitigating the impact of floods.
From traditional sensor-based systems to advanced machine learning algorithms and
remote sensing techniques, researchers and engineers have made significant strides in
improving early detection, accurate prediction, and effective mitigation strategies.
However, challenges such as data accuracy, real-time response, and integration with
existing infrastructure remain areas for further research and development. As technology
continues to evolve, interdisciplinary collaboration and innovation will be key in
developing robust and scalable flood detection and avoidance systems that can
effectively protect lives and property in flood-prone areas.

1. Integration of IoT and Big Data: The integration of Internet of Things (IoT) devices
and Big Data analytics has shown promise in enhancing the capabilities of flood
detection systems. Real-time data collection, analysis, and decision-making can lead to
more proactive and effective responses to flood events.

2. Role of Remote Sensing: Remote sensing technologies, including satellite imagery


and aerial drones, have been utilized for flood mapping, monitoring, and assessment.
These technologies provide valuable spatial and temporal information that can aid in
early warning systems and disaster management planning.

3. Community Engagement and Resilience: Building community resilience is an integral


part of flood avoidance systems. Community engagement, public awareness campaigns,
and participatory approaches can improve preparedness, response, and recovery efforts
during flood events.

4. Sustainability and Environmental Considerations: As we develop flood detection and


avoidance systems, it's important to consider their environmental impact and
sustainability. Sustainable infrastructure designs, green technologies, and ecosystem-
based approaches can help mitigate flooding while minimizing negative environmental
consequences.

5. Future Directions and Emerging Technologies: The literature survey highlights the
need for ongoing research into emerging technologies such as artificial intelligence,
blockchain, and autonomous systems for more advanced flood detection and avoidance
capabilities. Future efforts should also focus on interdisciplinary collaborations, policy
interventions, and risk communication strategies to address the complex challenges
posed by floods.
Fig 2.1 Effects of Floods
CHAPTER – 3
DESIGING OF SYSTEM
3.1 EXISTING SYSTEM

The existing method of flood detection and alerting typically relies on manual
monitoring and observation by local authorities or weather stations. This approach
involves periodic checks of rainfall levels using traditional rain gauges and visual
inspections of water levels in rivers and streams. However, these methods are often
labor-intensive, time-consuming, and prone to delays in data collection and analysis.
Moreover, they may not provide comprehensive coverage of all flood-prone areas,
leading to gaps in early warning systems. Additionally, traditional flood detection
methods may lack the ability to integrate real-time data from multiple sources or
communicate alerts rapidly to affected communities. As a result, there is a need for more
advanced and automated flood monitoring systems capable of leveraging IoT
technology to improve accuracy, efficiency, and timeliness in detecting and responding
to flood events.

Drawbacks:

1. Manual Monitoring:

2. Limited Coverage:

3. Time-Consuming:

4. Delayed Response:

5. Lack of Integration:
3.2 PROPOSED SYSTEM

The proposed method of the flood detection and alerting system aims to address the
limitations of the existing manual monitoring approach. In this method, Arduino and
NodeMCU are utilized as the primary controllers, offering enhanced automation and
real-time data processing capabilities. Raindrop sensors are strategically deployed to
detect varying levels of rainfall intensity, categorized into three levels: light rain,
moderate rain, and heavy rain. Additionally, a DHT11 sensor is employed to measure
temperature fluctuations, providing supplementary environmental data.

To enhance the system's functionality, a Wi-Fi module is integrated with Node MCU,
enabling seamless communication and data transmission to remote servers or cloud
platforms. This connectivity facilitates real-time monitoring of rainfall and temperature
conditions, enabling timely responses to potential flood situations. Moreover, an LCD
display is incorporated to provide visual feedback on the detected rain intensity and
temperature levels, ensuring transparency and accessibility of information to users.
Furthermore, an innovative aspect of the proposed method involves the integration of a
motor with Node MCU, representing gate control mechanisms during flood scenarios.
This enables remote operation of flood barriers or gates based on the detected rainfall
levels, enhancing the system's responsiveness and effectiveness in flood management.
3.3 Block Diagram:

Fig 3.1 Block Diagram


3.4.1 ADVANTAGES:
1. Enhanced Automation

2. Real-time Data Processing

3. Remote Monitoring Capability

4. Timely Response to Flood Situations

5. Improved Flood Management

3.4.2 APPLICATIONS

1. Early Warning Systems: The flood detection and alerting system can be
deployed in areas prone to floods, providing early warnings to residents and
authorities, allowing them to take preventive measures such as evacuations and
deploying emergency response teams.
2. Agricultural Monitoring: Farmers can utilize the system to monitor rainfall levels
and soil moisture, helping them make informed decisions about irrigation
scheduling and crop management practices, thereby optimizing agricultural
productivity.
3. Urban Infrastructure Management: Municipalities can integrate the system into
their urban infrastructure management to monitor water levels in drainage
systems, sewage networks, and reservoirs, enabling proactive measures to
prevent urban flooding and infrastructure damage.
4. Environmental Monitoring: Environmental agencies can deploy the system to
monitor river water levels, rainfall patterns, and soil moisture content in
environmentally sensitive areas, facilitating ecosystem conservation and
protection.
5. Disaster Risk Reduction: The system can contribute to disaster risk reduction
efforts by providing real-time data on flood conditions, helping disaster
management agencies coordinate response efforts, allocate resources efficiently,
and mitigate the impact of flooding on communities.
6. Industrial Safety: Industries located in flood-prone areas can utilize the system to
monitor water levels around their facilities, triggering automated shutdown
procedures or evacuation protocols to ensure employee safety and prevent
damage to equipment and infrastructure.
7. Transportation Management: Transportation authorities can deploy the system
along roadways, bridges, and tunnels to monitor water levels during heavy
rainfall events, enabling them to close affected routes promptly and reroute
traffic to prevent accidents and delays.
8. Infrastructure Planning: Urban planners and engineers can use historical flood
data collected by the system to inform infrastructure planning and design,
ensuring that new developments are resilient to flood risks and incorporate
sustainable drainage systems.
9. Emergency Response Coordination: Emergency response agencies can integrate
the system into their operations centers to receive real-time alerts and updates on
flood conditions, facilitating rapid deployment of resources and coordination of
rescue efforts during emergencies.
10. Research and Education: Academic institutions and research organizations can
use the data collected by the system for scientific studies on flood dynamics,
hydrology, and climate change impacts, advancing knowledge in these fields and
educating future generations about flood risk management strategies.
CHAPTER-4
HARDWARE DESCRIPTION
HARDWARE REQUIREMENTS
4.1 Arduino:

Arduino Uno is a very valuable addition in the electronics that consists of USB
interface, 14 digital I/O pins, 6 analog pins, and Atmega328 microcontroller. It also
supports serial communication using Tx and Rx pins.
There are many versions of Arduino boards introduced in the market like Arduino Uno,
Arduino Due, Arduino Leonardo, Arduino Mega, however, most common versions are
Arduino Uno and Arduino Mega. If you are planning to create a project relating to
digital electronics, embedded system, robotics, or IoT, then using Arduino Uno would
be the best, easy and most economical option.

Fig 4.1.1 Types of Arduino Board

It is an open-source platform, means the boards and software are readily available and
anyone can modify and optimize the boards for better functionality.

The software used for Arduino devices is called IDE (Integrated Development
Environment) which is free to use and required some basic skills to learn it. It can be
programmed using C and C++ language.

Some people get confused between Microcontroller and Arduino. While former is just
an on system 40 pin chip that comes with a built-in microprocessor and later is a board
that comes with the microcontroller in the base of the board, bootloader and allows easy
access to input-output pins and makes uploading or burning of the program very easy.

Fig. 4.1.1 Microcontroller & Arduino

While learning microcontroller requires some expertise and skills.

Nevertheless, we can say every Arduino is basically a microcontroller but not every
microcontroller is an Arduino.

4.1.1 Introduction to Arduino

 Arduino Uno is a microcontroller board developed by Arduino.cc which is an open-


source electronics platform mainly based on AVR microcontroller Atmega328.

 First Arduino project was started in Interaction Design Institute Ivrea in 2003 by
David Cuartielles and Massimo Banzi with the intention of providing a cheap and
flexible way to students and professional for controlling a number of devices in the
real world.

 The current version of Arduino Uno comes with USB interface, 6 analog input pins,
14 I/O digital ports that are used to connect with external electronic circuits. Out of
14 I/O ports, 6 pins can be used for PWM output.

 It allows the designers to control and sense the external electronic devices in the real
world
Fig 4.1.2 Pin out Configuration

 This board comes with all the features required to run the controller and can be
directly connected to the computer through USB cable that is used to transfer the
code to the controller using IDE (Integrated Development Environment) software,
mainly developed to program Arduino. IDE is equally compatible with Windows,
MAC or Linux systems, however, Windows is preferable to use. Programming
languages like C and C++ are used in IDE.

 Apart from USB, battery or AC to DC adopter can also be used to power the board.

 Arduino Uno boards are quite similar to other boards in Arduino family in terms of
use and functionality, however, Uno boards don’t come with FTDI USB to Serial
driver chip.

 There are many versions of Uno boards available, however, Arduino Nano V3 and
Arduino Uno are the most official versions that come with Atmega328 8-bit AVR
Atmel microcontroller where RAM memory is 32KB.

 When nature and functionality of the task go complex, Mirco SD card can be added
in the boards to make them store more information.

4.1.2 Features of Arduino

 Arduino Uno comes with USB interface i.e. USB port is added on the board to
develop serial communication with the computer.
 Atmega328 microcontroller is placed on the board that comes with a number of
features like timers, counters, interrupts, PWM, CPU, I/O pins and based on a
16MHz clock that helps in producing more frequency and number of instructions
per cycle.
Fig 4.1.3

 It is an open source platform where anyone can modify and optimize the board based
on the number of instructions and task they want to achieve.

 This board comes with a built-in regulation feature which keeps the voltage under
control when the device is connected to the external device.

 Reset pin is added in the board that reset the whole board and takes the running
program in the initial stage. This pin is useful when board hangs up in the middle of
the running program; pushing this pin will clear everything up in the program and
starts the program right from the beginning.

 There are 14 I/O digital and 6 analog pins incorporated in the board that allows the
external connection with any circuit with the board. These pins provide the flexibility
and ease of use to the external devices that can be connected through these pins.
There is no hard and fast interface required to connect the devices to the board.
Simply plug the external device into the pins of the board that are laid out on the
board in the form of the header.

 The 6 analog pins are marked as A0 to A5 and come with a resolution of 10bits. These
pins measure from 0 to 5V, however, they can be configured to the high range
using analogReference() function and AREF pin.
 13KB of flash memory is used to store the number of instructions in the form of code.

 Only 5 V is required to turn the board on, which can be achieved directly using USB
port or external adopter, however, it can support external power source up to 12 V
which can be regulated and limit to 5 V or 3.3 V based on the requirement of the
project.

4.1.3 Arduino Pinout

 Arduino Uno is based on AVR microcontroller called Atmega328. This


controller comes with 2KB SRAM, 32KB of flash memory, 1KB of EEPROM.
Arduino Board comes with 14 digital pins and 6 analog pins. ON-chip ADC is
used to sample these pins. A 16 MHz frequency crystal oscillator is equipped on
the board. Following figure shows the pinout of the Arduino Uno Board

Fig 4.1.5 Arduino Uno Pinout

Pin Description:

There are several I/O digital and analog pins placed on the board which operates at 5V.
These pins come with standard operating ratings ranging between 20mA to 40mA.
Internal pull-up resistors are used in the board that limits the current exceeding from the
given operating conditions. However, too much increase in current makes these resisters
useless and damages the device.
LED. Arduino Uno comes with built-in LED which is connected through pin 13.
Providing HIGH value to the pin will turn it ON and LOW will turn it OFF.
Vin. It is the input voltage provided to the Arduino Board. It is different than 5 V
supplied through a USB port. This pin is used to supply voltage. If a voltage is provided
through power jack, it can be accessed through this pin.
5V. This board comes with the ability to provide voltage regulation. 5V pin is used to
provide output regulated voltage. The board is powered up using three ways i.e. USB,
Vin pin of the board or DC power jack.
USB supports voltage around 5V while Vin and Power Jack support a voltage ranges
between 7V to 20V. It is recommended to operate the board on 5V. It is important to
note that, if a voltage is supplied through 5V or 3.3V pins, they result in bypassing the
voltage regulation that can damage the board if voltage surpasses from its limit.

GND. These are ground pins. More than one ground pins are provided on the board
which can be used as per requirement.
Reset. This pin is incorporated on the board which resets the program running on the
board. Instead of physical reset on the board, IDE comes with a feature of resetting the
board through programming.
IOREF. This pin is very useful for providing voltage reference to the board. A shield is
used to read the voltage across this pin which then select the proper power source.
PWM. PWM is provided by 3, 5, 6,9,10, 11pins. These pins are configured to provide
8-bit output PWM.
SPI. It is known as Serial Peripheral Interface. Four pins 10(SS), 11(MOSI), 12(MISO),
13(SCK) provide SPI communication with the help of SPI library.
AREF. It is called Analog Reference. This pin is used for providing a reference voltage
to the analog inputs.
TWI. It is called Two-wire Interface. TWI communication is accessed through Wire
Library. A4 and A5 pins are used for this purpose.
Serial Communication. Serial communication is carried out through two pins called
Pin 0 (Rx) and Pin 1 (Tx).
Rx pin is used to receive data while Tx pin is used to transmit data.

External Interrupts. Pin 2 and 3 are used for providing external interrupts. An interrupt
is called by providing LOW or changing value.
4.1.4 Arduino Uno Technical Specifications

Microcontroller ATmega328P – 8 bit AVR family microcontroller

Operating Voltage 5V

Recommended InputVoltage 7-12V

Input Voltage Limits 6-20V

Analog Input Pins 6 (A0 – A5)

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

DC Current on I/O Pins 40 Ma

DC Current on 3.3V Pin 50 mA

Flash Memory 32 KB (0.5 KB is used for Bootloader)

SRAM 2 KB

EEPROM 1 KB

Frequency (Clock Speed) 16 MHz

Communication and Programming:

Arduino Uno comes with an ability of interfacing with other other Arduino boards,
microcontrollers and computer. The Atmega328 placed on the board provides serial
communication using pins like Rx and Tx.

The Atmega16U2 incorporated on the board provides a pathway for serial


communication using USB com drivers. Serial monitor is provided on the IDE software
which is used to send or receive text data from the board. If LEDs placed on the Rx and
Tx pins will flash, they indicate the transmission of data.
Arduino Uno is programmed using Arduino Software which a cross-platform
application called IDE is written in Java. The AVR microcontroller Atmega328 laid out
on the base comes with built-in boot loader that sets you free from using a separate
burner to upload the program on the board.

Fig 4.1.6 Communication & Programming

4.1.5 Applications:

Arduino Uno comes with a wide range of applications. A larger number of people are
using Arduino boards for developing sensors and instruments that are used in scientific
research. Following are some main applications of the board.

 Embedded System

 Security and Defense System

 Digital Electronics and Robotics

 Parking Lot Counter

 Weighing Machines

 Traffic Light Count Down Timer

 Medical Instrument

 Emergency Light for Railways

 Home Automation

 Industrial Automation

There are a lot of other microcontrollers available in the market that are more powerful
and cheap as compared to Arduino board. So, why you prefer Arduino Uno?
Actually, Arduino comes with a big community that is developing and sharing the
knowledge with a wide range of audience. Quick support is available pertaining to
technical aspects of any electronic project. When you decide Arduino board over other
controllers, you don’t need to arrange extra peripherals and devices as most of
the functions are readily available on the board that makes your project economical in
nature and free from a lot of technical expertise.

4.2 LCD:

LCD (Liquid Crystal Display) is the innovation utilized in scratch pad shows and other
littler PCs. Like innovation for light-producing diode (LED) and gas-plasma, LCDs
permit presentations to be a lot more slender than innovation for cathode beam tube
(CRT). LCDs expend considerably less power than LED shows and gas shows since
they work as opposed to emanating it on the guideline of blocking light.

A LCD is either made with a uninvolved lattice or a showcase network for dynamic
framework show. Likewise alluded to as a meager film transistor (TFT) show is the
dynamic framework LCD. The uninvolved LCD lattice has a matrix of conductors at
every crossing point of the network with pixels. Two conductors on the lattice send a
current to control the light for any pixel. A functioning framework has a transistor
situated at every pixel crossing point, requiring less current to control the luminance of a
pixel.

Some aloof network LCD's have double filtering, which implies they examine the
matrix twice with current in the meantime as the first innovation took one sweep.
Dynamic lattice, be that as it may, is as yet a higher innovation.

A 16x2 LCD show is an essential module that is generally utilized in various gadgets
and circuits. These modules more than seven sections and other multi fragment LEDs
are liked. The reasons being: LCDs are affordable; effectively programmable; have no
restriction of showing exceptional and even custom characters (not at all like in seven
fragments), movements, etc.

A 16x2 LCD implies 16 characters can be shown per line and 2 such lines exist. Each
character is shown in a lattice of 5x7 pixels in this LCD. There are two registers in this
LCD, in particular Command and Data.
The directions given to the LCD are put away by the order register. An order is a
direction given to LCD to play out a predefined assignment, for example, introducing it,
clearing its screen, setting the situation of the cursor, controlling presentation, and so
forth. The information register will store the information that will be shown on the LCD.
The information is the character's ASCII incentive to show on the LCD.

4.2.1 Data/Signals/Execution of LCD

Now that was all about the signals and the hardware. Let us come to data, signals and
execution.

Two types of signals are accepted by LCD, one is data and one is control. The LCD
module recognizes these signals from the RS pin status. By pulling the R / W pin high,
data can now also be read from the LCD display. Once the E pin has been pulsed, the
LCD display reads and executes data at the falling edge of the pulse, the same for the
transmission case.

It takes 39-43μS for the LCD display to place a character or execute a command. It takes
1.53ms to 1.64ms except for clearing display and searching for cursor to the home
position.

Any attempt to send data before this interval may result in failure in some devices to
read data or execute the current data. Some devices compensate for the speed by storing
some temporary registers with incoming data.

There are two RAMs for LCD displays, namely DDRAM and CGRAM. DDRAM
registers the position in which the character would be displayed in the ASCII chart.
Each DDRAM byte represents every single position on the display of the LCD.

The DDRAM information is read by the LCD controller and displayed on the LCD
screen. CGRAM enables users to define their personalized characters. Address space is
reserved for users for the first 16 ASCII characters.

Users can easily display their custom characters on the LCD screen after CGRAM has
been set up to display characters.
4.2.1 Images of LCD Display:-

Fig 4.2.1 LCD – Front View

Fig 4.2.2 LCD – Back View

4.2.3 Pin Diagram:

Fig 4.2.2 Pin Diagram


Pin Description:

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

RS (Register select)

A 16X2 LCD has two order and information registers. The determination of the register
is utilized to change starting with one register then onto the next. RS=0 for the register
of directions, while RS=1 for the register of information.

Command Register

The guidelines given to the LCD are put away by the direction register. An order is a
direction given to LCD to play out a predefined assignment, for example, instating it,
clearing its screen, setting the situation of the cursor, controlling showcase, and so on.
Order preparing happens in the direction register.
Data Register:

The information register will store the information that will be shown on the LCD. The
information is the character's ASCII incentive to show on the LCD. It goes to the
information register and is prepared there when we send information to the LCD. While
choosing RS=1, the information register.

Read and Write Mode of LCD:

As stated, the LCD itself comprises of an interface IC. This interface IC can be perused
or composed by the MCU. A large portion of the occasions we're simply going to keep
in touch with the IC since perusing will make it increasingly perplexing and situations
like that are exceptionally uncommon. Information such as cursor position, status
completion interrupts, etc. can be read if necessary.

4.2.4 LCD Commands:

There are some preset commands in the LCD that we need to send to the LCD via some
microcontroller. The following are some important command instructions:

SI.No. Hex Code Command to LCD instruction Register

1 01 Clear display screen

2 02 Return home

3 04 Decrement cursor (shift cursor to left)

4 06 Increment cursor (shift cursor to right)

5 05 Shift display right

6 07 Shift display left

7 08 Display off, cursor off

8 0A Display off, cursor on


9 0C Display on, cursor off

10 0E Display on, cursor blinking

11 0F Display on, cursor blinking

12 10 Shift cursor position to left

13 14 Shift cursor position to right

14 18 Shift the entire display to the left

15 1C Shift the entire display to the right

16 80 Force cursor to beginning ( 1st line)

17 C0 Force cursor to beginning ( 2nd line)

18 38 2 lines and 5×7 matrix

4.2.3 Block Diagram of LCD Display:-


4.2.6 Control and display commands

Instruc Instruction Code Instruction Execu


tion R R/ D D D D D D D D Code tion
S W B7 B6 B5 B4 B3 B2 B1 B0 Description time

Read 1 1 D7 D6 D5 D4 D3 D2 D1 D0 Read data 1.53-


Data from internal 1.64m
From RAM s
RAM
Write 1 0 D7 D6 D5 D4 D3 D2 D1 D0 Write data 1.53-
data to into internal 1.64m
RAM RAM s
(DDRAM/CG
RAM)
Busy 0 1 BF A A A A A A A Busy flag 39 µs
flag & C6 C5 C4 C3 C2 C1 C0 (BF: 1→
Addres LCD Busy)
s and contents
of address
counter in bits
AC6-AC0.
Set 0 0 1 A A A A A A A Set DDRAM 39 µs
DDRA C6 C5 C4 C3 C2 C1 C0 address in
M address
Addres counter.
s
Set 0 0 0 1 A A A A A A Set CGRAM 39 µs
CGRA C5 C4 C3 C2 C1 C0 Address in
M address
Addres counter.
s
Functio 0 0 0 0 1 D N F X X Set interface 39 µs
n Set L data length
(DL:
4bit/8bit),
Numbers of
display line
(N: 1-line/2-
line) display
font type
(F:0→ 5×8
dots, F:1→
5×11 dots)
Cursor 0 0 0 0 0 1 S/ R/ X X Set cursor 39 µs
or C L moving and
Display display shift
Shift control bit,
and the
direction
without
changing
DDRAM data
Display 0 0 0 0 0 0 1 D C B Set 39 µs
& Display(D),C
Cursor ursor(C) and
On/Off cursor
blink(b)
on/off control
Entry 0 0 0 0 0 0 0 1 I/ S Assign cursor 0µs
Mode D H moving
Set direction and
enable shift
entire display.
Return 0 0 0 0 0 0 0 0 1 X Set DDRAM 43µs
Home Address to
“00H” from
AC and return
cursor to its
original
position if
shifted.
Clear 0 0 0 0 0 0 0 0 0 1 Write “20H” 43µs
Display to DDRAM
and set
DDRAM
Address to
“00H” from
AC

4-bit and 8-bit Mode of LCD:

The LCD can work in two striking modes, the 4-bit mode and the 8-bit mode. We send
the information snack through snack in 4 bit mode, first upper chomp, by then lower
snack. For those of you who don't have the foggiest idea what a goody is: a chomp is a
four-piece gathering, so a byte's lower four bits (D0-D3) are the lower snack, while a
byte's upper four bits (D4-D7) are the higher snack.This enables us to send 8 bit
data.This connects with us to send 8 bit data.Whereas in 8 bit mode we can send the 8-
bit information truly in one stroke since we utilize all the 8 information lines.You need
to get it now; yes 8-bit mode is quicker and immaculate than 4-bit mode.In any case, the
fundamental shortcoming is that it needs 8 microcontroller-related information lines.
This will result in our MCU coming up short on I/O pins, so 4-bit mode is extensively
utilized. To set these modes, no control pins are used.

4.3 Node MCU:


The ESP8266 NodeMCU CP2102 board has ESP8266 which is a highly integrated chip
designed for the needs of a new connected world. It offers a complete and self-contained
Wi-Fi networking solution, allowing it to either host the application or to offload all Wi-
Fi networking functions from another application processor.

ESP8266 has powerful on-board processing and storage capabilities that allow it to be
integrated with the sensors and other application-specific devices through its GPIOs
with minimal development up-front and minimal loading during runtime. Its high degree
of on-chip integration allows for minimal external circuitry, and the entire solution,
including the front-end module, is designed to occupy minimal PCB area.

The ESP8266 NodeMCU development board – a true plug-and-play solution for


inexpensive projects using WiFi. The module arrives pre-flashed with NodeMCU
firmware so they’re ready to go – just install your USB driver (below). ESP-12 Lua
Nodemcu WIFI Dev Board Internet Of Things board contains a full ESP8266 WiFi
module with all the GPIO broken out, a full USB-serial interface, and a power supply all
on the one breadboard-friendly package.

This board is pre-flashed with NodeMCU – a Lua-based firmware for the ESP8266
which allows easy control via a neat scripting language – Lua – so you’re ready to go in
just a few minutes.

The ESP-12 Lua NodeMCU WIFI Dev Board Internet Of Things with ESP8266 is an
all-in-one microcontroller + WiFi platform that is very easy to use to create projects
with WiFi and IoT (Internet of Things) applications.

The board is based on the highly popular ESP8266 WiFi Module chip with the ESP-12
SMD footprint. This WiFi development board already embeds in its board all the
necessary components for the ESP8266 (ESP-12E) to program and upload code. It has a
built-in USB to serial chip upload codes, 3.3V regulator, and logic level converter
circuit so you can immediately upload codes and connect your circuits.

4.3.1 Features:

Open-source, Interactive, Programmable, Low cost, Simple, Smart, WI-FI enabled

Arduino-like hardware IO

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

Integrated PLL, regulators, DCXO and power management units

Onboard USB to serial chip to easily program and upload codes from the Arduino IDE

Embeds logic level converter circuits

Has onboard 3.3V regulator to ensure enough power to function as your go-to WiFi
chip!

Easy access to the GPIO pins for easy prototyping


ESP-12E Processor

Easy to use breadboard friendly form factor

Fig 4.3.1 Over View of Node MCU


4.4 DC MOTOR:

4.4.1 What is a DC Motor?

A direct current (DC) motor is a type of electric machine that converts electrical energy
into mechanical energy. DC motors take electrical power through direct current, and
convert this energy into mechanical rotation.

DC motors use magnetic fields that occur from the electrical currents generated, which
powers the movement of a rotor fixed within the output shaft. The output torque and
speed depends upon both the electrical input and the design of the motor.

4.4.2 How DC motors work?

The term ‘DC motor’ is used to refer to any rotary electrical machine that
converts direct current electrical energy into mechanical energy. DC motors
can vary in size and power from small motors in toys and appliances to large
mechanisms that power vehicles, pull elevators and hoists, and drive steel
rolling mills.

But how do DC motors work?

DC motors include two key components: a stator and an armature. The stator is the
stationary part of a motor, while the armature rotates. In a DC motor, the stator provides
a rotating magnetic field that drives the armature to rotate.

A simple DC motor uses a stationary set of magnets in the stator, and a coil of wire with
a current running through it to generate an electromagnetic field aligned with the centre
of the coil. One or more windings of insulated wire are wrapped around the core of the
motor to concentrate the magnetic field.

The windings of insulated wire are connected to a commutator (a rotary electrical


switch), that applies an electrical current to the windings. The commutator allows each
armature coil to be energised in turn, creating a steady rotating force (known as torque).
When the coils are turned on and off in sequence, a rotating magnetic field is created
that interacts with the differing fields of the stationary magnets in the stator to create
torque, which causes it to rotate. These key operating principles of DC motors allow
them to convert the electrical energy from direct current into mechanical energy through
the rotating movement, which can then be used for the propulsion of objects.

4.4.3 Who invented the DC motor?

This amazing piece of electrical equipment has revolutionised our lives in


many ways, but who invented the DC motor? As with all major innovations,
there are many people who had a role to play through the development of
similar mechanisms.

In the US, Thomas Davenport is widely celebrated as the inventor of the first electric
motor, and undoubtedly he was the first to patent a useable electric motor in 1837.
Davenport, however, was not the first person to build an electric motor, with various
inventors in Europe having already developed more powerful versions by the time
Davenport filed his patent.

In 1834, Moritz Jacobi had presented a motor that was three times as powerful as the
one Davenport would later patent, while Sibrandus Stratingh and Christopher Becker
were the first to demonstrate a practical application for an electric motor, by running a
small model car in 1835.

The first practical DC motor was invented some years later in 1886 by Frank Julian
Sprague, whose invention lead to the first motor powered trolley system in 1887, and the
first electric elevator in 1892. Sprague’s DC motor was a hugely significant
development, leading to a variety of applications which would reshape the face of
industry and manufacturing.
4.4.4 Types of DC Motors

So far, this guide has broadly explained how DC motors work, the history of these
mechanisms, and what they look like. While the principles are the same across variants,
there are actually several different types of DC motors, which offer specific advantages
and disadvantages over each other.

4.5 Power supply:

A power supply is a component that provides at least one electrical charge with power.
It typically converts one type of electrical power to another, but it can also convert a
different Energy form in electrical energy, such as solar, mechanical, or chemical.

A power supply provides electrical power to components. Usually, the term refers to
devices built into the powered component.Computer power supplies, for example,
convert AC current to DC current and are generally located along with at least one fan at
the back of the computer case.

4.6 Rectifier:
A rectifier is an electrical device that convertsalternating current (AC), which
periodically reverses direction, to direct current (DC), which flows in only one direction.
The process is known as rectification, since it "straightens" the direction of current.
Rectifiers have many uses, but are often found to serve as components of DC power
supplies and direct power transmission systems with high voltage. Rectification can be
used in roles other than direct current generation for use as a power source.
Fig 4.6.1 Circuit of rectifier

Fig 4.6.2 Rectifier

4.7 Capacitors:

Capacitors are used to attain from the connector the immaculate and smoothest DC
voltage in which the rectifier is used to obtain throbbing DC voltage which is used as
part of the light of the present identity. Capacitors are used to acquire square DC from
the current AC experience of the current channels so that they can be used as a touch of
parallel yield.

Fig 4.7.1 Capacitor

4.8 Voltage regulators:


The 78XX voltage controller is mainly used for voltage controllers as a whole. The XX
speaks to the voltage delivered to the specific gadget by the voltage controller as the
yield. 7805 will supply and control 5v yield voltage and 12v yield voltage will be
created by 7812.

The voltage controllers are that their yield voltage as information requires no less than 2
volts. For example, 7805 as sources of information will require no less than 7V, and
7812, no less than 14 volts. This voltage is called Dropout Voltage, which should be
given to voltage controllers.

Fig 4.8.1 7805 voltage regulator with pinout

Fig 4.8.2 7812 voltage regulator with pinout

4.9 Buzzer:

A buzzer or beeper is an audio signaling device, which may be mechanical,


electromechanical, or piezoelectric. Typical uses of buzzers and beepers include alarm
devices, timers and confirmation of user input such as a mouse click or keystroke.
Buzzer is an integrated structure of electronic transducers, DC power supply, widely
used in computers, printers, copiers, alarms, electronic toys, automotive electronic
equipment, telephones, timers and other electronic products for sound devices. Active
buzzer 5V Rated power can be directly connected to a continuous sound, this section
dedicated sensor expansion module and the board in combination, can complete a
simple circuit design, to "plug and play.

Fig 4.9.1 Buzzer

4.9.1 Buzzer Pin Configuration

Pin Pin Description


Number Name

1 Positive Identified by (+) symbol or longer terminal lead. Can be


powered by 5V DC

2 Negative Identified by short terminal lead. Typically connected to the


ground of the circuit

4.9.2 Buzzer Features and Specifications

 Rated Voltage: 6V DC
 Operating Voltage: 4-8V DC
 Rated current: <30mA
 Sound Type: Continuous Beep
 Resonant Frequency: ~2300 Hz
 Small and neat sealed package
 Breadboard and Perf board friendly
4.9.3 How to use a Buzzer
A buzzer is a small yet efficient component to add sound features to our project/system.
It is very small and compact 2-pin structure hence can be easily used on breadboard,
Perf Board and even on PCBs which makes this a widely used component in most
electronic applications.
There are two types are buzzers that are commonly available. The one shown here is a
simple buzzer which when powered will make a Continuous Beeeeeeppp.... sound, the
other type is called a readymade buzzer which will look bulkier than this and will
produce a Beep. Beep. Beep. Sound due to the internal oscillating circuit present inside
it. But, the one shown here is most widely used because it can be customized with help
of other circuits to fit easily in our application.
This buzzer can be used by simply powering it using a DC power supply ranging from
4V to 9V. A simple 9V battery can also be used, but it is recommended to use a
regulated +5V or +6V DC supply. The buzzer is normally associated with a switching
circuit to turn ON or turn OFF the buzzer at required time and require interval.
4.9.4 Applications of Buzzer

 Alarming Circuits, where the user has to be alarmed about something


 Communication equipment’s
 Automobile electronics
 Portable equipment’s, due to its compact size
4.10 Ultrasonic sensor:

It emits an ultrasound at 40 000 Hz which travels through the air and if there is an object
or obstacle on its path It will bounce back to the module. Considering the travel time
and the speed of the sound you can calculate the distance.

Fig 4.10.1 Operation of Ultrasonic Sensor

In order to generate the ultrasound we need to set the Trig pin on a High State for 10 µs.
That will send out an 8 cycle ultrasonic burst which will travel at the speed of sound.
The Echo pins goes high right away after that 8 cycle ultrasonic burst is sent, and it
starts listening or waiting for that wave to be reflected from an object.

If there is no object or reflected pulse, the Echo pin will time-out after 38ms and get
back to low state.

If we receive a reflected pulse, the Echo pin will go down sooner than those 38ms.
According to the amount of time the Echo pin was HIGH, we can determine the distance
the sound wave traveled, thus the distance from the sensor to the object.

For that purpose we are using the following basic formula for calculating distance:

Distance = Speed x Time

4.11 Raindrop Sensor:

Raindrop Sensor is a tool used for sensing rain. It consists of two modules, a rain
board that detects the rain and a control module, which compares the analog value, and
converts it to a digital value. The raindrop sensors can be used in the automobile sector
to control the windshield wipers automatically, in the agriculture sector to sense rain and
it is also used in home automation systems.

4.11.2 Pin Configuration of Rain Sensor:

S.No: Name Function

1 VCC Connects supply voltage- 5V

2 GND Connected to ground

3 D0 Digital pin to get digital output

4 A0 Analog pin to get analog output

4.11.3 Raindrop Sensor Features:

 Working voltage 5V
 Output format: Digital switching output (0 and 1), and analog voltage output
AO
 Potentiometer adjust the sensitivity
 Uses a wide voltage LM393 comparator
 Comparator output signal clean waveform is good, driving ability, over 15mA
 Anti-oxidation, anti-conductivity, with long use time
 With bolt holes for easy installation
 Small board PCB size: 3.2cm x 1.4cm

Interfacing the raindrop sensor with a microcontroller like 8051, Arduino, or PIC is
simple. The rain board module is connected with the control module of the raindrop
sensor as shown in the below diagram.
Fig 4.11.1 Rain Drop Sensor

The control module of the raindrop sensor has 4 outputs. VCC is connected to a 5V
supply. The GND pin of the module is connected to the ground. The D0 pin is connected
to the digital pin of the microcontroller for digital output or the analog pin can be used.
To use the analog output, the A0 pin can be connected to the ADC pin of a
microcontroller. In the case of Arduino, it has 6 ADC pins, so we can use any of the 6
pins directly without using an ADC converter. The sensor module consists of a
potentiometer, LN393 comparator, LEDs, capacitors and resistors. The pinout image
above shows the components of the control module. The rainboard module consists of
copper tracks, which act as a variable resistor. Its resistance varies with respect to the
wetness on the rainboard. The below fig shows the rain board module.

Fig 4.11.2 Rain Drop Module


4.12 DHT11 SENSOR (TEMPERATURE/HUMIDITY):

The DHT11 is a basic, low-cost digital temperature and humidity sensor. It uses a
capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out
a digital signal on the data pin (no analog input pins needed). It’s fairly simple to use,
but requires careful timing to grab data. The only real downside of this sensor is you can
only get new data from it once every 2 seconds.

Fig 4.12.1 DHT Sensor

4.12.1 Technical Specifications:

Measurement Humidity Temperature


Item Range Accuracy Accuracy Resolution Package

DHT11 20-90%RH ±5%RH ±20C 1 4 Pin Single


0-500C Row

4.12.2 Typical Application:


Note: 3Pin – Null; MCU = Micro-computer Unite or single chip Computer
When the connecting cable is shorter than 20 metres, a 5K pull-up resistor is
recommended;
When the connecting cable is longer than 20 metres, choose an appropriate pull-up
resistor as Needed.
Fig 4.12.2 Over view of DHT Sensor

4.12.3 Power and PinDHT11’s power supply is 3-5.5V DC. When power is supplied to
the sensor, do not send any instruction to the sensor in within one second in order to
pass the unstable status. One Capacitor valued 100nF can be added between VDD and
GND for power filtering.
CHAPTER-5
SOFTWARE DESCRIPTION
SOFTWARE REQUIREMENTS

5.1 Arduino IDE:

Arduino IDE where IDE stands for Integrated Development Environment – An official
software introduced by Arduino.cc, that is mainly used for writing, compiling and
uploading the code in the Arduino Device. Almost all Arduino modules are compatible
with this software that is an open source and is readily available to install and start
compiling the code on the go.

5.1.1 Introduction to Arduino IDE:

 Arduino IDE is an open source software that is mainly used for writing and
compiling the code into the Arduino Module.

 It is an official Arduino software, making code compilation too easy that even a
common person with no prior technical knowledge can get their feet wet with the
learning process.

 It is easily available for operating systems like MAC, Windows, and Linux and runs
on the Java Platform that comes with inbuilt functions and commands that play a
vital role for debugging, editing and compiling the code in the environment.

 A range of Arduino modules available including Arduino Uno, Arduino Mega,


Arduino Leonardo, Arduino Micro and many more.

 Each of them contains a microcontroller on the board that is actually programmed


and accepts the information in the form of code.

 The main code, also known as a sketch, created on the IDE platform will ultimately
generate a Hex File which is then transferred and uploaded in the controller on the
board.

 The IDE environment mainly contains two basic parts: Editor and Compiler where
former is used for writing the required code and later is used for compiling and
uploading the code into the given Arduino Module.

 This environment supports both C and C++ languages.


5.1.2 How to install Arduino IDE:

You can download the Software from Arduino main website. As I said earlier, the
software is available for common operating systems like Linux, Windows, and MAX, so
make sure you are downloading the correct software version that is easily compatible
with your operating system.

 If you aim to download Windows app version, make sure you have Windows 8.1 or
Windows 10, as app version is not compatible with Windows 7 or older version of
this operating system.

The IDE environment is mainly distributed into three sections

 1. Menu Bar
 2. Text Editor
 3. Output Pane
As you download and open the IDE software, it will appear like an image below.

The bar appearing on the top is called Menu Bar that comes with five different options
as follow

 File – You can open a new window for writing the code or open an existing one.
Following table shows the number of further subdivisions the file option is
categorized into.
As you go to the preference section and check the compilation section, the Output Pane
will show the code compilation as you click the upload button.

Fig 5.1.1 Installation of IDE

And at the end of compilation, it will show you the hex file it has generated for the
recent sketch that will send to the Arduino Board for the specific task you aim to
achieve.

 Edit – Used for copying and pasting the code with further modification for font
 Sketch – For compiling and programming
 Tools – Mainly used for testing projects. The Programmer section in this panel is
used for burning a bootloader to the new microcontroller.
 Help – In case you are feeling skeptical about software, complete help is available
from getting started to troubleshooting.
The Six Buttons appearing under the Menu tab are connected with the running program
as follow.

 The check mark appearing in the circular button is used to verify the code. Click this
once you have written your code.

 The arrow key will upload and transfer the required code to the Arduino board.

 The dotted paper is used for creating a new file.

 The upward arrow is reserved for opening an existing Arduino project.

 The downward arrow is used to save the current running code.

 The button appearing on the top right corner is a Serial Monitor – A separate pop-up
window that acts as an independent terminal and plays a vital role for sending and
receiving the Serial Data. You can also go to the Tools panel and select Serial
Monitor, or pressing Ctrl+Shift+M all at once will open it instantly. The Serial
Monitor will actually help to debug the written Sketches where you can get a hold of
how your program is operating. Your Arduino Module should be connected to your
computer by USB cable in order to activate the Serial Monitor.

 You need to select the baud rate of the Arduino Board you are using right now. For
my Arduino Uno Baud Rate is 9600, as you write the following code and click the
Serial Monitor, the output will show as the image below.
Fig 5.1.2 Output screen

The main screen below the Menu bard is known as a simple text editor used for writing
the required code.

The bottom of the main screen is described as an Output Pane that mainly highlights the
compilation status of the running code: the memory used by the code, and errors
occurred in the program. You need to fix those errors before you intend to upload the
hex file into your Arduino Module.

More or less, Arduino C language works similar to the regular C language used for any
embedded system microcontroller, however, there are some dedicated libraries used for
calling and executing specific functions on the board.
5.1.3 Libraries:

Libraries are very useful for adding the extra functionality into the Arduino Module.
There is a list of libraries you can add by clicking the Sketch button in the menu bar and
going to Include Library.

Fig 5.1.3 Libraries

As you click the Include Library and Add the respective library it will on the top of the
sketch with a #include sign. Suppose, I Include the EEPROM library, it will appear on
the text editor as

#include <EEPROM.h>.

Most of the libraries are preinstalled and come with the Arduino software. However,
you can also download them from the external sources.
Making pins Input and output:

The digitalRead and digitalWrite commands are used for addressing and making the
Arduino pins as an input and output respectively.
These commands are text sensitive i.e. you need to write them down the exact way they
are given like digitalWrite starting with small “d” and write with capital “W”. Writing it
down with Digitalwrite or digitalwrite won’t be calling or addressing any function.

5.1.4 How to select the board:

In order to upload the sketch, you need to select the relevant board you are using and the
ports for that operating system. As you click the Tools on the Menu, it will open like the
figure below.

Fig 5.1.4 Selection of Board


 Just go to the “Board” section and select the board you aim to work on. Similarly,
COM1, COM2, COM4, COM5, COM7 or higher are reserved for the serial and USB
board. You can look for the USB serial device in the ports section of the Windows
Device Manager.

Following figure shows the COM4 that I have used for my project, indicating the
Arduino Uno with COM4 port at the right bottom corner of the screen.

 After correct selection of both Board and Serial Port, click the verify and then upload
button appearing in the upper left corner of the six button section or you can go to the
Sketch section and press verify/compile and then upload.

 The sketch is written in the text editor and is then saved with the file extension .ino.

It is important to note that the recent Arduino Modules will reset automatically as you
compile and press the upload button the IDE software, however, older version may
require the physical reset on the board.

 Once you upload the code, TX and RX LEDs will blink on the board, indicating the
desired program is running successfully.

Note: The port selection criteria mentioned above is dedicated for Windows operating
system only, you can check this Guide if you are using MAC or Linux.
The amazing thing about this software is that no prior arrangement or bulk of mess is
required to install this software, you will be writing your first program within 2 minutes
after the installation of the IDE environment.
5.2 BootLoader:

As you go to the Tools section, you will find a bootloader at the end. It is very helpful to
burn the code directly into the controller, setting you free from buying the external
burner to burn the required code.

Fig 5.2.1 Boot Loader

When you buy the new Arduino Module, the bootloader is already installed inside the
controller. However, if you intend to buy a controller and put in the Arduino module,
you need to burn the bootloader again inside the controller by going to the Tools section
and selecting the burn bootloader.

5.3 EMBEDDED C

5.3.1 Introduction to Embedded C

Looking around, we find ourselves to be surrounded by various types of embedded


systems. Be it a digital camera or a mobile phone or a washing machine, all of them has
some kind of processor functioning inside it. Associated with each processor is the
embedded software. If hardware forms the body of an embedded system, embedded
processor acts as the brain, and embedded software forms its soul. It is the embedded
software which primarily governs the functioning of embedded system.

During infancy years of microprocessor based systems, programs were developed using
assemblers and fused into the EPROMs. There used to be no mechanism to find what
the program was doing. LEDs, switches, etc. were used to check correct execution of the
program. Some 'very fortunate' developers had In circuit Simulators (ICEs), but they
were too costly and were not quite reliable as well.

As time progressed, use of microprocessor-specific assembly-only as the programming


language reduced and embedded systems moved onto C as the embedded programming
language of choice. C is the most widely used programming language for embedded
processors/controllers. Assembly is also used but mainly to implement those portions of
the code where very high timing accuracy, code size efficiency, etc. are prime
requirements. Initially C was developed by Kernighan and Ritchie to fit into the space of
8K and to write (portable) operating systems. Originally it was implemented on UNIX
operating systems. As it was intended for operating systems development, it can
manipulate memory addresses. Also, it allowed programmers to write very compact
codes. This has given it the reputation as the language of choice for hackers too.

As assembly language programs are specific to a processor, assembly language didn't


offer portability across systems. To overcome this disadvantage, several high level
languages, including C, came up. Some other languages like PLM, Modula-2, Pascal,
etc. also came but couldn't find wide acceptance. Amongst those, C got wide acceptance
for not only embedded systems, but also for desktop applications. Even though C might
have lost its sheen as mainstream language for general purpose applications, it still is
having a strong hold in embedded programming. Due to the wide acceptance of C in the
embedded systems,various kinds of support tools like compilers & cross-compilers,
ICE, etc. came up and all this facilitated development of embedded systems using C.

Subsequent sections will discuss what is embedded C, features of C language,


similarities and difference between C and embedded C, and features of embedded C
programming.

5.3.2 Embedded systems programming

Embedded systems programming is different from developing applications on a desktop


computers. Key characteristics of an embedded system, when compared to PCs, are as
follows:

Embedded devices have resource constraints (limited ROM, limited RAM, limited stack
space, less processing power)

Components used in embedded system and PCs are different; embedded systems
typically uses smaller, less power consuming components. Embedded systems are more
tied to the hardware.

Two salient features of Embedded Programming are code speed and code size. Code
speed is governed by the processing power, timing constraints, whereas code size is
governed by available program memory and use of programming language. Goal of
embedded system programming is to get maximum features in minimum space and
minimum time. Embedded systems are programmed using different type of languages:

Machine Code

Low level language, i.e., assembly

High level language like C, C++, Java, Adafruit, etc.

Application level language like Visual Basic, scripts, Access, etc. Assembly language
maps mnemonic words with the binary machine codes that the processor uses to code
the instructions. Assembly language seems to be an obvious choice for programming
embedded devices. However, use of assembly language is restricted to developing
efficient codes in terms of size and speed. Also, assembly codes lead to higher software
development costs and code portability is not there. Developing small codes are not
much of a problem, but large programs/projects become increasingly difficult to manage
in assembly language. Finding good assembly programmers has also become difficult
nowadays. Hence high level languages are preferred for embedded systems
programming.

5.3.3 Difference between C and embedded C

Though C and embedded C appear different and are used in different contexts, they have
more similarities than the differences. Most of the constructs are same; the difference
lies in their applications.

C is used for desktop computers, while embedded C is for microcontroller based


applications. Accordingly, C has the luxury to use resources of a desktop PC like
memory, OS, etc. While programming on desktop systems, we need not bother about
memory However, embedded C has to use with the limited resources (RAM, ROM, I/O)
on an embedded processor. Thus, program code must fit into the available program
memory. If code exceeds the limit, the system is likely to crash.

Compilers for C typically generate OS dependent executables. It requires compilers to


create files to be downloaded to the microcontrollers/microprocessors where it needs to
run. Embedded compilers give access to all resources which is not provided in compilers
for desktop computer applications.

Embedded systems often have the real-time constraints, which is usually not there with
desktop computer applications.

Embedded systems often do not have a console, which is available in case of desktop
applications.

So, what basically is different while programming with embedded C is the mindset; for
embedded applications, we need to optimally use the resources, make the program code
efficient, and satisfy real time constraints, if any. All this is done using the basic
constructs, syntaxes, and function libraries of 'C'.
CHAPTER - 6
TESTING & RESULT ANALYSIS
6.1 Code

It consists of 2 codes. One is for the function of Flood Detection on conditions of


climate and the other is related to avoidance of the flood.

6.1.1 Flood detection

#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,10,9,8,7);
#include <SimpleDHT.h>
int pinDHT11 = 2;
const int trigPin = 3;
const int echoPin = 4;
int rain=A0;
int buz=5;
long duration;
int distance;
int rain_val;
String str;
SimpleDHT11 dht11(pinDHT11);

void setup() {
Serial.begin(9600);
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("FLOOD ");
lcd.setCursor(0,1);
lcd.print("MONITORING...");
delay(2000);
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(rain,INPUT);
pinMode(buz, OUTPUT);
digitalWrite(buz,LOW);
}

void loop()
{
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration * 0.034 / 2;
delay(500);
// Serial.println(distance);
rain_val=analogRead(rain);
delay(500);
// Serial.println(rain_val);
byte temperature = 0;
byte humidity = 0;
int err = SimpleDHTErrSuccess;
if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
Serial.print("Read DHT11 failed, err="); Serial.print(SimpleDHTErrCode(err));
Serial.print(",");
Serial.println(SimpleDHTErrDuration(err)); delay(1000);
return;
}
// Serial.print((int)temperature); Serial.print(" *C, ");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("TEMP:");
lcd.setCursor(5,0);
lcd.print((int)temperature);
lcd.setCursor(7,0);
lcd.print("RAIN:");
lcd.setCursor(12,0);
lcd.print(rain_val);
lcd.setCursor(0,1);
lcd.print("LEVEL:");
lcd.setCursor(7,1);
lcd.print(distance);
delay(1000);
if(distance<10&&(int)temperature<30&&rain_val<300&&rain_val>0)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LEVEL INCREASED");
lcd.setCursor(0,1);
lcd.print("CHANCES OF FLOOD");
digitalWrite(buz,HIGH);
delay(1000);
}
else if((int)temperature<30&&rain_val<500&&rain_val>400)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("IT MAY RAIN..");
digitalWrite(buz,HIGH);
delay(1000);
}
else if((int)temperature<30&&rain_val<400&&rain_val>300)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("IT IS RAINING...");
digitalWrite(buz,HIGH);
delay(1000);
}
else if((int)temperature<30&&rain_val<300&&rain_val>0)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("HEAVY RAIN...");
digitalWrite(buz,HIGH);
delay(1000);
}
else if((int)temperature<30)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LESS TEMP.");
digitalWrite(buz,HIGH);
delay(1000);
}
else if(rain_val<500&&rain_val>400)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("IT MAY RAIN..");
lcd.setCursor(0,1);
lcd.print("AT NORMAL TEMP.");
digitalWrite(buz,HIGH);
delay(1000);
}
else if(rain_val<400&&rain_val>300)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("IT IS RAINING...");
lcd.setCursor(0,1);
lcd.print("AT NORMAL TEMP.");
digitalWrite(buz,HIGH);
delay(1000);
}
// else if((int)temperature<30&&rain_val<300&&rain_val>0)
// {
// lcd.clear();
// lcd.setCursor(0,0);
// lcd.print("HEAVY RAIN...");
//
// digitalWrite(buz,HIGH);
// delay(1000);
// }
else
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("NORMAL...");
digitalWrite(buz,LOW);
delay(1000);
}
str =String(distance)+String("!")+String((int)temperature)+String("@")
+String(rain_val);
Serial.println(str);
delay(1000);
}

6.1.2 Avoidance System based on climatic conditions

#include <ESP8266WiFi.h>
#include "ThingSpeak.h"

const char* ssid = "Harshi"; // your network SSID (name)


const char* password = "Harshitha@2003"; // your network password

WiFiClient client;

unsigned long myChannelNumber = 2440858;


const char * myWriteAPIKey = "VYB0FFWWR3WQPDS1";

// Timer variables
unsigned long lastTime = 0;
unsigned long timerDelay = 30000;

String String_main;
String String_1;
String String_2;
String String_3;

void setup() {
Serial.begin(9600);

WiFi.mode(WIFI_STA);

ThingSpeak.begin(client);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop()
{
if ((millis() - lastTime) > timerDelay) {

// Connect or reconnect to WiFi


if(WiFi.status() != WL_CONNECTED){
Serial.print("Attempting to connect");
while(WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, password);
delay(5000);
}
Serial.println("\nConnected.");
}
if (Serial.available())
{
String_main=Serial.readString();
Serial.println(String_main);
String_1=String_main.substring(0,2);
Serial.print(String_1);
delay(500);
String_2=String_main.substring(3,5);
Serial.print(String_2);
delay(500);
String_3=String_main.substring(6,10);
Serial.print(String_3);
delay(500);

ThingSpeak.setField(1,String_1);
ThingSpeak.setField(2,String_2);
ThingSpeak.setField(3,String_3);

int x = ThingSpeak.writeFields(myChannelNumber,myWriteAPIKey);
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
lastTime = millis();
}
}
}
6.2 Result Analysis

6.2.1 Test Case 1

Fig 6.2.1 Heavy Rain condition

Heavy Rain
Condition:
- Temperature < 30
- Rain intensity < 300
Action:
- Display "HEAVY RAIN..." on the LCD screen.
- Activate the buzzer.
 As heavy rain descends upon the area, the flood monitoring system springs into
action to address the escalating situation.
 Detecting a temperature below 30 degrees Celsius and a significant rainfall
intensity below 300 units, the system identifies the onset of heavy rainfall.
Promptly reacting, it updates the LCD screen to reflect the prevailing heavy rain
conditions.
 Concurrently, the system activates a buzzer, emitting a loud audible signal to
warn nearby individuals of the intensifying rain and the potential risks associated
with heavy downpours.
 This proactive response aims to ensure the safety and preparedness of those
within the monitored area during adverse weather conditions.
6.2.2 Test case 2

Fig 6.2.2 Light rain at normal temperature

Light rain at normal temperature


Condition:
- Rain intensity between 300 and 400
Action:
- Display "IT IS RAINING..." on the LCD screen.
- Display "AT NORMAL TEMP." on the second line of the LCD screen.
- Activate the buzzer.
 Amidst light rainfall under normal temperature conditions, the flood monitoring
system maintains vigilant surveillance.
 With the temperature below 30 degrees Celsius and rainfall intensity ranging
between 300 and 400 units, the system acknowledges the presence of light rain.
 Updating the LCD display accordingly, it notifies observers of the current
weather conditions while reassuring them of the stable temperature range.
 As an added precaution, the system activates a buzzer, emitting a subtle audible
alert to inform nearby individuals of the ongoing light rain activity and
encourage preparedness.
6.2.3 Test case 3

Fig 6.2.3 Potential Flood Condition

Potential Flooding
Condition:
- Distance < 10 (indicating water level near the sensor)
- Temperature < 30
- Rain intensity < 300 and > 0
Action:
- Display "LEVEL INCREASED" and "CHANCES OF FLOOD" on the LCD screen.
- Activate the buzzer.

 In this critical scenario, the flood monitoring system detects an imminent threat
of flooding as multiple conditions align.
 The system registers a dangerously close water level, indicated by a proximity
sensor reading of less than 10 units. Coupled with a temperature below 30
degrees Celsius and moderate rainfall intensity not exceeding 300 units, the
situation warrants immediate attention.
 Upon recognition of these factors, the system issues a stark warning on the LCD
screen, alerting viewers to the heightened risk of flooding. To amplify the
urgency, the system activates a buzzer, sounding an audible alarm to prompt
swift action and mitigate potential damages.
CHAPTER - 7
CONCLUSION & FUTURE SCOPE
7.1 CONCLUSION

In conclusion, the flood detection and alerting system present a significant advancement
in disaster management technology, offering proactive measures to mitigate the impact
of flooding on communities and infrastructure. By leveraging IoT sensors and real-time
data transmission capabilities, the system provides early warnings and critical
information to stakeholders, enabling timely responses and decision-making during
flood events. This technology represents a crucial step forward in enhancing resilience
to natural disasters and protecting lives and property in flood-prone areas.

Furthermore, the versatility of the system extends its utility beyond immediate disaster
response, offering valuable insights for various applications such as agricultural
management, urban planning, and environmental monitoring. The data collected by the
system can inform evidence-based policymaking, support sustainable development
initiatives, and contribute to scientific research on climate change and hydrology.
Moreover, its integration into existing infrastructure and emergency response
frameworks enhances overall preparedness and coordination efforts, strengthening
community resilience and adaptive capacity in the face of evolving environmental
challenges.

Overall, the flood detection and alerting system exemplify the transformative potential
of technology in addressing complex societal issues and advancing disaster risk
reduction strategies. As climate change continues to amplify the frequency and intensity
of extreme weather events, innovative solutions like this are essential for building more
resilient and sustainable communities. By harnessing the power of IoT, data analytics,
and collaborative partnerships, we can better anticipate, mitigate, and adapt to the
impacts of floods, ultimately safeguarding the well-being and prosperity of present and
future generations.

7.2 FUTURE SCOPE

The future scope for flood detection and avoidance systems is promising, with several
avenues for development and improvement. Here are some key areas of future scope for
these systems:
 Advanced Sensor Technologies: Continued advancements in sensor
technologies, including IoT sensors, LiDAR (Light Detection and Ranging), and
radar systems, will enhance the accuracy and coverage of flood detection
systems. These sensors can provide real-time data on water levels, precipitation,
soil moisture, and other critical parameters for early warning and decision-
making.
 Integration of Artificial Intelligence (AI) and Machine Learning (ML): AI
and ML algorithms have the potential to revolutionize flood detection and
avoidance systems. By analyzing large volumes of data, identifying patterns, and
making predictions, AI/ML models can improve flood forecasting accuracy,
optimize evacuation routes, and enhance resilience strategies.
 Flood Prediction and Early Warning Systems: Future systems should focus
on developing more robust flood prediction models that can accurately forecast
flood events well in advance. Early warning systems that combine
meteorological data, hydrological modeling, and risk assessment can provide
timely alerts to communities and authorities, reducing loss of life and property
damage.
 Smart Infrastructure and Resilient Design: The integration of smart
infrastructure components such as smart sensors, automated flood barriers, and
adaptive building designs can enhance the resilience of urban areas and critical
infrastructure against flood hazards. Incorporating green infrastructure and
nature-based solutions can also help in natural flood mitigation and water
management.
 Data Sharing and Collaboration: Collaboration among stakeholders, including
government agencies, researchers, private sector entities, and communities, is
crucial for the success of flood detection and avoidance systems. Open data
platforms, standardization of data formats, and information sharing protocols can
facilitate effective collaboration and improve response coordination during flood
events.

 Climate Change Adaptation: Given the increasing frequency and intensity of


extreme weather events due to climate change, future flood detection and
avoidance systems should be designed with climate resilience in mind.
Adaptation strategies, long-term planning, and policy interventions will be
essential in addressing the evolving challenges of flood risk management.
By focusing on these areas of future scope, we can develop more robust, adaptive, and
sustainable flood detection and avoidance systems that contribute to safer and more
resilient communities in flood-prone regions.
Bibliography

[1] Sebin Sabu1 and Nora Elizabeth, “Kerela floods- A model of rescue and
rehabilitation using information technology and social media based crowdsourcing”,
IEEE India info. Vol. 13 No. 3 Jul-Sep 2018.

[2] H. Hamidon, “Flood level indicator and risk warning system for remote location
monitoring flood observatory system”,WSEAS Trans. Syst. Control, vol. 5, no.3,pp.
153-163,2018

[3] Z.M. Taib,N.S. Jaharuddin,and Z.D. Mansor, “ A review of flood disaster and
disaster in Malaysia” International journal of Accounting and business management,
vol. 4,no.3,2016.

[4] A.M. Leman, K.A. Rahman, M.N.M.Salleh, I.Baba, D.Feriyanto, L.S.C. Johnson,
and S.N Hidayah M., “A review of flood catastrophic management in malaysia, “ ARPN
Journal of Engineering and applied sciences, vol.11,no. 14, Jul 2016.

[5] A. Al-Faquha, M. Guizani, M.Mohammadi, M. Aledhari, and M. Ayahs, “ Internet


of things: A survey on enabling technologies, protocols, and applications,” IEEE
Communications surveys Tutorials, vol. 17, no. 4,pp. 2347-2376,Fourthquarter 2015.

[6] M. Mathematic and R. Grace, “Flood alert management system using iota and
microcontroller,” International journal of innovative research in computer and
communication engineering, vol. 5, no. 4, April 2017.

[7] S.J. Priya, S. Kashaya, E. Arena, J. A. M. Julie, and V. Ranjani, “ Flood monitoring
and alerting system,” International journal of computer engineering and technology
(IJCET), vol. 8, no. 2,p.15, Mar 2017.

You might also like