Datasheet
Chapter 1: Detect Distance with the Ping))) Ultrasonic Detector · Page 1
Chapter #1: Detect Distance with the Ping)))
(TM)
Ultrasonic Sensor
WHAT IS THE PING))) SENSOR?
The Ping))) sensor is a device you can use with the BASIC Stamp to measure how far
away an object is. With a range of 3 centimeters to 3.3 meters, it's a shoe-in for any
number of robotics and automation projects. It's also remarkably accurate, easily
detecting an object's distance down to the half centimeter.
Figure 1
The Ping))) Sensor
HOW DOES THE PING))) SENSOR WORK?
Figure 2 shows how the Ping))) sensor sends a brief chirp with its ultrasonic speaker and
makes it possible for the BASIC Stamp to measure the time it takes the echo to return to
its ultrasonic microphone. The BASIC Stamp starts by sending the Ping))) sensor a pulse
to start the measurement. Then, the Ping))) sensor waits long enough for the BASIC
Stamp program to start a
PULSIN command. At the same time the Ping))) sensor chirps
its 40 kHz tone, it sends a high signal to the BASIC Stamp. When the Ping))) sensor
detects the echo with its ultrasonic microphone, it changes that high signal back to low.
The BASIC Stamp's
PULSIN command stores how long the high signal from the Ping)))
sensor lasted in a variable. The time measurement is how long it took sound to travel to
the object and back. With this measurement, you can then use the speed of sound in air
to make your program calculate the object's distance in centimeters, inches, feet, etc...
______________________________________________________________________________________________
The draft material in this Chapter is part of a forthcoming Stamps in Class text by Andy Lindsay.
(c) 2005 by Parallax Inc - all rights reserved.