experimentation, I soldered 2 x 10 header pins to the 3 mm
spacing, through-hole solder pads, as shown in Figure 4.
Because the I/O lines on the expansion bus are shared
by the VGA connector, VGA output must be disabled to
use the expansion port I/O. In addition to the eight I/O
lines on the expansion port, the serial network transmit and
receive lines routed to the RJ- 11 jack are available for I/O.
Additional components of the Hydra Game System include
a compact 9 VDC power brick, USB and RCA cables, a miniature keyboard, travel mouse, and a NES-compatible gamepad.
The mouse and gamepad are useful for playing games, and the
small but useable keyboard is primarily used for programming
the Hydra without a PC using Hydra Basic. Although a rudimentary operating system may be downloaded from the online
forums to facilitate use of Hydra Basic, the utility of the language
is limited by the 32K RAM available on the Propeller chip.
Propeller IDE
My sense of nostalgia evaporated as soon as I started
working with the numerous examples provided on the CD-ROM. Instead of linear Basic, FORTH, or assembler, games
on the Hydra are written using high-level SPIN and, for the
technically endowed, low-level assembler. SPIN is unusual
in that it borrows somewhat from object oriented languages
and supports multiple cores. The multi-core paradigm takes
some getting used to, as does the colorful Parallax Propeller
IDE, shown in Figure 5. The MS Windows-based IDE can be
freely downloaded from the Parallax site.
74 June 2007
A feature of the IDE is the option
to either quickly load a program into
RAM during development or load the
program into onboard or expansion card EEPROM. The
later operation requires a few more seconds. When the
128K EEPROM expansion card is inserted, the onboard EEPROM is automatically disconnected.
Following the spirit of the SPIN language, the exergame
was developed in about 200 lines of high-level SPIN —
much of which was borrowed from or inspired by the
demos on the CD-ROM. The code is available for download
from the Nuts & Volts website ( www.nutsvolts.com). The
objects — akin to include files in C — used in the exergame
are TV and graphics drivers from the Hydra Game System
and the Memsic 2125 driver from the Parallax library. Note
that unlike the Parallax objects, the sources included on the
Hydra CD-ROM may not be freely distributed.
Because SPIN uses white spaces to indicate block
levels, it’s a good idea to use the IDE’s highlight function
(Control-I) that shows block relationships. As an example
of how white space is used within the IDE, consider the
following SPIN code from the exergame:
FIGURE 5. Parallax
Propeller IDE.
if || (i_squared - t_squared) < 550 ‘absolute value
if (timeRemaining >0) ‘time variable
gr.text(-120,-80,string(“Score!”)) ‘print “Score!”
totalPoints := totalPoints +1 ‘add points
Although the IDE is very sophisticated for a microcontroller system, version 1.05.2 lacks a true debugger. There is
an on-board LED and it is possible to write values to the
video out port, but both approaches are limited. Using
video consumes cycles and precious RAM. A traditional
text-based debugger — such as the one available for the
BASIC Stamp microcontrollers — would be more useful.
You’ll also find a small TV with composite video and audio
input — or a computer monitor with a composite video input
port — necessary for efficient game development. If you don’t
have a dual monitor setup on your PC, Parallax offers a nice
2. 5” LCD monitor that supports composite video and audio.
Wobble Board Interface
There are several ways to interface a wobble board to
the Hydra to create an exergame. The simplest is to mount
four mercury switches on the wobble board oriented such
that one switch is closed with the board tilted forward, back,
right, and left. Wire each mercury switch in parallel with the
appropriate button on the NES game controller and the
wobble board becomes a proxy for the controller pad.
Unfortunately, mercury switches are inherently limited
because of their sluggish response time and binary output.
Finer resolution in direction and degree of tilt requires more
switches and I/O lines. A more flexible approach is to use
an accelerometer that supports continuous sensing of tilt.
The two obvious options for this project are the Memsic
2125 dual-axis accelerometer and the Hitachi H48C tri-axis
accelerometer. Both units are supported by Parallax, and
driver objects for each sensor can be freely downloaded
from the Parallax site. Because only two-axis tilt is required,
the less expensive Memsic 2125 is used here.