ELECTRONICS: FUN AND FUNDAMENTALS
By Charles Platt
Zap-a-Mole
The first of a series of columns for readers who have relatively little
knowledge of electronics and would like to know more.
I’ve dropped a lot of quarters, over the years,
into machines that offer the peculiar pleasure
of hitting moles on their heads with a padded
mallet. I’m referring, of course, to the Whac-A-Mole
amusement-arcade game in which five oversized,
grinning moles pop up at random, inviting you to
whack them back into their holes. It’s such a perennial favorite that it even has a Wikipedia entry.
I decided to build “Zap-a-Mole,” using illuminated
push buttons instead of moles. In this column I’ll
describe an Old School Version powered by logic
chips. In my next column I’ll show a More Modern
Version in which a single microcontroller replaces
almost all the chips — and adds more game features.
If you try these projects, you’ll learn how chips
can talk to each other and how microcontrollers can
emulate their function quickly, simply, and cheaply.
»
The Logical Approach
Logic chips started out inside computers but ended
up everywhere from car alarms to pinball machines.
In this project I’ll show you not just how to build a
game with logic chips, but how to design it.
My first step in designing a circuit is to write down
what it has to do. For Zap-a-Mole, it looks like this:
1. Power the game for a fixed time.
2. Light an LED at random (representing a mole
to be zapped).
3. Wait for the player to press the right button
(to zap it).
4. Add 1 to the score.
5. Repeat.
A plain old 555 timer can run the game for a fixed
time. I’ll call this the Game Timer. Its high output
can power a counter chip, which I’ll call the Flash
Counter. It flashes 5 LEDs in sequence, thousands
of times per second, and then stops arbitrarily.
This is the usual ploy to achieve a “random” result.
I’ll need another 555 timer, which I’ll call the Burst
140 Make: Volume
23
Timer, to start the Flash Timer and then stop it.
Take a look at the block diagram in Figure A to get
a better sense of this.
How will the system know if the player presses the
right button? Suppose I hook a push button to the
input of each LED. This way, if the LED is powered,
the button is also powered, but if any other button is
pressed, it has no output. Therefore, if button #1 or
#2 or #3 or any of the other buttons emits positive
voltage, the player has scored a hit.
Those “or” words suggest that I can link all the
push button outputs together through an OR logic
gate. This is a key concept. The OR gate’s output is
normally low, unless one or more of its inputs goes
high, in which case its output goes high. I’ll use this
to retrigger the Burst Timer, which restarts the
Flash Timer to select another LED at random, so
that the game cycle will repeat.
Unfortunately a 555 timer is triggered by a low
pulse, not a high pulse. What to do? Well, instead
of an OR gate, I can use a NOR gate. Its output is
usually high unless at least one of its inputs goes
high, in which case its output goes low. To learn
more about logic chips, check the Online Resources
section of this article, or read my book Make:
Electronics (
makershed.com).
My game will need a Score Counter that advances
whenever the player presses the correct button.
The trouble is, when you press a button, its contacts
vibrate or “bounce” for an instant, and a counter chip
is so sensitive, it will count multiple button-presses
instead of just one. I need to “debounce” the signal.
This is another thing that a 555 timer can do. It
reacts to the first impulse from a button and
ignores the subsequent bounces, so long as it’s
completing its high-output cycle. So, the Burst Timer
will debounce the buttons automatically, and I can
tap into its high output to trigger the Score Counter.
Check Figure A again to trace out the logic of this.