March
2005, Issue 176
Joystick
Technology
JOYSTICK
ANATOMY
The
joysticks I've described came in two varieties, analog
and digital. Both were useless without the right input
circuitry and drivers. The digital joystick was nothing
more than push buttons. Four switches were arranged
around the stick: one above, one below, one to the left,
and one to the right. The stick pressed one when pushed
up, down, left, or right. Note that 45° stick movements
pressed on two buttons at once.
The
four button states were decoded into eight directions.
The fifth button initiated actions like firing and throwing.
Although digital inputs were directly compatible with
the digital computer systems for which they provided
input, the software had to determine the positioning
on the screen by measuring how long a direction button
was closed on the joystick and adjusting the reference
point on the screen. The digital joystick couldn't indicate
a particular position on the screen (or how fast to
move); it only indicated movement in one of eight directions
from the present location.
IBM's
analog joystick used two potentiometers at right angles
to each other to measure stick movement. One potentiometer
rotated when the stick moved up and down. The second
potentiometer rotated when the stick moved left and
right. The potentiometer's value indicated direction
as well as a proportional change in that direction.
The two potentiometers provided this proportional change
in a direction in addition to a proportional direction.
This added a new dimension to accurate positioning.
Two
push buttons completed the analog input device. However,
the device required input circuitry for interpretation.
Because ADCs were expensive at the time, a simpler interface
was used. The resistance of each potentiometer (wired
as rheostats) provided the "R" of an RC timing
circuit that produced a proportional pulse-width output.
The pulse width of the digital signal could be measured
by the software and interpreted as position. The analog
inputs could now directly access any screen position
as an x,y coordinate. This was far more powerful than
the information gleaned from a digital joystick.
With
today's advances in technology, a microcontroller's
on-board ADC could easily read the analog joystick.
Although present-day analog joysticks actually present
a current (rheostat or adjustable resistor tied internally
to 5 V), they're easily rewired to produce a voltage
from the potentiometer's wiper if the ends of each potentiometer
are connected to 5 V and ground, respectively.
An
analog joystick would be the perfect solution for some
designs; however, space limitations sometimes make that
impossible. Fortunately, you can combine a few new components
to make this happen in the space allotted. Let's take
a look at a few possibilities