122-28029 Parallax Inc, 122-28029 Datasheet - Page 124

GUIDE STUDENT SMART SENSORS

122-28029

Manufacturer Part Number
122-28029
Description
GUIDE STUDENT SMART SENSORS
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-28029

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Smart Sensors
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Page 112 · Smart Sensors and Applications
SUMMARY
This chapter focused on sensing the acceleration due to gravity with the Memsic 2125
Dual Axis Accelerometer. Sensing gravity makes it possible to measure both tilt and
rotation. The Memsic Accelerometer transmits pulses that indicate the acceleration
acting on its x and y axes. At room temperature, the pulses range from 3750 to 6250 µs,
which can be used to measure a range of −1 to 1 g with either one of the accelerometer's
two sensing axes. The
command is used to measure these pulses, and since it
PULSIN
measures time in 2 µs units, the range which programs have to examine is 1875 to 3125.
Accelerometer measurements can be displayed with the Parallax Serial LCD. If the
program has already been tested with the Debug Terminal, displaying measurements with
the serial LCD is typically a matter of adding an LCD initialization routine to the
beginning of the program and using
commands in place of
commands.
SEROUT
DEBUG
Custom characters come in handy for displaying the degree symbol (°), and the Greek
letter mu (µ).
The accelerometer can be used to measure rotation in the vertical plane. To do this, the
BASIC Stamp must calculate the arctangent of the accelerometer's y-axis measurement,
divided by its x-axis measurement. The x and y axis measurements have to be scaled and
offset to fit in a range of −127 to 127, which is what the PBASIC
operator needs to
ATN
return an angle, measured in binary radians. While degrees separate a circle into 360
segments, binary radians separate it into 256 segments. The PBASIC
operator can be
*/
used to convert a given binary radian measurement to degrees.
The accelerometer can also be used to measure tilt angles. Since the component of
gravity acting on each of the accelerometer's sensing axes is the sine of the tilt angle, the
inverse sine or arcsine can be used on an axis' measurement to determine the tilt angle.
An Arcsine subroutine can be used to calculate the angle (in degrees) given a value that
ranges from −127 to 127. This range corresponds to sine values of −1 to + 1.
subroutine expect a value between −127
Since both the
operator and the
ATN
Arcsine
and 127, techniques for scaling and offsetting the accelerometer measurements were
introduced.
The range of measurements the BASIC Stamp collects from the
accelerometer are on a scale of 1875 to 3125. The most efficient way to scale these
values to a range of −127 to 127 involves subtracting 1875 to zero-align the range, then
using the
operator to reduce the scale, then subtracting 127. This is the resulting line
**

Related parts for 122-28029