code, the score is updated and the message “Score!” appears
on the screen when the dot tracks the center of the target.
Figure 11 shows the single-axis
output of a Memsic 2125 mounted
horizontally on a stable surface. The
5,000 consecutive readings were
collected at 10 Hz using a BASIC Stamp. The output of the
accelerometer is Gaussian, with a mean of 4,908 microseconds and a standard deviation of two microseconds.
This output variability is significant in the game, in that
the position of the white dot visibly jitters even when the
wobble board is held stationary. I handle this jitter in
accelerometer output with two simple filter routines written
in SPIN. They take the form:
FIGURE 10. Memsic
mounted in base of an
OPTP wobble board.
if || (acc2 – acc1) > 10 ‘compare acceleration values
acc1 := acc2 ‘update values if different
acc2 := memsic_output ‘update acceleration value
acc1 := (acc + acc2)/2 ‘average acceleration
t_squared := (target_x * target_x) + (target_y *
i_squared := i*i
if || (i_squared - t_squared) < 550
if (timeRemaining >0)
totalPoints := totalPoints +1
The downside of this simple test for target and dot
overlap is that there are multiple possible dot locations that
will result in points. However, in practice, this simplification
works well. A more complete and complex approach is to
use a sine lookup table and compute the single point on
the screen where target and player-controlled dot overlap
in real time. Readers interested in following this approach
can view several examples in the text accompanying
The Memsic 2125, like every sensor, is imperfect. In
addition to device-to-device differences in response and
settling time, output from a stationary accelerometer varies
randomly over time.
The filters are based on value differences instead of
consecutive readings from the Memsic 2125 because the
Propeller is operating at a significantly higher frequency
than the accelerometer.
A final note regarding coding the Hydra is that this
exergame relies on the Memsic 2125 object supplied
by Parallax. This object or driver includes a self-calibration
routine at startup that assumes the accelerometer is level.
As such, the wobble board must be positioned close to
horizontal at startup.
Hydra Game Development
Kit, Memsic 2125
accelerometer, and software
FIGURE 11. Single-axis
output of a level,
stationary Memsic 2125;
samples at 10 Hz.
Hydra Developer’s Forum.
website for the Hydra,
documentation, and forums.
Bergeron, B., Developing
Serious Games. 2006:
The exergame described here is a mere hint of what can
be accomplished with the Hydra Game System. Consider
adding a colorful background from the extensive library of
image files on the CD-ROM that accompanies the system.
Sound effects are another obvious addition to the exergame.
More importantly, the wobble board interface can be used
with very little modification on many of the sample games on
the Hydra CD-ROM. Imagine playing a game similar to Break
Out using a wobble board instead of a controller pad.
developer of the
Hydra and author of
the text included with
the system, a 512K
expansion card is in
production. The card
will enable development of games with
more media, and, in
general, greater complexity. Be sure to visit
the forums on Parallax
for any software
4915 4920 updates and hardware