Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

PROTOTYPE OF FLOOD DETECTION EQUIPMENT DESIGN

BY USING THE HC-SR04 BASED SENSORS


ARDUINO NANO

ENGLISH TASK

MUHAMMAD ALFADHIL SYAYUTI


2011011003

D-IV STUDY PROGRAM OF INDUSTRIAL ELECTRONIC


ENGINEERING
ELECTRICAL ENGINEERING MAJOR
PADANG STATE POLYTECHNIC
2021/2022
VALIDITY SHEET

Name : Muhammad Alfadhil Syayuti

NIM : 2011011003

Tittle : Prototype of Flood Detection Equipment Design By Using The

HC-SR04 Based Sensors Arduino Nano

Supervisor : 1. Andrizal, ST.MT

2. Nini Wahyuni, Spd.M.Pd

Date/Time : Sunday/21st November 2021

Padang , November 2021

Supervisor 1 Supervisor 2

Andrizal, ST.MT Nini Wahyuni, Spd.M.Pd


ACKNOWLEDGEMENTS

By saying thank God for the presence of Allah SWT, who has bestowed

His grace and guidance so that the writer can complete the final project with the

title “PROTOTYPE OF FLOOD DETECTION EQUIPMENT DESIGNBY

USING THE HC-SR04 BASED SENSORS ARDUINO NANO " With all

humility, the author realizes that writing assignments this thesis will not be

finished without the help, advice, guidance and direction from various parties.

For that, on this occasion the author

express sincere gratitude to the honorable:

1. Allah SWT, who has given His mercy and the way of ease so that

researchers can complete this final project.

2. Mr. Andrizal, ST.MT

And Mrs. Nini Wahyuni, Spd.M.Pd


ABSTRACT
Have you ever thought, why almost in big cities floods often occur?

people in this day and age often throw garbage carelessly and do not care about

the surrounding environment. The number of large buildings can also cause

flooding due to reduced land that cannot absorb water. The influence of weather

can also cause flooding. And for that I have a solution to give a warning if there

will be a flood with the help of the HC-SR04 sensor as a detector to detect

distance. The purpose of making this final project is to help monitor the water

level to be careful in the danger of flooding. To find out if there is a flood, this

tool is able to detect if the water level exceeds the limit. The HC-SR04 sensor

works based on the principle of sound wave reflection, where the sensor emits

sound waves which then captures it with a time difference. This sensor is used

in the control process run by the Arduino nano microcontroller so that the results

of the data that have been detected by the HC-SR04 sensor are displayed to the

LCD and Buzzer will sound if it exceeds the water level that has been set.

Keywords: Arduino Nano, Flood, Buzzer, LCD, Sensor HC-SR04


TABLE OF CONTENT
VALIDITY SHEET....................................................................................
ACKNOWLEDGEMMENTS.....................................................................
ABSTRACT................................................................................................
CHAPTER I ................................................................................................
INTRODUCTION ......................................................................................
1.1 Background of The Research.....................................................
1.2 Indentification Problem ..............................................................
1.3 Purpose of the Research..............................................................
CHAPTER 2 BODY...................................................................................
2.1 Testing the 7805 Regulator Circuit .....................................................
2.2 Arduino Nano Circuit Testing ............................................................
2.3 LCD Circuit Test ..................................................................................
2.4 Testing the HC-SR04 Sensor Circuit ..................................................
2.5 Results .................................................................................................
CHAPTER I
INTRODUCTION

1.1 Background of The Research

Flooding is a common problem that occurs in some areas

Indonesia, especially in densely populated areas such as urban areas.

Therefore, the loss caused is large, both in terms of material and loss of life,

it is proper that the flood problem needs serious attention and is a problem

for all of us. With the assumption that the problem of flooding is a general

problem, various parties should pay attention to things that can cause

flooding and as early as possible, to minimize the losses caused. Flood

control programs that require large funds needed to finance related works

with flood protection and control.

In addition, people living in flood-prone areas need a sense of

security from the effects of floods at any time. With limited funds, flood

control must be carried out as optimally as possible and carried out according

to good plans and priorities. As a result of the increase in population, the

required land will be even greater so that it also increases the economic value

land use.
Therefore, in densely populated areas, flood control needs to be

improved. With other controls, it aims to minimize the risk of harm/loss that

will arise. On the basis of good control considerations, in addition to the

physical development, it is necessary to monitor, evaluate, plan for

continuous improvement and maintenance. To explore flood control, several

terms need to be reached, some of which are explained below.

1. River area: is a unitary area of the irrigation system as a river area

development which may consist of one or more river irrigation areas.

2. Irrigation system: is the arrangement of the layout of the water source,

including the utilization building in accordance with the provisions of the

technical development in an area.

3. River drainage area: is a unitary area of the water system that is formed

naturally, where water will flow through the river and its tributaries. There

are people who call it the watershed (DAS), the catchment area (DTA).

4. Floodplain area: is a land that is a lowland, because of its topographic

conditions at certain times can be inundated by floods that occur.

5. Riverbank: an area located on both sides and along the river channel,

which is located between the edge of the river channel trough to the foot of

the inner embankment.

6. Retention area: a low area that is used to temporarily hold flood water and

is released when the flood begins to recede.


Floods have 2 events: first, flood/inundation events that occur in areas

that usually do not flood and secondly flood events occur due to runoff of

flood water from rivers because the flood discharge cannot be drained by

the river channel or the flood discharge is greater than the capacity of the

existing river flow. . Flood events themselves are not a problem, if they

do not interfere with human activities or interests and this problem arises

after humans carry out activities in floodplain areas, to reduce losses due

to flooding. Flood control in general is an activity of planning,

implementing flood control work, exploitation and maintenance which is

basically to control floods, regulate the use of floodplains and reduce or

prevent the occurrence of flooding.

danger/loss due to flooding. Based on the description above, the writer is

interested in designing and making a flood detector. As the title of this final

project

1.2 Indentification Problem

Based on the above, problems arise, namely:

1. How to design and make a flood detection device using the HC-SR04

sensor and using a microcontroller arduino nano.

2. How to detect water level with sensor HC-SR04.


3. How to make a program to control the HC-SR04 sensor and Buzzer in the

flood detection circuit.

1.3 Purpose of the Research

The objectives of this final project are as follows:

1. Create a program to read the water level with the HCSR04 sensor and

sound a warning alarm.

2. Design and manufacture a flood detection device with an HC-SR04 sensor

and an Arduino nano microcontroller.

3. To better understand the application of microcontrollers and sensors in

everyday life.
CHAPTER II

BODY

2.1.Testing the 7805 . Regulator Circuit

Voltage regulator IC is an IC that is used to regulate voltage. IC 7805 is

a 5V Regulator, Voltage which limits the output voltage to 5V and draws 5V

regulated power supply. Testing the voltage regulator using a digital

multimeter, this ic7805 circuit will issue a voltage of 5 volts with input above 6

volts to 35 volts. The result of measuring the voltage regulator 7805 is 5.12

volts.

2.2.Testing Arduino Nano Microcontroller Circuit

Arduino circuit testing is done by programming the system to be

made. The program is uploaded using a downloader cable and

programmed using the Arduino program. Programming using ISP (In

System Programming) mode the microcontroller must be able to be

programmed directly on the circuit board and the microcontroller circuit

must be recognized by the downloader program. If the Chip Signature has

been recognized properly and in a short time, it can be said that the

microcontroller circuit is working well with its ISP mode.


Table 4.2. arduino nano digital pin voltage test
Pin Tegangan Pin

D0 5,11

D1 5,12

D2 0,00

D3 0,00

D4 0,06

D5 5,12

D6 5,12

D7 0,00

D8 5,11

D9 0,00

D10 5,10

D11 0,00

D12 0,00

2.3.LCD Circuit Test

This section only consists of a 2 x 16 character dot matrix LCD that functions

as a display of measurement results and displays of some information. The LCD

is connected directly to Port B of the microcontroller which functions to

transmit the processed data to be displayed in alphabetical and numeric form on

the LCD. The character display on the LCD is regulated by the EN pin,

RS and RW: The EN line is called Enable. This line is used to tell
LCD that you are sending data. To send data to the LCD, through the EN

program, a logic low “0” and set (high) must be made on the other two control

lines, RS and RW. The RW line is the Read/Write control line. When RW is

logic low (0), then the information on the data bus will be written on the LCD

screen. When RW has a high logic "1", then the program will read the memory

from the LCD. Whereas in general applications the RW pin is always given a

logic low ( 0 ).

Based on the information above, we can create a program to display characters

on the LCD display. The program that is loaded into the Arduino

microcontroller to display characters on the LCD display is as follows:

#include <LiquidCrystal.h>

LiquidCrystal lcd(10, 9, 8, 7, 6, 5); Void setup() { lcd.begin(16, 2);

Void loop() {

Lcd.print("lcd test"); Lcd.setCursor(0,0); delay(1)

The above program will display the word “lcd test” in the first line of the 2x16 LCD display. In the
tool in this study, when the whole circuit is activated.

2.4. HCSR-04 . Circuit Testing

Testing the hcsr-04 sensor circuit by measuring a predetermined distance.


This test aims, whether or not the sensor is used, here is the sensor data when

the alarm will sound at a predetermined distance. Then on my tool, the

application of the hcsr-04 sensor as a water level detector so that it can be aware

of flooding.

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(10, 9, 8, 7, 6, 5);

//Length of square one between 13.6 and 13.5

#define trigPin 12

#define echoPin 11

#define led 2

#define buzzer 4

float duration, cm,water;

void setup() { Serial.begin (9600); lcd.begin(16, 2);

pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(led, OUTPUT); lcd.setCursor(0,


0); lcd.print("DETECTION TOOL"); lcd.setCursor(3, 1); lcd.print("FLOOD"); delay(5000); lcd.clear();
delay(1);

} void loop() {

// Sensor is triggered by a HIGH pulse of 10us or more.

// Give a short LOW pulse first to make sure the pulse is HIGH
clean:

digitalWrite(trigPin, LOW); delayMicroseconds(5); digitalWrite(trigPin, HIGH);


delayMicroseconds(10); digitalWrite(trigPin, LOW);

// Read signal from sensor: pulse HIGH which

// duration is the time (in microseconds) from sender // From ping to receiving Echo off of an
object.

pinMode(echoPin, INPUT); duration = pulseIn(echoPin, HIGH);

// convert distance to cm and meters

cm = (duration/2) / 29.1;

water=14.30-cm;

if(water<=0.9)

{ water=0; }

Serial.print(cm);

Serial.print(" || ");

Serial.println(water);

lcd.clear(); delay(1);

if(water>=0 && air<=3){ digitalWrite(buzzer,0); delay(1); lcd.setCursor(0, 0); lcd.print("Water


level: "); lcd.setCursor(6, 1); lcd.print(water); delay(3000); lcd.clear();delay(1); lcd.setCursor(0, 0);
lcd.print("Safe Condition"); lcd.setCursor(0, 1); lcd.print("Normal Limit"); delay(3000);
lcd.clear();delay(1);

if(water>=4 && air<=7){ digitalWrite(buzzer,1); lcd.setCursor(0, 0); lcd.print("Water level: ");


lcd.setCursor(6, 1); lcd.print(water); delay(3000); lcd.clear();delay(1); lcd.setCursor(0, 0);
lcd.print("Flood Alert"); lcd.setCursor(0, 1); lcd.print("Careful"); delay(800); digitalWrite(buzzer,0);
delay(2200); lcd.clear();delay(1);

if(air>=8){ digitalWrite(buzzer,1); lcd.setCursor(0, 0); lcd.print("Water level: "); lcd.setCursor(6,


1); lcd.print(water); delay(3000); lcd.clear();delay(1); lcd.setCursor(0, 0); lcd.print("FLOOD!!!");
lcd.setCursor(0, 1); lcd.print("Act immediately"); delay(3000); digitalWrite(buzzer,0); delay(6000);
lcd.clear();delay(1);

The above program is a program to find out whether the sensor is running
properly. The state of the sensor can be seen from the data sent from the
microcontroller to the computer via the USB port.

2.5 Results

Measurement tests were carried out on several samples, where the

measurement results were read in the form of the length of the digital signal

reflection. The read value will be converted to logic 0/1 and this logic will be

calculated using the counter contained in the Arduino, then the value will be

converted to distance units in centimeters.

The test is carried out by direct measurement method from a measured

point to the end point by comparing the value on the standard with the

designation on the measuring instrument to be tested. The standard is in the form


of a ruler with an accuracy of up to 0.5 millimeters and a maximum measurement

of up to 14 cm. The measurement test was carried out 5 times.

Below is a table of data from the experimental results at intervals of 2.0, 4.0,

6.0,8.0 and 11.0 centimeters and the measurement results are calculated to find

the average value to get the accuracy value of the measurement results.

You might also like