00597b.pdf

(212 KB) Pobierz
M
Author:
AN597
THEORY OF OPERATION
Ultrasonic ranging entails transmitting a sound wave
and measuring the time that it takes for the sound wave
to reflect off of an object and back to the origin. The
reflection time is proportional to the distance that the
object is from the source. In this implementation, the
sound wave is transmitted and received from the same
transducer. Therefore, a blanking interval is required
between signal transmission and reception to eliminate
false echoes (i.e., a transmitted signal being detected
as its own echo).
Implementing Ultrasonic Ranging
Robert Schreiber
Microchip Technology Inc.
INTRODUCTION
Object ranging is essential in many types of systems.
One of the most popular ranging techniques is
ultrasonic ranging. Ultrasonic ranging is used in a wide
variety of applications including:
Autofocus cameras
Motion detection
Robotics guidance
Proximity sensing
Object ranging
CIRCUIT CONFIGURATION
In this implementation, a PIC16C74 is connected to the
ranging module as shown in Figure 1. The RE0 and
RE1 I/O pins are configured as digital outputs and are
tied to INIT and BINH, respectively. The CCP1 pin is
configured as a digital input and is tied to ECHO
through a pull-up resistor. The pull-up resistor is
needed since the ECHO signal is an open-collector
output. The CCP1 pin is configured for capture mode
(CCP1CON). Figure 2 shows the timing relationship for
V
DD
and the three signal lines (INIT, BINH, and ECHO).
Note:
The ranging module requires 5.0 millisec-
onds to stabilize during power-up.
This application note describes a method of interfacing
PIC16CXXX microcontrollers to the Polaroid 6500
Ranging Module.
This implementation uses a
minimum of microcontroller resources, a CCP module
and two I/O pins. The two major components of the
system are:
• Microcontroller
• Polaroid 6500 Ranging Module
The microcontroller performs the intelligence and
arithmetic functions for ultrasonic ranging, while the
Polaroid 6500 Ranging Module performs the ultrasonic
signal transmissions and echo detection.
FIGURE 1:
RANGING MODULE INTERFACE
RE1
RE0
CCP1
BINH
INIT
TRANSMIT
ECHO
POLAROID 6500 RANGING MODULE
TRANSDUCER
PIC16C74
©
1997 Microchip Technology Inc.
DS00597B-page 1
AN597
FIGURE 2:
TIMING DIAGRAM OF RANGING MODULE CONTROL LINES
V
DD
1
4
5
INIT
2
2
BINH
3
3
ECHO
Parameter
Number
1
2
3
4
5
Symbol
T
PU
T
BINH
T
ECHO
T
INIT_H
T
INIT_L
Characteristic
Ranging Module Stabilization Time
Blank Inhibit Time
Echo Time
High Time for INIT
Low Time for INIT
Min
5.0
0.9
100
100
Typ
2.38
Max
Units
ms
ms
ms
ms
The PIC16C74 is configured to use one of its internal
timers, Timer1, in capture mode to measure the time
between signal transmission and echo detection. The
resolution of the timer is determined by the
microcontroller clock frequency. For this application, a
4 MHz external oscillator was used, giving a resolution
of 1 ms per bit. The PIC16C74 initiates a ranging cycle
by first clearing Timer1. Timer1 is then enabled and
INIT is immediately asserted on the ranging module.
When INIT is asserted, the ranging module transmits a
series of 16 pulses on the transducer at 49.4 kHz. The
transmitted pulses reflect off the object and are
received back at the transducer.
The transducer is used for both transmitting and
receiving sound waves. A blanking interval is needed to
ensure that the transmitted signal has decayed on the
transducer, in order not to receive false echoes. In
normal operation, the ranging module has a blanking
interval of 2.38 milliseconds, which corresponds to a
minimum detection distance of approximately
17 inches. However, the BINH (blank inhibit) signal can
be manipulated to reduce the blanking time on the
transducer to allow for object ranging as close as
6 inches.
In this implementation, the PIC16C74 asserts the BINH
signal approximately 0.9 milliseconds after signal
transmission. This enables the transducer to receive
reflections off objects at a distance of 6 inches. The
ranging module asserts the ECHO signal when a valid
reflection has been detected. The PIC16C74 uses the
ECHO signal to trigger a capture of the Timer1 value.
The capture register contains the 16-bit value
representing the elapsed time between signal
transmission and echo detection. The PIC16C74 then
calculates object distance based on the Timer1 value,
microcontroller clock speed, and the velocity of sound
in the atmosphere. The basic equation for calculating
distance is given below:
Distance (inches) = T
ECHO
time / 147.9 microseconds
Note:
The minimum high and low time for INIT is
100 milliseconds, as seen in Figure 2.
DESIGN CONSIDERATIONS
There are several design considerations which must be
taken into account and are listed below.
The absolute measuring distance supported by the
ranging module is 6 inches to 35 feet with an accuracy
of +/- 1%.
The distance output from the ranging module can be
averaged over time to filter distance calculations.
In some applications, the gain of the receiver amplifier
may be too low or too high and may need to be
adjusted. For example, if the transducer is mounted in
a cylinder, the gain may need to be lowered to reduce
false echoes within the cylinder. In this case, R1 (refer
to the Polariod Ultrasonic Ranging System manual)
may be replaced with a 20 k
potentiometer to tweak
the gain of the receiver amplifier to reduce false
echoes.
In order for the Polaroid 6500 ranging module to
operate properly, the power supply must be capable of
handling high current transients (2.5 A) during the
DS00597B-page 2
©
1997 Microchip Technology Inc.
AN597
transmit pulse. The instantaneous drain on the power
supply can be mitigated by installing a storage
capacitor across the power lines at the ranging module.
A value of 500 microfarads is recommended.
A 200 millisecond interval is recommended between
ranging cycles (Figure 2) to allow the transducer to
clear.
The ECHO line requires a pull-up resistor (4.7 k
was
used in this application).
There must be a common ground between the
PIC16C74 circuitry and the ranging module.
Some applications may not need the resources of the
higher end PIC16CXXX devices. It is still possible to do
this application using a device that does not contain a
CCP module (for ECHO timing). The capture function
can be implemented in firmware. The effect of a
firmware implementation is that the resolution of the
ECHO time would be 3 T
CY
cycles versus 1 T
CY
cycle
for the CCP module.
Also, the firmware
implementation would not allow other tasks to be
performed while the capture function was occurring.
Refer to Appendix A for general ranging module
specifications.
©
1997 Microchip Technology Inc.
DS00597B-page 3
AN597
APPENDIX A: POLAROID MODULE
SPECIFICATIONS
Note:
This appendix contains general specifica-
tions from the Polaroid Ultrasonic Ranging
System Manual. Please refer to the
current Polaroid Ultrasonic Ranging
System Manual for current information
regarding
ranging
module
design
considerations.
Resolution
a)
b)
c)
Above all, know the target and range well, and
design a system with them in mind.
Use a higher transmit frequency.
Look at phase differences of a given cycle of the
transmitted signal and received echo (as
opposed to using and integration technique).
Increase the clock frequency of the timer.
d)
Accuracy:
(again, you must have a well defined target)
Temperature Compensate
a)
Use a second small target, as a reference, at a
known distance in the ranging path (such as a
1/4” rod several feet away), process both
echoes, then normalize the second distance
with respect to the first, since t1/d1 = t2/d2.
Incorporate a temperature sensing integrated
circuit to drive a VCO to do the distance interval
clocking.
To increase sensitivity of detection circuit
change the value of C4 from 3300 pF to 1000 pF
on the 6500 Series Ranging Module.
DESIGN CONSIDERATIONS IN
ULTRASONICS
Range:
(with user custom designed processing
electronics)
Farther
a)
b)
c)
Use an acoustic horn to “focus” the sound
(narrowing the beamwidth).
Use two transducers – 1 receiver and
1 transmitter – facing each other.
Lower the transmitting frequency (which will
decrease the attenuation in air).
Use a shorter transmit signal (such as four
cycles).
Use two transducers – one to transmit, one to
receive (eliminates waiting for damping time).
b)
c)
Beam Width:
Increase
a)
b)
c)
a)
b)
Use an acoustic lens (to disperse the signal).
Decrease the transmitting frequency.
Use several transducers to span an area.
Use an acoustic horn (to focus the sound).
Increase the transmitting frequency.
Closer
a)
a)
Decrease
TABLE 1:
RECOMMENDED OPERATING CONDITIONS
Min.
Max.
6.8
0.6
6.8
40
Unit
V
V
V
V
ms
ms
°
C
Supply Voltage, V
CC
High-level input voltage, V
IH
Low-level input voltage, V
IL
ECHO and OSC output voltage
Delay time, power up to INIT high
Recycle period
Operating free-air temperature, T
A
BINH, INIT
BINH, INIT
4.5
2.1
5
80
0
DS00597B-page 4
©
1997 Microchip Technology Inc.
AN597
TABLE 2:
ELECTRICAL CHARACTERISTICS OVER RECOMMENDED RANGES OF SUPPLY
VOLTAGE AND OPERATING FREE-AIR TEMPERATURE (UNLESS OTHERWISE
NOTED)
Parameter
Input current
High-level output current, I
OH
Low-level output voltage, V
OL
Transducer bias voltage
Transducer output voltage (peak-to-peak)
Number of cycles for XDCR output to reach 400V
Internal blanking interval
Frequency during 16-pulse trans-
mit period
Frequency after 16 pulse transmit
period
Supply current, I
CC
After transmit period
* These typical values apply for a 420 kHz ceramic resonator.
100
OSC output
XMIT output
OSC output
XMIT output
During transmit period
BINH, INIT
ECHO, OSC
ECHO, OSC
Test Conditions
V1 = 2.1V
V
OH
= 5.5V
I
OL
= 1.6 mA
T
A
= 25
°
C
T
A
= 25
°
C
C= 500 pF
Min.
Typ.
200
400
2.38*
49.4*
49.4*
93.3*
0
7
kHz
kHz
2000
mA
ms
Max.
1
100
0.4
Unit
mA
µ
A
V
V
V
©
1997 Microchip Technology Inc.
DS00597B-page 5
Zgłoś jeśli naruszono regulamin