FIGURE 6. Calculation of acceleration
(A) for each axis of the Memsic 2125.
T1
The Memsic 2125 thermal
accelerometer is an example of a micro
electro-mechanical machine system
(MEMS) based on IC manufacturing
techniques (hence the name MEMSIC). T2
In operation, a heater within the
Memsic 2125 warms a bubble of gas
that moves in response to gravity and
acceleration of the device. Thermopiles
near the periphery of the bubble sense
identical temperatures when the accelerometer is level and
different temperatures if the device is tilted.
Temperature differences detected by the thermopiles are
converted into pulses by the onboard electronics according
to the relationship illustrated in Figure 6. Acceleration at earth
normal gravity ( 9. 8 m/s2) is considered 0, and the update
frequency is approximately 100 Hz at room temperature.
The angle of tilt is calculated with elementary trigonometry, given the accelerometer signals from the x and y axes.
For example, if the duty cycles of the x- and y-axis signals
increase equally, then the angle of tilt is equidistant
between the two positive x and y axes, or 45 degrees. The
amount of tilt in this direction is a function of the magnitude
of the positive shift in duty cycle, as described in Figure 6.
Fortunately, the low-level magnitude and direction calculations are handled by the Memsic 2125 driver from Parallax.
Figure 7 shows the dual axis recording of the Memsic
2125 used in my exergame. Note the clean square wave
output and a frequency of just over 100 Hz. There is
an obvious difference between the x-axis (top) and y-axis
(bottom) duty cycles. According to the formula in Figure 6,
the accelerations along each axis are:
A = ( T1 / T2 - 0.5) / 0.125
f = 100 Hz
FIGURE 7. X- and y-axis
output of a Memsic
2125 showing different
x and y duty cycles.
These calculations indicate
negative acceleration — and
therefore tilt — along the
x-axis and positive acceleration
along the y-axis of the accelerometer.
Connecting the Memsic 2125 to the game card on the
Hydra requires four lines. As shown in Figure 8, the
accelerometer requires 5 VDC at 4 mA, ground, and access
to two I/O ports on the Hydra. I used 1/8 watt, 220 ohm
resistors on the x- and y-axis output pins of the accelerometer and connected these to I/O pins 6 and 7 on the Hydra
EEPROM card, respectively.
The specifics of mounting a Memsic 2125 on a wobble
board depend on the design of your particular board. The
mount shown in Figures 9 and 10 are specific to the OPTP
wobble board. Although not visible in Figure 9, the Memsic
2125 is inserted into an eight-pin socket so that the sensor
can be used in other projects. Figure 10 shows the perf
board glued in place, along with the four-pin 0.10” connector on the cable to the 128K EEPROM card on the Hydra.
Game Coding
Ax = (T1/T2 – 0.5) / 0.125
Ax = (4.7ms/10ms – 0.5)/0.125
Ax = -0.03/0.125
Ax = -0.24g
Ay = (T1/T2 – 0.5) / 0.125
Ay = (5.2ms/10ms – 0.5)/0.125
Ay = 0.2/0.125
Ay = 0.16g
The core algorithm in the exergame compares the distance between the origin at the center of the screen to the
dynamic bull’s-eye and the wobble board-controlled dot. If
the distances — the hypotenuses of the triangle incorporating
the bull’s-eye and the triangle incorporating the dot — are not
significantly different, then the assumption is that the dot is
on target. As in the following SPIN
FIGURE 8. Wiring of
Memsic 2125 to the
Hydra EEPROM card.
+ 5
FIGURE 9. Memsic
2125 mounted on
socketed perf board.
I/O 7
I/O 6
June 2007 75