You are on page 1of 52

CHAPTER 1

INTRODUCTION

This chapter describes the background of the project, the problem


statement, objectives of the project and scope which are linked to the
development of an automated walking stick for the blind.

1.1 Project Background

Among numerous forms of disability, blindness is one of the most


suffering that can strike people of all ages and it affects the victim’s life.
Nowadays, many researchers have been conducted in designing and
inventing tools that may protect the blind from dangerous situation. Majority
of the visually impaired people today still use the “white cane” as the tool to
assist their movements especially when they are moving around outdoor.
Recent advancements in embedded systems can helps the blind to move
around more easily and comfortably.

There are many studies that relate to this innovation of walking stick
which use different design implementation such as infrared sensor, radio
signal and ultrasonic sensor detection for various applications.

1
1.2 Problem Statements

There are many blind persons that use the white stick to help their
daily movement. The stick helps them to detect obstructions around them
and to avoid them from danger.

The function of the common walking stick usually used by the blind is
limited. So, there is need to develop a new walking stick that can detect any
obstacles before the user hit it with the end of the stick.

1.3 Project Objectives

The objective of this project is to develop a smart walking stick, called


“Eye Stick” that can sense obstacles around the visually impaired person.
The walking stick will be able to sense different distances between the user
and the obstacles for up to 50cm long. In addition, the objective of this project
is also to help the movement of blind person in their daily activities.
Nevertheless, this project also targets to develop a low cost, sturdy and
robust walking stick. The system has one more advantage feature integrated
to help the blind find their stick if they forget where they kept it. The system is
called as “Eye Stick Finder”.

2
1.4 Scope of the project

There are 2 parts involved in this project, namely hardware and


software. The hardware part involved the construction of the walking stick, a
microcontroller, an ultrasonic sensor, a buzzer, a speaker and Rf-Tx circuit.

The software used to program the microcontroller is Arduino 1.0.6.


The software part includes the programming of the sensors. Besides,
Solidworks 2014 software also has been used to design the housing for the
ultrasonic sensors.

1.5 Thesis outline

The first chapter starts with brief introduction of the project. This
chapter describes the background of the project, the problem statement,
objectives and the scope of the project. The second chapter is about the
researches related to fields of the project which are mainly about the different
in designs and implementations of walking stick for the blind, as well as
alternative microcontrollers and sensors used in the projects.

Chapter 3 discusses the methodology of the project which includes


programming of Arduino Nano using Arduino software, the characteristics of
the ultrasonic ranging sensor and the overall construction of the walking
stick. Chapter 4 presents the results obtained and some discussions of the
results. Lastly, Chapter 5 wraps up all of the findings and emphasizes some
recommendations for future advancements.

3
CHAPTER 2

LITERATURE REVIEW

This chapter describes the past and current researches that have
been carried out which are related to the project. This review investigates
from numerous aspects of sensors, indicators and the overall working system
of the related projects.

2.1 Application of Ultrasonic Sensor in Arduino Mobility Cane

Jayant, Pratik and Mita[1] have proposed the application of ultrasonic


sensor in the walking stick to detect the obstacles. The overall project is
discussed as below.

4
2.1.1 Working Principle

The basic concept of ultrasonic sensor is to determine distance of an


object. In this project, an ultrasonic sensor is used to measure the distance
between the obstacles and the blind. The sensor enables to warn the blind
when facing any dangerous circumstances.

The ultrasonic sensor works by generating high frequency sound


waves and evaluates the echo which is received back by the sensor. The
sensor calculates the time interval between sending the signal and receiving
the echo to determine the distance of the obstacle. That signal is sent to the
microcontroller and it decide which output must be triggered.

2.1.2 Characteristic of Ultrasonic Sensor

The ultrasonic model used in this project is SRF-04. It was designed to


be just as easy to use as the Polaroid sonar. The sensor is able to compute
the distance of obstacles in maximum range of 10.7m.

It consists of 5 terminals, namely the power terminal, the ground


terminal, trigger pulse terminal, echo pulse terminal and do not connect
terminal. An analog voltage signal is produced as output which is proportional
to the distance. The current consumption for the sensor is about 2.5A during
the sonic burst and the power desired to turn it on is 5V.

The sensor needs to supply a short 10µS pulse to the trigger input to
start the ranging. Then the module will send out an 8 cycle burst of
ultrasound at 40kHz and raises its echo line high. The module is quite large
to fit into small systems. Figure 2.1 shows the SRF-04 ultrasonic sensor.

5
Figure 2.1: SRF-04 Sensor

2.1.3 Hardware Part

There are five main components in the system which are a charging
circuit, a battery, a vibrator, an ultrasonic sensor and a control unit.

Figure 2.2 : Block Diagram of the Components

Referring to Figure 2.2, ultrasonic module will emit ultrasonic waves which
bounce back when hit an object or an obstruction in the path of the user. The
received signal will be sent to the control unit which consists of an Arduino

6
Board. Arduino will do the calculation and then it triggers the vibrator as the
indicator to warn the user of the obstacles.

2.2 Application of Infrared (IR) Sensor in Electronic Guiding Stick

K. Divya, P. Dhivya, R. Gayathri and P. Govindaraj [2] have proposed


the application of infrared (IR) sensor in developing an Electronic Guiding
Stick for the blind. The stick is used as a tool for guiding them to walk or
move away from their places. Based on this project, the sensors are able to
detect the presence of obstacles that present along the pathway of the blind
people.

2.2.1 Basic Concept

The basic concept of the IR sensor is used to detect obstruction in front of


the blind. The sensor is also able to differentiate colors depending on
configuration of the sensor.

One disadvantage of the project is that it is not able to detect obstacles


towards extreme right and left of the user. However, the main focus of the
project is to design the system that will have longer distance of obstacles
detection unlike current systems. The block diagram of the project is shown
as in Figure 2.2.

7
Figure 2.3 Block Diagram of the Components

2.2.2 Working Principle

The basic concept of this work is to design an electronic guiding stick


with obstacle avoidance system by using IR sensor. The designed electronic
stick has been embedded with IR sensor to measure the distance in range of
approximately 100-550cm.

The IR consists of transmitter and receiver in combined manner. The


IR beams are transmitted from IR LED transmitter within a range of 100 to
550cm. The transmitted beam senses the obstacles and reflected back to
photodiode receiver. Then, the microcontroller processed the signal and
active a vibrator and a buzzer as output indicators that were placed in the
handle of the guiding stick.

8
2.3 Application of Radio Frequency Identification in Blind Navigation
System

The application of Radio Frequency Identification (RFID) to be


implemented in a Blind Navigation System was proposed by Bin Ding, Haitao
Yuan, Li Jiang and Xiaoning Zang [3].

2.3.1 Basic Concept

The project has been planned to be conveniently used to solve the


requirement and difficulties in the blind trip. In this project, wireless and
mobile communications technologies have been used. Radio Frequency
Identification (RFID) technology is a non-contact automatic identification
technology, which has the qualities of large capacity, long performance life
and long reading distance.

2.3.2 Working Principle

The system consists of RFID reader, antenna, RFID tags, mobile


terminal, call center, route server and tag information database as shown in
Figure 2.3 [3].

9
Figure 2.4 Frame of Blind Navigation System

The blind need to tell the call center about his destination by his
mobile phone and then the mobile phone sends the user’s location
information to the call center. The RFID reader reads the road tag near the
user and it connects with the mobile phone by Bluetooth interface and sends
the tag information to the mobile phone.

Next, the call center inputs the destination and location information to
the route server. The route server searches necessary data from the tag
information database. The tag information database sends the data to the
route server and it produces an optimal route according to route arithmetic
and sends the route to the call center.

10
2.3.3 Indicator

The output is the call center will sends the optimal route to the user‟s
mobile phone. Instead of using a mobile phone, audio signal also can be the
output option to assist the blind in walking and finding their way.

2.4 Microcontroller

Microcontroller is a compact microcomputer designed to regulate the


operation of embedded system in motor vehicles, robots, office machines
and numerous other devices. An embedded system is a very sophisticated
system that required minimal memory and program length, no operating
system and less software complexity.

2.4.1 Arduino Uno Microcontroller

The Arduino Uno is a microcontroller board based on the


ATMEGA328. It is an open source single board microcontroller, heir of the
open source wiring platform, thus helping in designing electronic project
easily. Arduino need to be programmed in order to drive the designed
function. The software that can be used for Arduino Nano programming is
Arduino software.

It has 14 digital input/output pins of which can be used as PWM outputs, 6


analog inputs, a 16MHz crystal oscillator, a USB connection, a power jack,
and ICSP header, and a reset button. It comprises everything needed to
support the microcontroller.

11
2.5 An Ultrasonic Navigation System For Blind People

The proposed system detects the nearest obstacles via stereoscopic


sonar system and sends back vibro-tactile feedback to inform the blind about
its localization [4]. The sonar system is based on two ultrasonic sensors; one
emits an ultrasonic waves and the other measures the echo.

2.5.1 Basic Concept

This project is based on a microcontroller with synthetic speech


output. It gives information to the user about urban walking way to point out
what decisions to make. The speech synthesizer is activated by pulse from
the microcontroller. The output represents the different actions to be taken.

2.5.2 Working Principle

The system consists of a microcontroller, an accelerometer, a


footswitch, a speech synthesizer, an hexadecimal keypad, a mode switch,
two ultrasonic sensors, two vibrators and a power switch. The block diagram
of the system is described by Figure 2.5.

12
Figure 2.5 Block Diagram of the System

It works by sending out a pulse of ultrasound. The pulse is reflected


from an object in the path of the user and is sent to the microcontroller. The
vibration increases as the distance between the user and the obstacles
decreases. The system has two modes of operation, record and playback. In
the record mode, the blind walks the route of interest, and the aid measures
the distance travelled by the user. When the blind reaches a decision point,
for example, the user takes a left turn and the user presses a key on the aid
coded with a left turn instruction. In the playback mode, the aid measures
again the distance travelled by the user. If it is equal to that stored in the
memory, a corresponding decision word generated by the synthesizer is
given to the blind. The system can store a number of routes, each of which is
numbered, and be selected using the same set of keys as for the decisions.

13
2.6 An Electronic White Cane For Blind People Navigation Assistance

This project propose a system named Smart Vision [5] which is able to
help the user to move around unfamiliar environment, whether indoor or
outdoor, through a geographical information using RFID technology.

2.6.1 Basic Concept

This project is based on a navigation system that uses RFID as the


main technology. The RFID tags are placed along the street walk where the
visionless persons may pass by and RFID reader located inside the walking
cane.

2.6.2 Working Principle

The main goal of Smart Vision project is to allow the blind person to
navigate himself in two different environment, indoor and outdoor. This
project used a stereo vision system, RFID tags, GPS for outdoor positioning
and GIS for indoor positioning. After getting the present position, through
GPS or RFID, the system feeds the user with applicable information with the
help of the GIS server, using Text to Speech software to convert text stored
in a database into audio signs.

The RFID tag reader is mounted at the bottom of the white cane. The
cane use USB to establish communication with the processing unit. Next, the
RFID tag reader unit is developed using Bluetooth to transmit data. A small
vibrator is also placed near the handle of the cane which is to alert the user
each time a tag is detected and allowing the user to know its relative position
to the tag.

14
Figure 2.6 RFID Tags Position

15
CHAPTER 3

METHODOLOGY

This chapter discusses the overall project implementations. It consists


of four parts, namely the general construction, project overview, electrical
design and software development.

3.1 General Construction

The walking stick used in this project is a ready-made stick readily


available from a shop. The walking stick with a hand held is chosen due to
several factors such as easy to hold and maintain. It is built from aluminum.
Figure 3.1 shows the stick to be used in developing the automated walking
stick. The walking stick is estimated about 130cm in length which is suitable
for average human height.

16
Figure 3.1 Aluminum Walking Stick

3.2 Project Overview

Figure 3.2 Project Block Diagram

17
Figure 3.2 demonstrates the block diagram of the overall system. The
system has an ultrasonic sensors which function simultaneously to detect
obstacles in the user path. The sensors detect the obstacle and resolve the
distance between the obstacle and the user. The output of the sensor will be
sent to the microcontroller.

The microcontroller receives the output signal from the sensor and
processes them. If the output signal is within the programmed distance
range, the microcontroller will activate the indicators. In this project, there is
an indicator used which is a buzzer.

The system has one more advantage feature integrated to help the
blind find their stick if they forget where they kept it. By pressing the button
on the transmitter circuit, the signal will be sent to the receiver and a speaker
will sound. The user can easily locate the stick by following the direction of
the sound.

3.3 Electronic Design

The electronic design of the system includes the ultrasonic sensor, Rf-
Tx module circuit, voltage regulator circuit, Arduino Nano, speaker, buzzer

18
and a switch, as shown in Figure 3.3.

Figure 3.3 View of the Main Circuit

3.3.1 Microcontroller Design

Figure 3.4 Microcontroller Pin Diagram

The brain of the entire system is the microcontroller where most part
of the data management is done here. The microcontroller used in this
project is Arduino Nano, as illustrated in Figure 3.5. Arduino board has an
ATMEGA328P microcontroller merged in it [12]. It has 32 KB of flash
memory of storing code. It also has 2 KB of SRAM and 1 KB of EEPROM.
The detail features of the microcontroller are as in Appendix E.

19
Figure 3.5 Arduino Nano

The microcontroller receives signals from the sensors and perform


data processing. It calculates the signals received before any action is taken
by the microcontroller.

3.3.2 Ultrasonic Range Sensor

The ultrasonic range sensor is used to detect the distance between


the user and the obstacles for above-knee and below-knee position. The
model of the sensor used is HC-SR04. The image of the sensor is illustrated
in Figure 3.6 below.

Figure 3.6 HC-SR04 Sensor

20
Ultrasonic waves are emmited from the module and is able to detect
obstructions within the range of 2cm – 400cm long. The operating voltage for
the sensor is 5V and the consumption current is 15mA. The range through
the time interval between sending signal and receiving echo signal can be
calculated using the formula [8]:

Range = High Level Time * Velocity (340µ/S)/2

3.3.3 Indicator

There are two indicators used in this project as the output of this stick.
For ultrasonic sensor, the indicators used is buzzer and for Rf-Tx module, the
indicator used is vibrator. Both indicators are triggered when there is obstacle
in the path of user and when the button pushed on the Eye Stick Finder. The
features of both indicators are described as below:

i. Buzzer

Figure 3.7 shows a buzzer with wire which a component that produces
a beeping sound based on the voltage supplied to it. It has two
terminals which are voltage supply and ground terminal. The operating
voltage range is 6V

21
Figure 3.7 Buzzer

ii. Speaker

Figure 3.8 shows a speaker with wire which a component that


produces a beeping sound based on the voltage supplied to it. It has
two terminals which are voltage supply and ground terminal. The
operating voltage range is 6V

Figure 3.8 Speaker

22
3.3.4 Power Supply

The battery used in this project is Alkaline type. The entire system is
powered up by a battery which is able to supply 9V with battery capacity of
400mAH. The power supply is high enough to power up all the components.
Otherwise, the system will not be able to operate well. So we build a voltage
regulator circuit to convert 9V into 5V to make the supply compatible with all
components.

Figure 3.9 Battery

3.3.5 Toggle Switch

The switch used in this project is a toggle switch. It consists of 3


terminals which are easy to do the connection. A user needs to gentlely push
the switch to power up the system. When the stick is not used and the switch
is turned off, this may safe the power of battery usage.

23
Figure 3.10 Toggle Switch

3.3.6 Transmitter and Receiver Module

For our additional feature which is Eye Stick Finder, the transmitter
and receiver module are used. The transmitter/receiver (Tx/Rx) pair operates
at a frequency of 434 MHz. An RF transmitter receives serial data and
transmits it wirelessly through RF through its antenna connected at pin4. The
transmission occurs at the rate of 1Kbps - 10Kbps.The transmitted data is
received by an RF receiver operating at the same frequency as that of the
transmitter.

24
Figure 3.11 Rx-Tx Module

3.4 Software Development

Software development is the most important part as to ensure that the


stick functions well. It includes the programming of the sensor with indicators
and the schematic diagram.

3.4.1 Programming of the Sensor and Indicators

The ultrasonic sensor and the buzzer must be declared in the coding
before it can be set within the specific ranges as shown in Figure 3.11 below.

Figure 3.12 Coding for Sensor and Buzzer

25
3.4.2 Distance Calculation

After the microcontroller received signal from the ultrasonic sensors,


the microcontroller does the processing of data to get the actual distance
travelled by the signal using the formula as shown in figure below. The
sensor will detect three differences distance which are up to 50cm, 30cm and
10 cm. Difference sounds of buzzer will show difference distance of the
sensor detected.

Figure 3.13 Distance Formula

3.4.3 Schematic Diagram

The schematic diagrams for this project are done using Fritzing
software. The whole circuit consists of two ultrasonic sensors, a buzzer, a
vibrator, a slide switch and the microcontroller. The schematic diagrams are
included in Appendix A.

3.5 Hardware Design

For this project, the hardware design had been drawn by using
Solidworks software. The design included the length of stick, the size of the
circuit box and the dimension of transmitter remote.

26
Figure 3.14 Length of Stick

Figure 3.15 Size of Circuit Box

27
Figure 3.16 Dimension of Transmitter Remote

28
CHAPTER 4

RESULT AND DISCUSSION

4.1 Response of Stick for Various Obstacles

The experiments are conducted to evaluate the performance of the


suggested methods. The ultrasonic sensor used gives the information about
the distance within a specific range. The circuit has been designed to
investigate the response of the sensor for various objects in cm. Table 4.1
shows the detection range for 4 types of objects.

Table 4.1 Detection Range for Various Object

29
4.2 Performance Analysis of Ultrasonic Sensor

The sensor emits high frequency of ultrasonic waves and give an


analog value at the output. The sensor is able to detect objects at ranges
between 2 - 400cm long. Table 4.2 shows the performance analysis of
ultrasonic sensor in obstacle detection.

Table 4.2 Performance Analysis of Ultrasonic Sensor

There is a slight difference between the values measured and


observed as in the table. It shows that the sensor is not capable of showing
the exact values and ended in errors. Figure 4.1 below shows the graph of
the performance analysis of ultrasonic sensor. The graph is almost in linear
form.

30
Figure 4.1 Graph Performance

4.3 Sensor Detection Analysis

After analyzing the performance of the sensor, the ultrasonic sensor


was tested with the present of indicator as the output. The analysis of below-
knee sensor position is explained as follow.

4.3.1 Above and Below-Knee Position

The range position of the sensor is divided into 3 different parts as


illustrated in the Figure 4.2.

31
Figure 4.2 Range detection

For the first operational range, the distance is set to vary from 0cm to
10cm. The second range is set from 30cm. The third range is set from 50cm
until it is out of range.

Table 4.3 Description of Sensor Detection

Position of the ultrasonic sensor is assigned with the same output from
the buzzer. The output for the first range which is between 0cm -10cm
produces continuous sound 1 beep per second. For second range which is
11cm - 30cm produces continuous sound 2 beeps per second and for the
third range which is from 31cm – 50cm produces continuous sound 3 beeps
per second which indicate that the user is close to the obstacles.

For undeclared range, which is from 50cm until it is out of range, the
buzzer will not produce any sound nor vibrate. It shows that the user is safe
to continue walking.

32
4.4 Eye Stick Finder

After analyzing the performance of Rx-Tx module. The module was


tested with the present of speaker as the output.

Table 4.4 Description of Eye Stick Finder

From the table above, we can conclude that the receiver can received
signal from the transmitter up to 10m. 10 m is a quite large distance so the
user may find their stick if they misplaced it somewhere in the house.

4.5 Logic Algorithm

The flowchart in Figure 4.3 explains the flow of object detection for
ultrasonic sensor. The sensor operates simultaneously and the system
repeats continuously. The outputs are set to be buzzer for different distance
ranges.

33
Figure 4.3 Flowchart for Ultrasonic Sensor

The flowchart in Figure 4.4 explains the flow of function for Eye Stick
Finder. The Rx-Tx module operates simultaneously and the system repeats
continuously. The outputs are set to be speaker.

34
Figure 4.4 Flowchart for Eye Stick Finder

4.5 Eye Stick

The walking stick called Eye Stick is made from aluminium and have
maximum length of 130cm and minimum length of 80cm.

35
.

Figure 4.5 Bottom View

Figure 4.5 shows the top view of the Eye Stick. The black box contains
the main circuit of the system. And there is the remote that contain
transmitter module.

Figure 4.6 Ultrasonic Sensor and Buzzer Position

36
Figure 4.6 shows the position of ultrasonic sensor and buzzer
position of the Eye Stick with the 3D printing casing to hold them. The full
image of the complete walking stick is shown in Figure 4.7.

Figure 4.7 Full Image View

37
CHAPTER 5

CONCLUSION AND FUTURE ENHANCEMENT

This chapter briefly discusses the conclusion and recommendations


for future advancement to enhance the development of the project.

5.1 Conclusion

The advancement of Eye Stick for the blind can be implemented using
several ways of distance measurement detection. Ultrasonic range sensor
and infrared sensor are examples of sensors that are appropriate for the
system. However, ultrasonic range sensor is more suitable to be
implemented due to several factors.

The ultrasonic range sensor is used in this project because it is small,


light in weight and consumer less power compared to infrared sensor [7]. It
also is less affected by some materials or by colour. The infrared sensor is
easily affected by sunlight and dark materials. Besides, it is capable of
detecting objects within 300cm .

38
The ultrasonic sensor used in this project is placed in front of the stick
to detect the obstacles in the user path. This method is very helpful for the
blind especially when they are moving alone for outdoor activities [10].

Using the Arduino Nano as the microcontroller for the Eye Stick has
improved the overall system. The sensors and indicators are easy to be
programmed and easy to be implemented with the microcontroller. In
conclusion, the project is successfully done and the objectives of the project
are achieved.

5.2 Future Enhancement

Some improvements are required for enhancement of the Eye Stick


for the blind. In order to improve it, the servo motor can be added at the
ultrasonic sensor so that it can rotate and detect any obstacles towards
extreme right and left side.

In addition, buzzer can be replaced with a voice indicator to notify the


actual distance between the obstacles and the user. A water sensor
detection also can be added to the walking stick [9].

The ultrasonic range sensor can be replaced with infrared sensor for
larger range of obstacles detection. The battery selection is also an important
part. It can be improved by implementing a rechargeable battery.

39
REFERENCES

[1] Jayant Sakhardande, Pratik Pattanayak, and Mita Bhowmick, Arduino


Based Mobility Cane. International Journal of Scientific & Engineering
Research. Mumbai, India. April, 2013.

[2] K. Divya, P. Dhivya, R. Gayathri, and P. Govindaraj, Electronic


Guiding Stick to Assist the Visually Challenged. AIM/CCPE 2012,
CCIS 296. Bangalore, India. 2012.

[3] Bin Ding, Haitao Yuan, and Xiaoning Zang, The Research on Blind
Navigation System Based on RFID. University of Science &
Technology of China, 2007.

[4] Mounir Bousbia-Salah, Abdelghani Redjati, Mohamed Fezari and


Maamar Bettayeb, An Ultrasonic Navigation System For Blind People.
IEEE International Conference on Signal Processing and
Communications. Dubai, United Arab Emirates. November, 2007.

[5] Faria J, Lopes S, Fernandes H, Martins P and Barroso J, Electronic


White Cane For Blind People Navigation Assistance. World
Automation Congress. 2010.

[6] Liyana binti Ramli (2011). Development of An Electronic Walking Stick


For The Visually Impaired With Z-Axis Detection, Bachelor Degree
Universiti Teknologi Malaysia, Skudai.

[7] Capstone Project (2013). Compact Stick, Universiti Teknologi


Malaysia, Skudai.

[8] Tarek Mohammad, Using Ultrasonic and Infrared Sensors for Distance
Measurement. World Academy of Science, Engineering and
Technolog, 200903-26. Chittagong, Bangladesh. 2009.

[9] Srirama Divya, B.Navya, P.Suma Manasa and S.Chitra (2010).


Ultrasonic And Voice Based Walking Stick For The Blind, Bachelor
Degree Gokaraju Rangaraju Institute Of Engineering And Technology,
Hyderabad.

[10] Krishna Kumar (2014). Development of Walk Safe Cane For The
Rehabilition Of Blind People, Bachelor Degree National Institute Of
Technology Rourkella.

40
APPENDIX A

A.1 Microcontroller Stick Diagram

41
APPENDIX A

A.2 Ultrasonic Schematic Diagram

42
APPENDIX A

A.3 Buzzer Interface Schematic Diagram

43
APPENDIX A

A.5 Toggle Switch Interface Schematic Diagram

44
APPENDIX B

Features of Microcontroller

45
APPENDIX C

Source Code

#define trig 7

#define echo 6

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

pinMode(trig, OUTPUT);

pinMode(echo, INPUT);

pinMode(5, OUTPUT);

void loop() {

// put your main code here, to run repeatedly:

long dist,duration;

digitalWrite(trig,LOW);

delayMicroseconds(2);

digitalWrite(trig,HIGH);

46
delayMicroseconds(2);

digitalWrite(trig,LOW);

duration = pulseIn(echo,HIGH);

dist= (duration/2)/29.1;

if(dist > 31 && dist <= 50){

digitalWrite(5,HIGH);

delay(50);

digitalWrite(5,LOW);delay(100);

else if(dist>21 && dist<=30){

digitalWrite(5,HIGH);

delay(80);

digitalWrite(5,LOW);

delay(80);

digitalWrite(5,HIGH);

delay(80);

digitalWrite(5,LOW);delay(100);

47
else if(dist > 0 && dist <=20){

digitalWrite(5,HIGH);

delay(50);

digitalWrite(5,LOW);

delay(50);

digitalWrite(5,HIGH);

delay(50);

digitalWrite(5,LOW);

delay(50);

digitalWrite(5,HIGH);

delay(50);

digitalWrite(5,LOW);delay(60);

else{}

//Serial.println(duration);

Serial.println(dist);

48
APPENDIX D

Datasheet HC-SR04

49
APPENDIX E

Datasheet of Transmitter and Receiver Module

50
APPENDIX F

Circuit Simulation ( Voltage Regulator)

51
APPENDIX G

Circuit Simulation ( Arduino Nano + Voltage Regulator)

52

You might also like