28029 Parallax Inc, 28029 Datasheet - Page 58

KIT PARTS SMART SENSORS W/TEXT

28029

Manufacturer Part Number
28029
Description
KIT PARTS SMART SENSORS W/TEXT
Manufacturer
Parallax Inc
Datasheet

Specifications of 28029

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp® or Javelin Modules
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Other names
28029PAR
Page 46 · Smart Sensors and Applications
ACTIVITY #2: CENTIMETER MEASUREMENTS
This activity demonstrates how to use the speed of sound and the PBASIC Multiply High
operator (
from the Ping))) sensor.
Calculating Centimeter Distance with PBASIC
The equation for the distance sound travels is S = C
speed of sound in air, and t is time. Since the Ping))) sensor's time measurement is the
time it takes sound to get to the object and bounce back, the actual distance, S
of the total distance the sounds travels.
The speed of sound in air is most commonly documented in terms of meters per second
(m/s). However, centimeter (cm) measurements will be more convenient to calculate
with the BASIC Stamp. Since there are 100 centimeters in a meter, let’s use S
which is simply 100 times S
BASIC Stamp 2 are 2/1,000,000 of a second (2 µs). So, instead of t, which has to be a
measurement of seconds, we'll use t
t
denominator that cancel, and 100 in the numerator can cancel with two of the zeros in the
denominator's 1,000,000.
S
PULSIN-BS2
object-cm
= (C
S
S
S
S
S
**
object
object
object-
object-
gives us the number of seconds. There is a pair of 2s in the numerator and
=
C
air
) to calculate the distance of an object based on the echo time measurement
air
t
-cm
PULSIN-BS2
=
cm
cm
t
S
2
=
=
=
=
100
100
C
C
air
air
2
)/10,000.
10,000
2
t
C
C
PULSIN
t
air
air
The result of these substitutions and cancellations is
t
object
t
2
PULSIN
-
. The
BS2
-
BS2
PULSIN-BS2
PULSIN Duration
×
1,000,000
2
.
air
When multiplied by 2/1,000,000
t, where S is distance, C
measurement units for the
object
air
, is half
object-cm
is the

Related parts for 28029