You are on page 1of 21

EE 316 - Electronic Design Project

Project: 09
Ultrasonic Distance Measurement
Device


Final Project Report
26 May 2014







Objective
People were used to measure the distance with the help of the mechanical
devices. However, lots of way exists to measure the distance without direct contact
thanks to the advances over the technology. One way is to use ultrasonic sound waves
that propagate greater than 20 KHz frequencies, and is produced and noticed by
ultrasonic transducers. The aim of this project is to design the ultrasonic distance
measurement device that can quantify the distance between 10 cm to 100 cm with the
accuracy of 0.5 cm. Furthermore, the result will be shown on the Seven-Segment
display.




Group Members
Common efforts: Ultrasonic Transducer
Mehmet Salih Ekinci: Oscillator and Trigger Circuit, Signal Amplification
Alican ahin: BCD counter, Seven - Segment Display, Detection Circuit




Revision History



Week-8: Ultrasonic drive circuit was constructed because of the transmission electric
power increase.

Week-9: Counter clock circuit did not work properly, so we decided to set up the circuit
with a different way which consisted of NE555 IC timer.

Week-10: Counter adjustment circuit was set, because it helps the counter to count
stable.


1. Introduction

We must get over five major design challenges in designing an ultrasonic distance
measurement device:

1. Driving Ultrasonic Transducer: Ultrasonic transducers are driven at 40 kHz
resonant frequency. To provide this condition, we build an oscillator circuit which
generates 40 kHz square wave, with Timer 555 IC.

2. Timing adjustment: We need to start and stop the counter in order to calculate the
distance accurately. Thats why we set up a trigger circuit with another Timer 555 IC.

3. Amplifying received signal: The signals which are reflected from the surface have
low amplitude and power, so they are hard to detect. Thus, an amplification circuit,
which is built with LM358 ICs, helps us to fix this situation.

4. Detection of the signal: The signal from the amplifier is passed through first an
envelope detector that is to form the signal for comparator circuit. Simply we can design
an envelope detector circuit with diodes and capacitors. The comparator compares a
reference voltage level and input signal to get rid of the noises and false triggering. The
signal is a series of square pulses that will give stop command to counter. We used
again LM358 for the comparator circuit.

5. Counting and Displaying: In order to find the distance between ultrasonic sensor
and the obstacle, we need to know the time travel. The time delay between the
corresponding edges of the transmitted and received pulses is calculated by the
counter circuit. This gives time of travel. The 3-digit BCD counter that is 4553 IC is used
for measuring the propagation time of the ultrasonic sound waves. We can transform
this time delay to distance with the proper selection of clock frequency.


2 x (Distance) = (speed of sound in air) x (time).


Following paragraphs summarize the necessary background information for the
key technologies utilized in this project.




1.1. Ultrasound waves
Sound occurs by some mechanical process that caused by pressure and vibration
of the molecules of a medium, and propagates through the some medium such as air or
water. [1] There are some variables, that we should take into consideration, on
propagation of sound in air which are listed below;
Pressure: There is no effect on the speed of the sound.(affects the density)
Temperature: it affects the speed of the sound directly according to this formula
below;

.
T: temperature in Celsius
At room temperature which is 20 C, speed of sound is 343, 4 m/s
Frequency: due to the components that we will generate the sound is working at
40 KHz, frequency alteration is not affected.

In this project, we are interested in ultrasound waves which have following properties;
Greater than 20 KHz which is beyond the range of the hearing for human.
Having high energy contrast to smaller wavelength.
Longitudinal wave which means easy to reflects from solid obstacles.

Ultrasonic is not a kind of wave, it is an application of the ultrasound. [1]


1.2. Ultrasonic Transducer
Ultrasonic transducer generates ultrasound waves and works as both receiver,
which converts to mechanical energy to electrical energy, and detector, which converts
electrical energy to mechanical energy. This conversion is made by piezoelectric
material, which is a crystal, and called piezoelectric effect. Piezoelectricity makes
possible the alteration of one form of the energy to another form which in this situation
mechanical energy to electrical as shown in Figure 1.


Figure1: Piezoelectric effect

Furthermore, the inverse operation is possible as depicted in Figure 2.



Figure 2: Inverse piezoelectric effect

We can measure the distance when we find the total time of the transmission and
reflection of the wave and speed of sound in the air. However, some variables, which
are listed below, can affect the reflection of the wave as depicted in figure 3
Size of object: The larger object is, the stronger reflection of wave occurs with
respect to wavelength of wave.
Distance: If the distance between object and source is getting smaller, it causes
the stronger echo.
Angle: When the source is perpendicular to the object, we get stronger echo.
Surface: The harder and the smoother surface of the object we have, the
stronger echo we get.

Figure 3: Sound Reflection Cases


1.4. Timer circuit
Timer circuit is one of the most useful ICs in electronic world, because it can
work as;
Oscillator
Time delay
Pulse generation
Flip-flop.
The timer circuit has 3 different modes;
1. Monostable: Works as a one-shot pulse generator.
2. Astable: Runs as an oscillator.
3. Bistable: Operates as a flip-flop.

In our design, we use timer circuit due to the fact that we need time delay, oscillator
and generating the signal pulse.


1.4. Signal Amplification
Transmitted signals recover by reflection from the object and receiver sensor detect
reflected signal. However, reflected signals have low amplitude and less strength.
Because of that, we will use two types of amplifier;
Power amplifier: Output signal power is larger than input signal power, that is, a
power amplifier amplifies the power of the input signal. Most power amplifiers are
used as the final amplifier and control the output device.

Voltage amplifier: A voltage amplifier increases the input voltage level of the
signal.


1.5. BCD Counter

In digital logic, a logic counter is a device which stores the number of times of a
particular event in relationship to a clock signal. There are two types of operations
which are used for purpose of counting.
1) Synchronous Counter: All flip-flops receive the common clock pulses.
2) Asynchronous (Ripple) Counter: The clock pulse is given to the first flip-flop
and the other flip-flops use the output of the previous flip-flop as a clock pulse.
We use synchronous BCD counter because it is faster than the ripple counter. In
BCD counters, a digit is usually represented by 4 bits; in general, represent the decimal
digits 0 through 9.

1.6. Seven - Segment Display
A seven - segment display can be used to display the decimal numbers 0 to 9
which is shown in figure 4. There are two types of configurations;
Common anode
Common cathode.
The resistor value determines the amount of current that is following through the
LED in the seven segment display. If the resistor is too large, the current will be
too small and the LED will not be visible. If the resistor is too small, the current will
be too large and the LED will be damaged.


Figure 4: Configuration of a seven segment display

2. Technical Description
The distance of an object can be calculated from knowing the time interval
between the transmitted and received wave, and the speed of sound in the air which is
343.4 m/s. To determine the time interval we will use a BCD counter. The time interval
can be dispatched to the counter as start and stop commands. After that, in order to
give the correct time duration in the counter output, we should choose a clock
frequency correctly.
We will use a 40 kHz transducer at the transmitter part of the design. In order to
drive the transmitter, we will produce a 40 kHz square wave which is the resonant
frequency of the transmitter part of the design, and this signal is produced by the Timer
555 in astable mode. Moreover, to succeed the range specification, we require sending
this signal for a signified time interval. To send the signal and pause it for this specified
time, we will use a trigger circuit which consists of a Timer 555 in monostable mode.
Trigger circuit will help us to prevent from starting again the counter before the received
signal is detected, and to set the on-off time of our signals by arranging the capacitors
and resistors values.

Figure 5: Block diagram of ultrasonic distance meter

At the receiver part, the reflected signal is sinusoidal, and so weak in terms of
the amplitude with respect to the transmitted signal. Therefore, the signal must be
amplified by setting an amplifier circuit enough amount for detection. After amplification
step, we will construct a detection circuit to compare the input signal with a reference
voltage signal. If the reference voltage signal is less than input signal, the comparator
circuit gives logic 0 as an output otherwise logic 1. After that, counter will take the stop
command and it will give calculated distance in seven-segment display.

2.1. Driving Ultrasonic Transducer

In order to drive the ultrasonic transducer for transmitting, we require generating
5V amplitude, 40 kHz square wave. In many applications that we researched, the
voltage applied to the transducers is 10V to 85V [1], but we apply 5V pp to prevent the
damage to it because of not having the datasheet of the transducer. We generated
pulse waveforms by using Timer 555 ICs in astable mode for oscillator circuit and
monostable mode for trigger circuit.

2.1.1 Oscillator circuit

The oscillator circuit generates pulses at desired frequencies as depicted in
figure2. In our design, the resonant frequency is 40 kHz, so we should generate 40 kHz
pulses.

Figure6: Working principle of oscillator

By using specified resistors and capacitors values that at 40 kHz, we can obtain
the resonant frequency. [2]

: On time

( ) : Off time


We cannot obtain exactly %50 duty cycle as resulted in above formulas. The
value of Ra must be greater than zero otherwise it will damage the Timer 555
IC.[3datasheet]. We need to choose Rb > Ra to equate the on - off time.

To generate 40 kHz signal;





For %50 duty cycle;

We choose , , as a design parameter. Then
on off times will be;

() ()

( ) ()





The frequency of oscillating is;





(

)
The figure below depicts the oscillator circuit that we will use in our design.




Figure7: Oscillator circuit diagram




Table1: Design parameters for oscillator circuit

2.1.2 Trigger circuit

In order to generate trigger pulse, we will use another Timer 555 IC same by
utilizing the same circuit configuration in figure 2, but only rearranging the values of the
resistors and capacitor with respect to the our T
H
and T
L
specifications.
Trigger circuit should be the reset of the oscillator circuit and affect. Pin 2 of
Timer 555 IC, which is reset terminal, is connected to V
cc
to enable the generation of
the square wave continuously as can be seen from the figure2. According to this
knowledge, we can control the signal transmission and pause for specific times.
Firstly, we need to determine the T
H
and T
L
due to our range specification

T
L
: The minimum delay between transmitted and received signal in maximum
range
T
H:
The maximum delay between transmitted and received signal in minimum
range


Since our minimum range is 10 cm and the speed of sound in air in room
temperature is 343.4 m/s;

( )




T
H
means that we should send the 40 kHz signal less than 0.582 ms to verify
that when we obtain the received signal in minimum range we already stop sending.

Since our maximum range is 100 cm;

( )



T
L
means that we should wait at least 5.82 ms to start sending another signal.
Due to the fact that T
H
duration cannot be less than T
L
duration, we need to
modify by using an inverter. In order to succeed the desired specification, we choose
R
A
=8 M, R
B
=680 k and C=1nF.




( )






The figure below shows the trigger circuit that we apart in our design.



Figure8: Trigger circuit diagram






Table2: Design parameters for trigger circuit
2.1.3 Ultrasonic sensor drive circuit
The inverter is used for the drive of the ultrasonic sensor. The two inverters are
connected in parallel because of the transmission electric power increase.
The phase with the voltage to apply to the positive terminal and the negative terminal of
the sensor has been 180 degrees shifted. Because it is cutting the direct current with
the capacitor, about twice of voltage of the inverter output are applied to the sensor.
The circuit diagram is depicted below.


Figure 9: The circuit diagram of the ultrasonic sensor drive circuit.

2.2 Counting and Display

We will use BCD counter to measure the time interval between the transmitted
and received ultrasonic signal. In our design, the 4553 IC that is BCD counter is
utilized. This chip needs a single external decoder, because it is designed to operate
with multiplexed displays. Therefore, we will use 4511 IC decoder.
We will give the trigger pulse from 555 IC as an input to the MR pin of the 4553
IC. The reset of the counter is done, and counter starts counting when it is high. We will
wire the output of the detection circuit with LE pin of counter. When LE is low, the
counter is stopped, and the data of the BCD counter is taken from the quad latch
register and displayed.
To show the precise value of the distance, we should choose the right clock
frequency for the BCD counter. The clock frequency was calculated based on the
resolution criteria. Since the requirement of the detection is 1 cm, the ultrasonic signal
will travel 2 cm in room temperature. Then the delay time of the received signal is;


The period of the clock must equal to 58.2s to realize the delay as 1 cm and
BCD counter will increase 1 for 1 every 1 cm displacement.


The following circuit diagram shows the BCD counter, decoder and seven-
segment displays that we will utilize in counting and display part of the design.


Figure10: The circuit diagram of the counting and display


Design Parameters For Counter Circuit &Display
Supply Voltage 5V DC R
7,8,9,10,11,12,13
330
R
1,2,3
4.7 K R
5,6
1 M
R
4
100 K C
1
10 nF
Table3: Design parameters for counter and display


2.2.1 Generating clock frequency

In this part, we need to generate 17.2 kHz clock frequency. Square wave
oscillator is one of the couple ways to produce it. The circuit diagram and calculation is
depicted below.
: On time

( ) : Off time


() ()

( ) ()





The clock frequency is;





Figure11: The circuit diagram of square wave oscillator


Design Parameters For Square Wave Oscillator
Supply Voltage 5V DC C
3
1 nF
R
3
3K Frequency 17.2 KHz
R
4
40K
Table4: Design parameters for Square wave oscillator

2.2.2 Counter Adjustment
We can set counter start and stop times for many situations by using trigger
and detector output values.

Figure 12: The timing diagram of the counter adjustment

Consider that a single pulse is sent from the transmitter. After sending the
signal, we expect to see a single pulse from the receiver which is equal to the
detection circuit output. When both transmitter and receiver outputs are equal to 0,
we understand that the signal is not received yet. So, the counter should continue to
work. When transmitter output is equal to 0 and the receiver output is equal to 1, in
order to see correct measurements in the numeric display we should shut down the
clock input and stop the counter. Therefore, in this situation we should reset the
counter clock circuit. When transmitter output is equal to 1 and the receiver output is
equal to 0, we understand that pulse is sending from the transmitter part. Therefore,
we need to reset the counter. For this purpose, we should use master reset pin of
the counter.

Figure 13: The circuit diagram of the counter adjustment circuit


2.3 Amplification Circuit

Since the reflected ultrasonic signal from the object is decayed, the signal should
be amplified to detect it. Thats why we will use an amplification circuit shown below in
figure 10.


Figure14: Amplification circuit diagram

It is generally necessary to use the positive and negative voltage supply for
operational amplifier, but for our design zero voltage is wired instead of the negative
voltage due to the fact that +9V will be enough to operate the circuit for observing the
positive cycle. The half of the positive voltage is to amplify alternating current, and the
other half of it is to apply the bias voltage. We will use LM358N IC in this circuit.
We need to determine the values of the resistors and the capacitors to calculate
the total gain according to the requirement of the design. We tested the transducers
and obtained the results that for 10 cm the amplitude of the received signal is 200 mV
and for 100 cm the amplitude of the signal is 60 mV. According to the this results, the
total gain should be 500 which is 54 dB. There are two steps to obtain the total gain
which is considered in terms of dB.
For the first step For the second step

) (

)

The total gain in terms of dB= 54 dB
Design Parameters For Amplification Circuit
First Op-Amp Second Op-Amp
R
1
10 K R
3
500 K
R
2
100K R
4
10 K
Gain 10 Gain 50
Bias Voltage 9V DC Bias Voltage 9V DC
Table5: Design parameters for amplification circuit
2.4 Detection Circuit

We set up the detection circuit in two parts. For the first part of detection, we set
up an envelope detection circuit. This detection is done to characterize the general form
of our received signal. This envelope circuit is a half wave rectifier with Shottky barrier
diode whose good characteristic in high frequencies. For the second part of it, we
constructed a comparator circuit in order to obtain square wave from our envelope
circuit output.


Envelope Circuit

A simple electronic circuit which catches a high frequency signal as an input,
rectifies it and releases the new signal as an envelope from the first signal is known as
envelope detector.
We expect a sinusoidal signal from the ultrasonic receiver however, because of
the some travelling impairments through air, the received signal cannot protect its
original sinusoidal form. Therefore, detection operation must be done to detect received
signal envelope. Because the envelope of the signal is captured effectively we must
adjusted the discharging time of the capacitor. Therefore we want to discharge time T
smaller than time constant.

(Time constant)

.
We choose resistor and capacitor values as 1M ohm and 4.7nF respectively.







Figure 15: The circuit diagram of the envelope detector


Signal Comparator
A signal comparator is a high gain operational amplifier that results in an output
to one of two stages, high or low, based on difference between input signal and
reference voltage.

We used envelope detector output as input of the comparator to obtain square
wave. We use this square wave as stop command to counter. We used LM318 IC
and used a 50 K potentiometer to adjust reference voltage according to our input
signal and the formula is;


where Ra+Rb= 50K




Figure 16: The circuit diagram of the comparator circuit.

Vrf = ( Rb x Vcc )/( Ra + Rb )
YTE - Department of Electrical and Electronics Engineering
EE 316 - Electronic Design Project, P09 Project Final Report 17

3. Test Results

3.1. Oscillating and Trigger Circuit Test Results

The ultrasonic pulse oscillator circuit generated 40 KHz square wave
signal with a peak to peak amplitude of 9V as shown in the figure below.

Figure 17: Triger and Oscillator Circuits Test Results respectively.


3.2. Signal Amplification Test Results

Amplification is an important part of receiving unit. We saw the weak
sinusoidal signal in the receiver of the transducer. Then, we built amplification circuit
as mentioned in technical description part. Theoretically, we suppose to get gain
around 500 times. However, practically we managed to amplify signal around 40
times. We observed that result by applying a sine wave with a peak to peak
amplitude of 0.1V at 40KHz from signal generator. When we observe the output of
the amplification circuit, we observed an output with peak to peak amplitude of a bit
higher than 4V. That means original signal was amplified nearly 40 times.

When we observed the output of amplifier circuit it was very similar to
transmitted signal. We obtained 40 KHz signal with duration of approximately 1.5 ms
with a 4.5V peak voltage. That output value is good to be able to detect it. The
observed signal is as below figure.


Figure 18: Output of the amplifier circuit for 20 cm and 80 cm respectively.
YTE - Department of Electrical and Electronics Engineering
EE 316 - Electronic Design Project, P09 Project Final Report 18
3.3. Detection Circuit Test Results

We built envelope detector cascade to the amplification circuit. After we built
our envelop detector module, we observed a clear signal at the output as shown
below.

Figure 19: Envelope detection circuit test results for 20 cm and 80 cm respectively.

According to the reference voltage, comparator decides whether it is high (5V)
or low (0V) values.

After comparator the signal is ready to be sent to counter module. We used this
signal as a stop command for the counter. It has a duty cycle such that Ton>Toff
.From the observation in laboratory, we obtained the following output from the
comparator module.


Figure 20: Output of the Comparator circuit for 20 cm and 80 cm respectively.
3.4. Counting Circuit Test Results

W e constructed and tested our counter circuit by using a signal generator.
We gave MR and LE pins to the ground. For the clock frequency of counter, we
used a signal at low frequencies. In this way, it is easy to observe the counting on
the seven segment display




YTE - Department of Electrical and Electronics Engineering
EE 316 - Electronic Design Project, P09 Project Final Report 19
4. Conclusion

Our main goal in this project is to make an ultrasonic distance measurement
device. For this purpose, we set up the each block separately, and test. After that,
gather the separate blocks into one and try to get the desired results.
At first, we tested the each block, and they all worked well according to the
project specifications. However, when we try to wire the spread blocks on the
breadboard, we could not get the results that we want to achieve. After getting some
help from the instructor and the assistant, we obtained the results not precise but a
better than the old one which measures until 80cm with an accuracy of +3cm. If we
would have some calibrations on the circuit, we could obtain the desired result which
the circuit measures the distance between 10 cm and 100 cm with an error 0.5 cm.

YTE - Department of Electrical and Electronics Engineering
EE 316 - Electronic Design Project, P09 Project Final Report 20
5. Component List

Component description Part Number Manufacturer Supplier
40 KHz Ultrasonic Transducers - - Electronics Lab.
555 Timer IC NE555 Texas
Instruments
Electronics Lab.
Operational Amplifier LM358N Texas
Instruments
Electronics Lab.
Inverter SN74LS04 Texas
Instruments
Electronics Lab.
BCD Counter MC14553B On
Semiconductor
Yakup
Elektronik
Seven Segment Decoder 4511 Texas
Instruments
Electronics Lab.
3 Digit 7-Segment Cathode
Display
- - Yakup Elektonik
AND Gate SN74LS08 Texas
Instruments
Electronics Lab.
NAND Gate SN74LS08 Texas
Instruments
Electronics Lab.

YTE - Department of Electrical and Electronics Engineering
EE 316 - Electronic Design Project, P09 Project Final Report 21
References
1. Application Note Ultrasonic Distance Measurer
http://www.freescale.com/files/microcontrollers/doc/app_note/AN3481.pdf

2. The 555 Timer IC
http://www.play-hookey.com/digital/555/timer_555.html

3. BCD Counter MC 14553B Datasheet
http://pdf.datasheetcatalog.com/datasheets/105/501162_DS.pdf

4. Square wave oscillator
http://www.piclist.com/images/www/hobby_elec/e_ckt29.htm

5. Amplifier Basics
http://sound.westhost.com/amp-basics.htm#terminology

6. Voltage comparator information
http://home.cogeco.ca/~rpaisley4/Comparators.html

7. Article on "Speed of Sound in air"
http://hyperphysics.phy-astr.gsu.edu/hbase/sound/souspe.html#c1

8. K, Rajagopal, "Engineering Physics"
Vol: 2, pp: 71-72, PHI Learning Private Limited, New Delhi, ISBN: 978-81-203-4340-
5, 2011

9. Information about the Power and Voltage Amplifiers
http://electriciantraining.tpub.com/14180/css/14180_16.htm

10. Lecture notes Binary Counter
http://hibp.ecse.rpi.edu/~connor/education/IEE/lectures/Lecture_5_Binary_Counter.p
df

You might also like