0% found this document useful (0 votes)
145 views29 pages

Echolocation and Blind Navigation System: Mini Project Report

An echolocation and blind navigation system was developed by Nimitha K. and Saheena M.S. as a mini project report submitted in partial fulfillment of their MTech degree. The system uses ultrasonic sensors to detect obstacles around a blind person and provides audio feedback to guide the user. The hardware consists of a microcontroller, ultrasonic sensors, and speaker. The aim is to provide a low-cost and efficient navigation aid for the blind by giving them a sense of artificial vision through surrounding sound cues.

Uploaded by

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

Echolocation and Blind Navigation System: Mini Project Report

An echolocation and blind navigation system was developed by Nimitha K. and Saheena M.S. as a mini project report submitted in partial fulfillment of their MTech degree. The system uses ultrasonic sensors to detect obstacles around a blind person and provides audio feedback to guide the user. The hardware consists of a microcontroller, ultrasonic sensors, and speaker. The aim is to provide a low-cost and efficient navigation aid for the blind by giving them a sense of artificial vision through surrounding sound cues.

Uploaded by

lekshmidevi m
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

ECHOLOCATION AND BLIND

NAVIGATION SYSTEM

Mini Project Report


Submitted in partial fulfillment of the requirements for the award of Mtech degree in
Electronics and Communication Engineering with specialization in
Microwave and Television Engineering of
the A P J Abdul Kalam Technological University

by

NIMITHA K. (TVE17ECMT09)
SAHEENA M.S. (TVE17ECMT12)

Second Semester
MTech in Electronics and Communication Engineering
with specialization in Microwave and Television Engineering

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

COLLEGE OF ENGINEERING TRIVANDRUM


KERALA

April 2018
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
COLLEGE OF ENGINEERING
TRIVANDRUM

CERTIFICATE

This is to certify that this Project report entitled “Echolocation and blind navigation
system” is a bonafide record of the work done by NIMITHA K. and SAHEENA
M.S, under our guidance towards partial fulfilment of the requirements for the award
of the Degree of Master of Technology in Electronics and Communication with
specialization in Microwave and Television Engineering, of the A P J Abdul Kalam
Technological University during the year 2017-2019.

Dr. Pradeep R. Prof. Sanoj Viswasom Dr. Ciza Thomas


Assoc.Professor Asst.Professor Professor
Dept. of ECE Dept. of ECE Dept. of ECE
(Project Co-ordinator) (Project Co-ordinator) (Head of the Department)
ACKNOWLEDGEMENTS

Any mission never completes without the cordial co-opertaion from surround-
ings. We hereby acknowledge all the people who have helped us through different
stages of this project.

We are highly indebted to our project coordinators Dr. Pradeep R and Prof. Sanoj
Viswasom for their expert guidance and advice in presenting the project. We express
our sincere thanks to Dr. Ciza Thomas , Head of Department of Electronics and Com-
munication Engineering. We are profoundly grateful to all our classmates and friends
for their valuable help and support.

Above all, we thank God, the Almighty without whom none of this would have been
possible.

Nimitha K.

Saheena M.S.

ii
ABSTRACT

The main concept of the project is to provide a smart electronic aid for blind
people. The echolocation and blind navigation system is mainly intended to provide
overall measures ie, Artificial vision and object detection. The aim of the project is to
provide a low cost and efficient navigation aid for blind which gives a sense of artificial
vision by providing information about the environ-mental scenario . The significance of
this project is to help the visually impaired people with appropriate sound. Ultrasonic
sensors are used to calculate distance of the obstacles around the blind person to guide
the user towards the available path. Output is in the form of surround sound that the
blind person can hear. The hardware consists of microcontroller, ultrasonic sensors and
speaker. The code is written in arduino.

iii
TABLE OF CONTENTS

1 INTRODUCTION 1

1.1 BACKGROUND DISCRIPTION . . . . . . . . . . . . . . . . . . . 1

1.2 OBJECTIVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 LITERATURE REVIEW 3

3 PROPOSED METHEDOLOGY 6

3.1 OBJECT DETECTION . . . . . . . . . . . . . . . . . . . . . . . . 6

4 SYSTEM DESIGN 7

4.1 COMPLETE BLOCK DIAGRAM . . . . . . . . . . . . . . . . . . 7

5 HARDWARE IMPLEMENTATION 9

5.1 ATMEGA 328 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

5.1.1 MAIN FEATURES . . . . . . . . . . . . . . . . . . . . . . 9

5.1.2 PERIPHERAL FEATURES . . . . . . . . . . . . . . . . . 10

5.2 ARDUINO UNO . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

5.3 ULTRASONIC SENSOR . . . . . . . . . . . . . . . . . . . . . . . 12

5.3.1 WORKING OF SENSOR . . . . . . . . . . . . . . . . . . 13

5.3.2 TARGET DETERMINATION . . . . . . . . . . . . . . . . 14

5.4 SPEAKER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6 SOFTWARE IMPLIMENTATION 15

iv
6.1 FLOW CHART . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

7 RESULTS 17

8 CONCLUSION AND FUTURE SCOPE 18

v
LIST OF FIGURES

4.1 Block Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

5.1 Pinout of Atmega 328. . . . . . . . . . . . . . . . . . . . . . . . . . 9

5.2 Arduino uno. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.3 Ultrasonic sensor HC-SR05. . . . . . . . . . . . . . . . . . . . . . . . 12

5.4 working mechanism of sensor. . . . . . . . . . . . . . . . . . . . . . . 13

5.5 The timing diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.6 Calculation of distance. . . . . . . . . . . . . . . . . . . . . . . . . . 14

5.7 Speaker. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6.1 Flow chart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

7.1 Implimented system. . . . . . . . . . . . . . . . . . . . . . . . . . . 17

vi
CHAPTER 1

INTRODUCTION

1.1 BACKGROUND DISCRIPTION

Darkness is a state in which we all loose our ability to navigate ourselves even if we
are familiar to our surroundings. So imagine the difficulty of a visually impaired person
who is in permanent darkness to move around. Obstacles which are not dangerous
to ordinary people may become dangerous to them.So accessibility of everyday life
environments for visually impaired attracts public interests and different techniques are
used around to assist them .

Moving through an unknown environment becomes a real challenge when we


can-not rely on our own eyes. Since dynamic obstacles usually produce noise while
moving, blind people develop the ability of hearing to localize them. However they
are reduced to their sense of touch when the matter is to determine where an inanimate
object exactly is. The common way for navigating of vision less person is using a
walking stick cane or walking cane.

A lot of studies have been done to develop a system which assists blind people. We
have various equipment in market like smart specs,electronic cane etc for assisting the
blind but they have their limitations and is very expensive.

1
1.2 OBJECTIVE

The aim of our project is to design a cheap and user friendly echolocation and blind
navigation system that gives feedback to the subject in form of audio signals.It gives
a sense of artificial vision by providing information about the environmental scenario
. This improves the mobility of both blind and visually impaired people(VI) for their
routine life.It is developed to help the blind person to navigate alone safely and to avoid
any obstacles that may be encountered, whether stationary or mobile, and to prevent
any possible accident.

Ultrasonic sensors are used to calculate distance of the obstacles around the blind
person to guide the user towards the available path.The techniques of distance measure-
ment using ultrasonic in air include continuous wave and pulse echo technique.In the
pulse echo method, a burst of pulses is sent through the trans-mission medium and is
reflected by an object kept at specified distance. The time taken for the pulse to prop-
agate from transmitter to receiver is proportional to the distance of object. For contact
less measurement of distance, the device has to rely on the target to reflect the pulse
back to itself. The target needs to have a proper orientation that is it needs to be per-
pendicular to the direction of propagation of the pulses. The amplitude of the received
signal gets significantly attenuated and is a function of nature of the medium and the
distance between the transmitter and high levels of signal attenuation when used in an
air medium, thus limiting its distance target. The pulse echo or time-of-ight method of
range measurement is subject to range. The echo signals are used as inputs to micro-
controller and the microcontroller is then used to determine the distance of the objects
around the blind man.

2
CHAPTER 2

LITERATURE REVIEW

• A Wearable Mobility Aid for the Visually Impaired based on embedded


3D Vision and Deep Learning.(Matteo Poggi,Stefano Mattoccia,University
of Bologna)

Autonomous mobility can be a serious problem for people suffering of visual


impairments and, even when walking on a well-known route, there are hazards
along their path. While some are stationary and thus their position can be learned,
many others are not (people, cars, etc.) and hence cannot be predicted beforehand.
The white cane enables to detect nearby obstacles, but it requires physical contact,
so it cannot detect farther objects. Moreover, it cannot detect floating objects,
such as bars or branches. Trained dogs can help in these circumstances but, not
without limitations due to the training cost and the relative short life of a dog.

In recent years, many devices exploiting different technologies such as GPS,


sonar, vision and others described later have been proposed. However, most of
them are cumbersome and not be suited for everyday activities due to the short
battery life or other specific constraints related to the adopted technology. On the
other hand, the rapid technology progress, mainly driven by the mobile/embedded
market, enables the deployment of very powerful computing devices character-
ized by limited energy requirements. This fact has lead many researchers, with
different degrees of effectiveness, to propose systems aimed at improving every-
day life to people suffering of disabilities. One of the most critical activity is
concerned with autonomous mobility: a navigation device should effectively de-
tect any potential hazard and promptly inform the user. Moreover, an effective
mobility aid should be designed with a deep understanding of the user require-
ments.

3
This system relies on the dense and accurate 3D data provided in real-time by
a custom RGBD camera worn on glass frames for blind users and with a differ-
ent arrangements for other kind of visual impairments. Depth data and 2D images
provided by such sensor are processed, by an embedded CPU board, to accurately
detect potential obstacles and to categorize them by means of deep-learning tech-
niques.The user perceives the surrounding environment sensed by the 3D camera
by means of an haptic interface and audio messages that summarize the outcome
of scene interpretation. The overall system is extremely small and lightweight,
about 250 g including a small battery enabling 3 hours of navigation making it
truly wearable. The evaluation reported in this paper shows that our proposal has
excellent performance in terms of obstacle detection reliability and promising
categorization capabilities.

• Design of an Ultrasonic Auditory-Vision Teach-ing Device.(Rayan Fayad, Ali


Hage-Diab Department of Biomedical Engineering Lebanese International
University)

Echolocation is the perception of objects and their location from the echoes of
chirps reflected off those objects. Bats use echolocation to navigate and find food.
To echolocate, bats send out sound waves from their mouth or nose. When the
sound waves hit an object they produce echoes. The echo bounces of the object
and returns to the bats ears. The echo contains information about location, shape
and textures of the object.

Daniel Kish is blind, and taught himself to navigate his way around by clicking
his tongue and listening to the echoes produced. Daniel, a mobility specialist and
psychologist, is now widely regarded as one of the world’s foremost experts on
the use of echolocation. He developed Flash Sonar, a holistic technique based on
highly trained listening skills that can be taught to young people with sight loss
from an early age. Daniel Kish’s techniques are based on the fact that echoes
contain detailed information: an echo will vary according to whether a space is

4
open or closed, what shape it has, and what the surfaces are made of. He now
heads the organization -World Access for the Blind and he has helped over 7000
students in over 30 countries .

The objective of the proposed design is to create a travel aid that simulates
human echolocation according to the method of Daniel Kish. The new device will
offer enhancements over the latter technique since it requires no effort because
tongue clicking is no longer required and the echo can be processed and amplified
electronically. Also, it will become more socially acceptable since it is non-
audible. Moreover, it will make the technique readily available for the blind.

5
CHAPTER 3

PROPOSED METHEDOLOGY

This is a Atmega328 based project to develop a cost effective and most eficient nav-
igation aid for blind as well as elderly people in the low visibility area. The suggested
navigation system helps in walking safely through appropriate tactile feedbacks corre-
sponding to the echo signal from obstacles in front of the user. Atmega328 is interfaced
with an arduino board. Arduino is an open-source electronics platform based on easy-
to-use hardware and software.

3.1 OBJECT DETECTION

Ultrasonic sensors are used to object detection. They are used to calculate distance
of the obstacles around the blind person to guide the user towards the available path.
A trigger input pin is used to trigger an ultrasonic burst and then listen for the echo
return pulse. The sensor measures the time required for the echo return and returns
this value to the Atmega328 as variable width pulse via the echo pin connected to the
microcontroller. The return signal is then processed by the control circuit (Atmega328)
to calculate the time diference between the signal being transmitted and received. Along
with clever math, the time can be used to calculate the distance between the sensor and
the reflecting object. The three sensors give corresponding feedbacks to the aurdio.

They indicate the position of the object through vibrations of the motor. The data
from these sensors are given to the Atmega328 .The 3 ultrasonic sensors send trigger
pulse to 3 directions for obstacle detection. The presence of target is indicated by
an echo pulse received by sensor. Again the sensor calculates the distance of object
corresponding to the rst trigger signal and produces a corresponding audio feedback.

6
CHAPTER 4

SYSTEM DESIGN

4.1 COMPLETE BLOCK DIAGRAM

Figure 4.1: Block Diagram.

The block diagram of the system consists of 4 essential components: Microcon-


troller, ultrasonic sensors, power supply and speaker system. Atmega328 is con-nected
with regulated power supply. The Atmega328 takes the readings from the sensors,
analysis the result and does the object detection according to the speed of echo. The
result is given to the surround sound headset placed over the head. The instructions are
provided to the blind via this audio feedback.

The proposed system can be implemented as shown in the Fig.The three ultra-sonic
sensors send trigger pulse to three directions for obstacle detection. The presence of

7
target is indicated by an echo pulse received by sensor. The sensor calculates the dis-
tance of object corresponding to the rst trigger signal. Again sensor sends trigger pulse
to check whether it is moving or stationary one and produces a corresponding audio
signal on headsets. If the second distance (vi-bration) produced as calculated by sensor
is lesser/greater than that of rst one, the object is moving. Otherwise object is station-
ary. If the object is detected on left side, the object will detected by left sensor (on
shoulders) and audio signal corresponding to the sensor will be fed back to ear. Thus
an artificial vision is provided to user by appropriate audio feedback.

8
CHAPTER 5

HARDWARE IMPLEMENTATION

5.1 ATMEGA 328

Figure 5.1: Pinout of Atmega 328.

5.1.1 MAIN FEATURES


• High Performance,

• Low Power AVR 8-Bit Microcontroller

• Advanced RISC Architecture

• powerful Instructions

• Most Single Clock Cycle Execution

• 32 x 8 General Purpose Working Register Up to 20 MIPS Throughput at 20 MHz


On-chip 2-cycle Multiplier

• 4/8/16/32K Bytes of In-System Self-Programmable Flash program memory for


Atmega48PA/88PA/168PA/328P).

9
• 256/512/512/1K Bytes EEPROM (ATmega48PA/88PA/168PA/328P)

• 512/1K/1K/2K Bytes Internal SRAM (ATmega48PA/88PA/168PA/328P) Data re-


tention: 20 years at 85C/100 years at 25C(1)

5.1.2 PERIPHERAL FEATURES


• powerful Instructions

• Most Single Clock Cycle Execution

• 32 x 8 General Purpose Working Register Up to 20 MIPS Throughput at 20 MHz


On-chip 2-cycle Multiplier

• 4/8/16/32K Bytes of In-System Self-Programmable Flash program memory for


Atmega48PA/88PA/168PA/328P).

• 256/512/512/1K Bytes EEPROM (ATmega48PA/88PA/168PA/328P)

• 512/1K/1K/2K Bytes Internal SRAM (ATmega48PA/88PA/168PA/328P) Data re-


tention: 20 years at 85C/100 years at 25C(1)

5.2 ARDUINO UNO

Arduino is an open source, computer hardware and software company, project, and
user community that designs and manufactures Single-board microcontrollers and mi-
crocontroller kits for building digital devices and interactive objects that can sense and
control objects in the physical world. Arduino boards are relatively inexpensive com-
pared to other microcontroller platforms. The Arduino Software (IDE) runs on Win-
dows, Macintosh OSX, and Linux operating systems. Most microcontroller systems
are limited to Windows. The Arduino Software (IDE) is easy-to-use, yet exible enough
for advanced users to take advantage of as well. It has 14 digital I/O pins out of which
three are pulse width modulated outputs. It has USB connectivity and power rewuired
is 5V which can be supplied through the power jack. Also 5V outputs can be obtained
from the board which has been used to power the sensors and speakers in this project.

10
This project utilises two arduino boards. This is because we need to access more pins.
Here the number of sensors and speakers used are more. Also utilising two arduino
boards has the advantage of system working even if one board fails.

Figure 5.2: Arduino uno.

11
5.3 ULTRASONIC SENSOR
• Range required Above 3m

• Low cost

• Less power consumption

• Accuracy in measurements

• Lower beam width

• Compatible with arduino uno

Figure 5.3: Ultrasonic sensor HC-SR05.

Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These
propagate in the air at the velocity of sound. If they strike an object, then they are re
ected back as echo signals to the sensor, which itself computes the distance to the target
based on the time-span between emitting the signal and receiving the echo.Ultrasonic
sensors depend on two separate devices: an ultrasonic transduce and a detector. An
ultrasonic transducer is any device that converts energy into an ultrasonic frequency.
Though dog whistles and several other devices can con-vert mechanical energy into
ultrasonic frequency, ultrasonic transducer are usually made from piezoelectric crystals
that can change size when a voltage is applied to them. When an alternating current is
applied to a piezoelectric crystal, it vibrates extremely fast and produces an ultrasonic
sound wave. The detector is also made of a piezoelectric crystal, but produces a voltage
when an ultrasonic frequency comes in contact with it, effective producing the opposite

12
results. A sensor calculates the time that it takes in between broadcasting the ultrasonic
frequency and receiving the incoming waves. Frequency sound waves and receive the
echo reflected by the target. These sensors are used in a wide range of applications and
are very useful when it is not important in the detection of colours surface texture or
transparency.

Figure 5.4: working mechanism of sensor.

5.3.1 WORKING OF SENSOR

When a trigger signal of 10microseconds is given the module automatically transmit


eight 40kHz ultrasonic burst. If there is an obstacle at the front of the module, it will
reflect the ultrasonic burst. If the signal is back, ECHO output of the sensor will be in
HIGH state (5V) for a duration of time taken for sending and receiving ultrasonic burst.
Pulse width ranges from about 150mS to 25mS and if no obstacle is detected, the echo
pulse width will be about 38ms.

Figure 5.5: The timing diagram.

13
5.3.2 TARGET DETERMINATION

Precise distance of an object moving to and from the sensor are measured via time
intervals between transmitted and reflected bursts of ultrasonic sound. example shows a
target detected at six inches from sensor and moving to 10 inches. The distance change
is continuously calculated and outputted.

Figure 5.6: Calculation of distance.

5.4 SPEAKER

8 ohm 1.5Watt mini loudspeakers are used in this project which is su cient for the
amplitude and frequency requirements. The diaphragm is aluminium made and has
rubber surround. It has moulded plastic frame making it compact and suitable for the
surround sound heaset.

Figure 5.7: Speaker.

14
CHAPTER 6

SOFTWARE IMPLIMENTATION

6.1 FLOW CHART

15
Figure 6.1: Flow chart.

This is a basic block diagram of the complete program which includes only one sen-
sor and one speaker. When the trigger is send, the sensor sends an ultrasonic burst. If
there is an object echo is received. With this echo the distance of the object is calcu-
lated. If the object is within 0.4m range (very near), then a sound of frequency 900hz is
produced. If the distance is between the range of 0.4m and 0.8m, then a sound of 500hz
is produced. And if the distance is between 0.8m and 1.5m a sound of frequency 300hz
is produced. This enables the blind person to understand the location of the object and
how far it is located.

16
CHAPTER 7

RESULTS

At first the whole system was checked by simply placing obstacles in front of the
different sensors at different distances. The speaker produced corresponding outputs.
So the system was found to function as programmed. The obstacles such as walls,
tables, chairs and other humans could be identified. Overall the purpose of the aim was
served.T he person could listen to the sound and change directions in response. The
person could also hear the surrounding sounds too. It was easier to use the system for a
long time.

For the easiness of walking the circuits and boards were kept in a box and was de-
signed suitably so that it could be worn easily. The sensor near the foot could sense
stairs to an extend.It cost around 1500/- for the system including all the components.

Figure 7.1: Implimented system.

17
CHAPTER 8

CONCLUSION AND FUTURE SCOPE

A new concept of surround sound audio headset for blind people was presented.
The proposed method easily detects the objects infront of the blind using ultra-sonic
sensors. The output is obtained through mini speakers thereby providing an arti cial
snese of vision. This system provides a low cost and e cient naviga-tion aid for blind
which gives a sense of arti cial vision by providing information about the environmental
scenario of static and dynamic objects around them and ensures their safety. The project
is novel electronic gadget for blind and can be used by the blind with a small practice.
Using this system the blind can walk freely in his surroundings without much limitation.
Our system helps the blind as well as the visually impaired who lost their vision in the
later period of life to lead an independent life.

In this project, the obstacle identification is by using ultrasonic sensors. In future this
can be substituted by image processing. Image processing is the analysis and manipu-
lation of a digitized image by using mathematical operations. It is the most advancing
technology and is right at its core. So in future obstacle detection can be made by us-
ing image processing which increases the information that we obtain about the obstacle
also.

18
BIBLIOGRAPHY

[1] Prof. L Kay,University of Canterbury, New Zealand,Radio and Electronic Engineer


,Vol.44,No.11, November 1974. A Sonar aid to enhance spatial perception of blind:
engineering design and evaluation .

[2] Matteo Poggi,Stefano Mattocia,IEEE Workshop on ICT solutions for eHealth 2016
A Wearable Mobility Aid for visually im-paired based on embedded 3d vision and
deep learning .

[3] Rayan Fayad, Ali Hage-Diab, "Design of an Ultrasonic Auditory-Vision Teach-ing


Device

19
Appendix

Code for the system


# i n c l u d e < U l t r a s o n i c . h>
i n t ch1 = 4 ; / / s t r a i g h t
i n t ch2 = 5 ; / / l e f t
i n t ch3 = 6 ; / / r i g h t
i n t ch4 = 7 ; / / s t o p
i n t s1 ;
i n t s2 ;
i n t s3 ;

Ultrasonic Ultr1 (12 , 13);


Ultrasonic Ultr2 (10 , 11);
Ultrasonic Ultr3 (8 , 9);
void setup ( ) {
S e r i a l . begin (9600);
// initialize d i g i t a l p i n 13 a s an o u t p u t .
voice_init ();
/ / v o i c e _ p l a y ( ch1 ) ;
/ / v o i c e _ p l a y ( ch2 ) ;
/ / v o i c e _ p l a y ( ch3 ) ;
/ / while ( 1 ) ;
}

/ / t h e l o o p f u n c t i o n r u n s o v e r and o v e r a g a i n f o r e v e r
void loop ( ) {

s1 = ( U l t r 1 . d i s t a n c e R e a d ( ) ) ; d e l a y ( 5 0 0 ) ; / / f r o n t

20
s2 = ( U l t r 2 . d i s t a n c e R e a d ( ) ) ; d e l a y ( 5 0 0 ) ; / / l e f t
s3 = ( U l t r 3 . d i s t a n c e R e a d ( ) ) ; d e l a y ( 5 0 0 ) ; / / r i g h t
S e r i a l . p r i n t ( " D i s t a n c e i n CM: " ) ;
S e r i a l . p r i n t ( s1 ) ;
Serial . print (" ") ;

S e r i a l . p r i n t ( s2 ) ;
Serial . print (" ") ;

S e r i a l . p r i n t l n ( s3 ) ;

i f ( s 1 < 50 && s 2 < 50 && s 3 < 5 0 )


{
v o i c e _ p l a y ( ch4 ) ; / / s t o p
}
e l s e i f ( s 1 < 50 && s 2 < 50 )
{
v o i c e _ p l a y ( ch3 ) ; / / r i g h t
}
e l s e i f ( s 1 < 50 && s 3 < 50 )
{
v o i c e _ p l a y ( ch2 ) ; / / l e f t
}
e l s e i f ( s 1 < 50 )
{
v o i c e _ p l a y ( ch2 ) ; / / l e f t
}
else
{
v o i c e _ p l a y ( ch1 ) ; / / s t r a i g h t
}

21
void v o i c e _ i n i t ( )
{
pinMode ( ch1 , OUTPUT ) ;
pinMode ( ch2 , OUTPUT ) ;
pinMode ( ch3 , OUTPUT ) ;
pinMode ( ch4 , OUTPUT ) ;

d i g i t a l W r i t e ( ch1 , HIGH ) ;
d i g i t a l W r i t e ( ch2 , HIGH ) ;
d i g i t a l W r i t e ( ch3 , HIGH ) ;
d i g i t a l W r i t e ( ch4 , HIGH ) ;
}
void voice_play ( i n t channel )
{
d i g i t a l W r i t e ( c h a n n e l , HIGH ) ;
delay (100);
d i g i t a l W r i t e ( c h a n n e l , LOW) ;
delay (100);
d i g i t a l W r i t e ( c h a n n e l , HIGH ) ;
delay (500);
}

22

You might also like