0% found this document useful (0 votes)
60 views

The Computer Controller Cookbook

The Computer Controller Cookbook

Uploaded by

wgoodf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

The Computer Controller Cookbook

The Computer Controller Cookbook

Uploaded by

wgoodf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 213

TOM AND KELDA RILEY

CREATIVE COMPUTING PRESS


MORRIS PLAINS, NEW JERSEY
Apple and Applesoft are registered trademarks of Apple Computer,
Inc.
Atari is a registered trademark of Atari, Inc.
Radio Shack is a registered trademark of Tandy Corporation.
IBM is a registered trademark of International Business Machines
Corporation.
Commodore and VIC-20 are registered trademarks of Commodore
Electronics Limited.

The Computer Controller Cookbook

Copyright © 1983 by Creative Computing Press.


All rights reserved. No portion of this book may be reproduced-
mechanically, electronically, or by any other means including
photocopying-without the express written consent of the
publisher.

Library of Congress Cataloging in Publication Data

Riley, Tom, 1945-


The computer controller cookbook.

I. Computer games-Amateurs' manuals. 2. Computer


input-output equipment-Amateurs' manuals. I. Riley,
Kelda. II. Title.
TK9971.R54 1983 621.3819'532 83-18956
ISBN 0-916688-45-3

Creative Computing Press


39 East Hanover Avenue
Morris Plains, New Jersey 07950 USA

Manufactured in the United States of America

85 84 83 987654321
TOM AND KELDA RILEY
Contents
List of Figures VB

Introduction IX

1 Rebuilding Paddles and Joysticks 1

2 Airplane Wheel 15

3 Multiple Socket Extension 31

4 Sketch Pad 47

5 Homebuilt Atari Joysticks 63

6 Race Car Steering Wheel 75

7 Super Stick 87

8 Foot Pedals 99

9 Converters: Between Apple and Atari 109

10 Sound Pushbutton 121

11 Desk Switched Outlet Box 129

12 AC Outlet Controller 137

13 Construction Notes 145

14 The Electronics Tutorial 149

15 Software 177
Figures
1-1 Rebuilt Paddles 5
1-2 Apple II Factory Game Controller Schematic 6
1-3' Plug Protector 9
1-4 Game Controller With Correction Caps 11
1-5 Zeroing Joystick Elements 13

2-1 Airplane Wheel Sketch 16


2-2 Airplane Wheel Side View 18
2-3 Airplane Wheel-Parts 20
2-4 Airplane Wheel-More Parts 21
2-5 Schematic 26

3-1 Apple Stacked Plug 34


3-2 Multiple Socket With Isolation Diodes 37
3-3 Multiple Socket With Isolation.Diodes Schematic 38
3-4 Circuit Board for Multiple Socket With Diodes 40
3-5 Multiple Socket for Double Paddle Games
Schematic 44

4-1 Sketch Pad 48


4-2 Wooden Parts 51
4-3 Metal Parts 52
4-4 Head Detail 52
4-5 Sketch Pad Schematic 56
4-6 Linearity Test 58

5-1 Joystick Sketches 64


5-2 Atari Joystick 66
5-3 Tipping Disk Joystick 66
5-4 Microswitch Atari Joystick 72
5-5 Microswitch Apple Joystick 72

6-1 Race Car Steering Wheel Sketch 77


6-2 Race Car Steering Wheel Side View 78
6-3 Details 79
6-4 Race Car Steering Wheel Schematic 82
6-5 Special Plug/Socket for First Unit 83
Vlll The Computer Controller Cookbook

7-I Super Stick 89


7-2 Super Stick Front and Side Views 90
7-3 Super Stick Details 91
7-4 Three Piece Wrist 93
7-5 Sheet Metal Version 93
7-6 Super Stick Schematic 96

8-1 Foot Pedals 100


8-2 Foot Pedal Side and Back View 102
8-3 Details 103
8-4 Two Pot Schematic 104
8-5 One Switch Schematic 105
8-6 Simple Socket/Plug 105

9-1 Sketch-Atari to Apple 112


Atari to Apple Simplified Schematic i 13
9-3 Atari to Apple Converter Schematic 114
9-4 Sketch-Apple to Atari 117
9-5 Apple to Atari Simplified Schematic 117
9-6 Apple to Atari Converter Schematic 118

10-1 Sound Pushbutton Sketch 123


10-2 Explanatory Schematic Sound Pushbutton 124
10-3 Schematic Sound Pushbutton 126

11-1 Desk Switched Outlet Sketch 131


11-2 Desk Switched Outlet Schematic 132

12-1 Controlled Outlet Sketch 140


12-2 Controlled Outlet Schematic 142

14-1 Timer Chart 160


14-2 VIC-20 and Atari Game Control Schematic 164
14-3 IBM PC Game Control Schematic 165
Q(Jj
e

e
00

• II •

Introduction
The idea of building computer hardware yourself may seem a little
scary at first. After all, personal computers are now as powerful and
sophisticated as the biggest computers of only a few years ago. How
can a novice presume to build something to be attached to such a
valuable and complicated machine?
Unfortunately, while books, classes, and tutorials on how to use
software packages are everywhere, instructions on how to use, build,
x The Computer Controller Cookbook

or repair hardware are not. Most people's experience with hardware is


limited to reading instructions on how to hook up cables or stick
connectors in the right slots. This book is designed to teach you to
build mechanical and electronic controllers for your personal
computer. By "controllers" we mean all those devices-including
joysticks, paddles, and custom circuits-used to regulate a computer's
activities.
Constructing the simple and clearly explained projects in this
book can serve as an excellent introduction to the hardware side of
computer technology. We believe that you will gain tremendous
confidence in your ability to use computers when you realize that the
magical box on your desk is a collection of physical parts that do
understandable things in the real world.

WHY STUDY HARDWARE?


Experience with electronic hardware is important in any field that
uses computers and other electronic instruments. A career in
traditionally academic disciplines like physics, astronomy,
experimental psychology, or medicine can be advanced by the ability
to assemble or repair electronic or computer-controlled instruments.
All too often someone with no experience with soldering has to make
cables or circuits for expensive experimental instruments and then be
judged on how well the equipment operates.
Even if your experience with electronic equipment is limited to
plugging it in, it is important to be familiar with the principles and
techniques of electronics. You may not always be able to depend on
others to do your hardware work for you. If you use electronic
equipment in your profession, you should be competent at working
with it.
The ability to read and work with schematics (the graphic
representations of electronic circuits) is a good example of the kind of
skill we're talking about. You can't learn to read schematics by simply
unfolding the schematic at the back of your computer's reference
manual and reading through it. You have to start with simple circuits
(and simple schematics), like those for the game controllers in this
book. As your schematic-reading ability develops you'll be amazed at
how much information you'll be able to get from a dog-eared second-
generation photocopy of a schematic with text written in French (or
Greek).
.
In troduction Xl

You may have noticed that the controller projects have a number
of features in common with the new discipline of robotics. Both
depend on the construction of mechanical devices and the
interconnection of these devices with computers. At present, the cost of
experimenting with even the simplest robots is too high for the
average person. Working on controller projects like the Airplane
Wheel and the Super Stick will give you a good introduction to the
basic electronic and mechanical skills required for robotics at a modest
cost.

WHO CAN USE THIS BOOK?


A good beginner's hardware project should be useful, easy to build and
test, inexpensive, and carefully explained. We've included everything
you need to complete the controllers: detailed drawings, parts lists,
step-by-step instructions, information on where to get parts (and how
much you can expect to pay), and programs to test the finished
projects.
We've included a chapter on construction and an electronics
tutorial (including an introduction to soldering techniques) to help
those who have little or no workshop experience.
You don't need an elaborate home workshop to build these
controllers. If you can use hand tools and common power tools, you
should be able to tackle the necessary wood, plastic, and metal work. In
the few cases where more elaborate tools are necessary (for example,
one version of the Super Stick calls for metal machining tools), the
special requirements are clearly noted.
Completing these projects doesn't require extensive knowledge of
electronics, either. If you have put together any kind of electronics kit
and can do elementary soldering, you should have no trouble with the
circuits.
Parents may want to help their children build these controllers.
Most kids are enthusiastic about using these controllers, but would
probably need some assistance in constructing them. Here's your
chance to work with your child on a project you'll both find
challenging and enjoyable. Some of the projects would make great
gifts for younger children.
These designs are also excellent projects for students in high
school or adult education shop classes. They are challenging, but not
too difficult for a student with proper supervision, instruction, and
Xll The Computer Controller Cookbook

access to the right tools. It seems fairly evident that today's students
would be much more interested in building a Race Car Steering Wheel
than a spice rack.

REQUIREMENTS FOR
USING THIS BOOK
All of the projects have been built, tested, and used as controllers for
our Apple II Plus computer. Fortunately, the game controller circuits
for most home computers are similar, and these designs can be adapted
to most home computers that have a game port. We've given many
suggestions for how to do this in the individual chapters, and a special
section of the Electronics Tutorial, "Adapting the Controllers to
Different Computers," goes into the subject in more detail. Specific
instructions are given for the Atari, Commodore VIC-20, IBM
Personal Computer, and Radio Shack systems. Chapter 9,
"Converters: Between Apple and Atari," concentrates on conversions
between the two machines we've had the most experience with.
Because these machines use two of the most frequently encountered
designs for game controllers, this chapter provides an excellent
example of machine-to-machine adaptations.
We've also included six programs (written in Applesoft Basic)
that you can use to test the completed controllers. All but two of the
programs can easily be converted into the version of Basic available for
different machines. The Drawing program contains graphics
handling functions, and the Digitizer contains disk handling
instructions, that are specific to the Apple computer.

HOW TO USE THIS BOOK


This workbook is designed to teach you basic electronic and
mechanical skills by giving you step-by-step instructions. The best
way to use this book is to build the projects, not just read about them.
A good way to start, though, is by reading through the
"Construction Notes" and the "Electronics Tutorial" (chapters 13and
14). These two chapters explain the basic design of the controller
Introduction Xlll

electronics, and the methods we'll use to construct the different


projects. Read these sections carefully-making sure that you
understand them. The information they contain can be critical when
you're knee-deep in a project.
Pay special attention to these instructions regarding safety. Make
sure that what you're doing or the way you're doing it can't injure you
or your machine. This is especially true for the projects that use AC
power. If you don't know what you're doing, or if you're unwilling to
follow the simple guidelines we've provided, stay away from these
projects.
Just about everyone's got a few paddles or joysticks around that
don't work quite as well as they used to. Turn to chapter 1,
"Rebuilding Paddles and Joysticks," and give your controllers a tune-
up. Working with familiar commercial hardware is a good
introduction to the skills and tools you'll need to carry out the more
complicated projects that follow.
If you run into problems with the rebuilding, go back and reread
the chapters on construction and electronics. Try to figure out what
you did wrong, or what you didn't understand. If you still feel unclear
or unsure about what you're trying to do, it may be time to try other
books or magazines, friends with electronics or mechanical
experience, or a home computer user's group for further instructions
or explanations.
When you feel ready to progress to a more difficult project, look
through the book and pick the project that really catches your eye-
and plunge right in! Maybe you've always wanted to be able to play
Star Invaders while eating a cheeseburger-the Foot Pedals make it
possible! Or maybe you're intrigued by controllers that can work from
across the room-try building the Sound Pushbutton. You goal is to
learn how to build your own hardware to control your "personal"
computer, so it makes sense to choose projects that appeal to you
personally.
Not every project you build will be a smashing success-every
learning process involves at least a few mistakes. As you gain
experience in the necessary construction skills, your projects will
become more and more impressive-and you will become more and
more confident in your ability to get the most enjoyment out of your
"magic box."

Tom Riley
Kelda Riley
1 Rebuilding Paddles
and Joysticks
The easiest way to learn how to build controllers for your home
computer is by rebuilding a commercial paddle or joystick. This is a
useful training exercise and, in many cases, a necessary project because
commercial paddles, which may cost up to $60, are not built very
substantially, and they often don't stand up to the rigorous workouts
they get.
2 The Computer Controller Cookbook

Commercial paddles can fail for several reasons: wires can be


broken inside the cables, connectors can be bent or crushed, the
potentiometer wipers can fail to make contact, or the pushbuttons can
break mechanically. Virtually all of these failures are due to the
breakage of weak parts that any competent designer would have
realized were inadequate for their intended use. This chapter will
concentrate on teaching you to fix this kind of controller failure.
Fortunately, most of these breakdowns are easily diagnosed and
repaired. Doing so will provide a good lesson in basic electronics.

TYPES OF CONTROLS
We have an Apple II Plus Computer; most of the controls in this book
were designed and tested for that machine. We will attempt, however,
to point out the changes in the designs that are necessary to adapt them
for other computers whenever we have the appropriate information.
Most home computers have similar electronic circuits for their game
controls.
Controls come in two general types: digital and analog. A digital
control (like the Atari paddle) consists of a group of pushbuttons. An
analog control, made up of potentiometers that can be adjusted
uniformly over a range, is much more versatile.
Most of the projects in this book will feature analog controls, but
we will throw in a couple of projects for digital controllers just for
good measure. The various digital paddles are almost identical, but
there are two distinct types of analog controls. They differ in the cost of
their components and in their electrical wiring, and we will point out
these differences.

A WIZARD FOUND THESE


PADDLES AND
RESURRECTED THEM
Strange as it may seem, it is cheaper, and the final product is better, if
you rebuild paddles rather than buy new ones. Let's see what it would
take to reconstruct a beat-up pair of Apple paddles and end up with
units that are better than the originals. Let's assume that there are
Rebuilding Paddles and Joysticks 3
broken wires in the cables, that the plug has a missing pin, and that
one of the pushbuttons and both of the potentiometers are broken.
The heart of the paddle is the potentiometer (pot), the electrical
component that is located beneath the knob and controls the
adjustment range. (See the Electronics Tutorial in Chapter 14 for more
complete explanations of the different electronic components used in
the projects.) The maximum resistance of the pot is measured in ohms.
The Apple, unfortunately, uses a paddle pot with a value of 150K
ohms (K indicates thousands).
Pots of this value are often hard to locate. Other computer
manufacturers use much more common values, like lOOK ohms and 1
meg-ohm, for their paddle pots. In order to rebuild the paddles you
will need to buy two new pots. (The information in the section on
correction capacitors demonstrates that it is possible, though
somewhat complicated, to use lower values for the paddle pot.)
You can obtain decent pots from mail-order electronics houses or
from local electronics supply stores that sell to the public (look for ads
for the latter in your local Yellow Pages). Radio Shack pots are of such
poor manufacture that we cannot recommend them. Pots advertised as
Mil Spec (built to military specification) are usually excellent, but the
150K value is rare.
A good pot will be completely sealed, will feel very smooth
mechanically, and will be linear, i.e. a graph of how far the knob is
turned versus the resulting change in resistance will be a straight line.
Most good pots will have quarter-inch round stems. If you want to use
the knobs from the Apple paddle, you will have to file the shaft flat on
one side.
The next item on our agenda is the paddle pushbutton, often
referred to as the FIRE button. A good pushbutton should make a click
that can be heard and felt. The button should be about 3/B-inch in
diameter so that using it doesn't tire your finger. A good quality
pushbutton switch will cost up to $3. Many of the better ones are
slightly larger than the factory originals, so you may have to enlarge or
move the hole.
Since the index finger can control the FIRE button faster and
more precisely than the thumb, you may want to move the switch to
the back of the paddle where it can be pressed with the index finger
when the paddle is held in either hand.
The cable is also a critical component of the paddle. The wires
can be small, but the cable must be mechanically sound and quite
flexible. This project requires two cables (3-wire, 3-conductor), each
about five feet long. We have found that telephone modular cable with
4 The Computer Controller Cookbook

four fine, multistranded wires is good for building paddles. You can
purchase satisfactory telephone cable from Radio Shack. You can also
weave several individual wires into a cable with a Boy Scout rope-
making machine or pull #26 wires inside aquarium tubing. Both of
these procedures have worked for us in various projects.
Replacing the plug is another important part of rebuilding the
paddle. On the Apple, the plug is a standard DIP (Dual Inline
Package) plug. It can easily be made from a device called a header, or
component carrier, at a cost of about $1.25. A header looks something
like a standard chip, but has a row of tiny forks to which the individual
wires are soldered. Whenever you are soldering on this device, plug it
into a loose socket so that the pins will be held straight and will not
loosen in the plastic.

MECHANICAL REBUILDING
You will note in figure I-I that several mechanical changes were made
to the paddle case. First, the new pots were mounted and, if necessary,
filed flat to accept the knob. The new switches were mounted in the
original holes; you can relocate them if you want to. Paper labels
clearly identifying the paddle number were put on the front of the case
and covered with transparent tape. A line was drawn on the knob with
a felt-tip marker to indicate the amount of turn.
To give the paddle a solid feel, weights were glued into the bottom
half of the case. We used lead wheel weights that had fallen off
automobile wheels; they were scavenged on bicycling trips. Fishing
weights would also serve the purpose. Such weights can be installed
with either epoxy or silicone sealant. We covered the bottom of the
paddle with felt, attaching it with rubber cement, to further improve
the feel and insure that the paddle will not scratch furniture. In
addition, it may be necessary to enlarge the notch for the cable,
particularly if you use telephone cable.

ELECTRICAL WIRING
Figure 1-2 shows the standard schematic for an Apple paddle. You
may want to refer to page 100 of the Apple II Reference Manual for
REBUILT PADDLES
F / -I
PAPER LABEL MAR K KNOB

II G ='\

LARGE
PUSHBUTTON

LEAD
WEIGHT

FELT
BOTTO M
6 The Computer Controller Cookbook

GAME 1\0
CONNECTOR
PIN
/ +5
6 GC(9
, 2 PB(9
-' /(9 Gel
, 3 PB I
> ? 8 GNO
>
OHM >
>
<-<-<-

PUSH - 57&
BUT TO N OHM
(9

PO T 1
15(5) K

APPLE II
PUSH-....to-
\ ... FAC TORY
GAME
CONTROLLER
SCHEMATIC
FIG. 1-2

more details. Note that two resistors from the original paddle, with a
value of 570 ohms each, are mounted in the game connector. You may
use resistors of any value from 570 to 1000 ohms, rated at 114 watt and
5% tolerance.
You should do the soldering with a small pencil-type iron of from
25 to 42 watts and resin-core soldering. The use of acid-core solder on
electronic equipment will destroy it forever and always-no
resurrection is possible.
Rebuilding Paddles and Joysticks 7

CHECK AND DOUBLE


CHECK
The professional procedure for making up a circuit from the
schematic requires two photocopies of the schematic drawing and a
colored pencil. As you solder the connection, neatly color in each
connector and wire on the first copy of the schematic. When
everything is colored in, you are finished.
The second copy is used for the test. When your work is complete,
take the fresh copy of the drawing and, with a multimeter, carefully
check each line for continuity, coloring it in on the drawing. You will
often find that you have missed soldering a wire or two in the circuit.

SOLDERING
You may want to unbolt the potentiometer and the pushbutton to
make soldering easier. Cut the cables to length and very carefully strip
back the outer insulation. Be especially careful not to nick the wires. A
small pair of wire strippers, the type that look like pliers and have an
adjustment bolt, are best for this job.
If you use telephone modular cable, you will find that you have
four wires, one more than is necessary. The best use for this extra wire
is to double up and use two wires for the line from pin I (the +5 volt
power supply), which goes to one side of the pot and one side of the
switch. This will reduce the chance of the pushbutton affecting the pot
reading.
You will note that figure 1-1 also shows a jumper between the
unused leg of the pot and the center terminal. This is considered good
electronic practice and helps performance somewhat when the pot
begins to wear. If the pushbutton has three terminals, be sure to use the
pair marked C (common) and N.O. (normally open).
To attach the header, strip back the insulation from the cable and
expose the wires, trim them neatly to the length required, and tin
about liB-inch of bare wire on each with solder. Plug the header into
an empty socket and locate the mark for pin 1. The cables usually are
fed in from the pin B end to make them easy to plug into the Apple.
Now you can fit the wires into the tiny forks, holding them with a pair
of long-nose pliers, and solder them in place.
8 The Computer Controller Cookbook
Clip off the excess wire with a small pair of diagonal cutters. Place
the two pull-down resistors into the header, shortening and bending
their leads to fit the forks precisely. Hold the wires with long-nose
pliers, not your fingers, while you are soldering.
If you have a multimeter, you can now check out your work
without the risk of plugging it into the computer. Put it on a low ohms
scale and measure for continuity between the pins on the connector
and the appropriate points indicated in figure 1-2. In addition,
measure from pin 1, the +5 supply, to pin 8, the ground, to insure that
impedance is greater than 50 ohms, and that it remains greater than 50
ohms for all settings of the pot and all pushbutton combinations. It is
a good idea to have a friend check your work for you. In any case,
checking it three times usually insures correctness.

THE SMOKE TEST


Turn off your computer. Never attach or remove anything from a
computer with the power on. Check again for your #1 pin, properly
plug it into the paddle connector, and turn the computer back on. If
the computer behaves irregularly, turn it off immediately, unplug the
paddle, and recheck all your work. An example of irregular behavior:
if the disk routine starts up over and over again, it indicates a short to
the +5 pin.
If nothing untoward happens, you can run the Controller
Checkout program in chapter 15 to check out the functions of the
paddle and pushbuttons. If all is well, turn off your computer and
remove the paddle connector.

FINISHING UP THE JOB


Your next task is to install the bottoms on the paddles and build up a
strain relief for the cables out of silicone sealant. This material, used
for bathroom caulking, is available at most hardware stores. The clear
sealant is best for electronics work since it is the least messy. (This
material is quite irritating if it gets on your skin or in your eyes, so be
careful using it.) You may have to apply two coats of sealant to get a
neat result. Allow each coat to dry overnight.
Rebuilding Paddles and Joysticks 9
RU BBER BAND
C, 0 0 VC 0- 0' c;... 0 0
,
co
CI' '" DO
CiI FOAM BLOCK
c» 00 °CO
o " ' 0" 0 0.° 0 cJ 0' 0 0 c»
'"
o 0 #I
,,- 0 fr-------.,
.. '"
v e-
(>"'

"
"'
PLUG

CROSS SECTION
PLUG
PROTECTOR
FIG. 1-3
OPEN VIEW

CARVe
OUT

A FINAL TOUCH
One of the most common problems with Apple paddles is bent pins in
the connector. This isn't a failure in the design; computer users simply
leave them lying around unprotected. Figure 1-3 shows a protective
foam block for the connector that should be used whenever the paddle
isn't attached to the computer. The best material for this is the stiff but
flexible white foam that is used to pack delicate electronic equipment.
This foam is easily worked with a pair of scissors. A rubber band holds
the foam block in place. A loose socket can also be used to protect the
pms.
10 The Computer Controller Cookbook

JOYSTICKS
Most of the procedures we use in reconstructing a paddle can also be
used for fixing a joystick. You can obviously replace the connector and
the cable. In this case, the cable will require more conductors: four
conductors if there is one pushbutton, five if there are two, and six if
correction capacitors are required. A double run of the modular
telephone cable with stranded wires works much better than the
commonly used ribbon cable. There is usually plenty of room in the
joystick case to install new pushbuttons; it is just a matter of matching
holes.
The joystick element containing the two pots and the mechanical
linkage is more difficult to replace. It is almost impossible to find
replacements for just the pots, and the commonly available
replacements for the entire element are not very good. You may also
have to use pot values other than those originally intended and add
correction caps (see the explanation of correction caps below). Joystick
elements with centering springs and tabs are usually better made than
those without.
One of the special problems that occurs with joysticks is failure to
zero. When this occurs, a pot will read a small positive number-
instead of zero-even though the pot is in its extreme low position.
Failure to zero is usually caused by poor mechanical construction of
the joystick element. There is a procedure to correct this problem,
described in the section on Zeroing Joystick Elements below, but it is
difficult to complete successfully.
Be sure to provide proper strain relief for the cable where it exits
from the box. The wires of ribbon cables often break at this point.

CORRECTION CAPACITORS
One of the most common ways in which home computers read input
from paddles uses a timer circuit. You can tell if this is the procedure
used by your computer by counting the wires from the paddle pot back
to the computer. If there are two wires (the +5 and pot wires), then the
pot is wired as a variable resistor and is used in a timer. If there are three
wires (the +5, ground, and pot wires), then the pot is used as a variable
voltage device, or true potentiometer. The Apple, the Commodore
Rebuilding Paddles and Joysticks 11

GAME [\0
CONNECTOR
PIN
+5
GC/9
PBrs>
1/9 GCI
3 PBI
GND

CI C2 RI C3 R2
IK IK
POT
(9
GAME
CON TROLLER
WITH
CORRECTION
CAPS
F [G. 1-4

SEE TE X T FOR
COMPONENT
PB I I-{o------'

VIC-20, and many other computers use the timing circuit. Some Radio
Shack models use true potentiometers.
The timing circuit can be adjusted for pot values lower than the
original values. This adjustment can be made by adding small
capacitors within the paddle and thus requires no modification of the
host computer. Figure 1-4 shows how the correction caps can be added
to a standard controller circuit.
12 The Computer Controller Cookbook

The Correction Cap Calculation program in chapter 15 will assist


you in calculating the correction cap values for the Apple II. The
program works by taking the maximum value of the pot and
multipying it by the value of a small cap inside the computer to form a
constant. You then divide that constant by the new maximum pot
value and subtract the original cap value. This gives you the correction
cap value required.
For the Apple the original maximum pot value is 150K ohms.
The original cap is a .022 microfarad. If you have a different computer
you can probably get the maximum pot value by opening a paddle and
either reading the value off the pot or measuring it with a multimeter.
You can usually find the cap on your computer's schematic by tracing
the wires from the paddle port back into the machine. These values can
then be placed in line 18 of the program.
The correction caps are soldered from the game control pin to the
ground. If they are put inside the paddle, you must bring a ground
wire out to the paddle. Alternatively, they can be mounted on a small
printed circuit board a few inches down the cable from the connector
and encased in packing foam.
It is difficult to obtain the exact values desired, so you are
probably just as well off to buy an inexpensive selection of caps and
use trial and error.
To test your work, run the Controller Checkout program again. If
the reading reaches 255 before the pot is turned to its maximum, the
cap is too big. If the reading never reaches 255, the correction cap is too
small. Several small caps in parallel may be needed to get the correct
value. The Correction Cap Calculation program contains the
limitations of this procedure. .

ZEROING JOYSTICK
ELEMENTS
A common failure of joysticks, particularly cheap ones, is not to go to
zero. This can be corrected, but the procedure is tricky, and it is
possible to ruin the joystick element. If you decide to attempt the
correction, first unsolder and disassemble the joystick element and
remove the potentiometer. The metal back must then be removed from
the pot by straightening the small metal tabs. Do it carefully, because
Rebuilding Paddles and Joysticks 13

.-----RESISJIVE ELEMENT
WIPER TRACK
METALLIC BAR

PAINT--=-"
AREA AREA

TERMINALS

ZEROING JOYSTICK
ELEMENTS
FIG. 1- 5

these tabs will not bend many times before they break. In removing the
back be careful not to lose any of the internal parts.
Now the pot element'should look like figure 1-5. Note that there is
a small active area of resistive element in the middle and two large
inactive areas on either side. The problem is that the inactive areas
have too much resistance to read as zero. Look closely at the limits of
the wiper track, which leaves a mark in the active area.
The trick is to reduce the resistance of the inactive areas. This can
be done by painting over them with sterling silver pigmented paint,
available at electronics stores, or with a homemade paint made from
clear nail polish and lock graphite. Needless to say, the expensive
silver paint is better.
14 The Computer Controller Cookbook
Carefully wipe clean the inactive areas. Make up a mixture of nail
polish and graphite into a paste on a smooth surface, then paint the
inactive area of the pot element, covering the terminal end and
continuing until you just touch the end of the wiper track. Be very
careful that the paint goes nowhere else, particularly not where it
might touch the metal case or the metal feelers for the central terminal.
It may take two coats for complete coverage. Allow the paint to dry
thoroughly.
Now reassemble the pot and the joystick element. Resolder the
wires according to the schematic. Run the checkout program. If
correction caps were used you may have to adjust their values.

Parts List
Rebuilding Game Paddles and Joysticks

Number Suggested Total


Required Description of Part Supplier Cost
2 Pots, 150K, short shaft,
JAIN0565154UA Newark $8.00
2 Pushbuttons, #275-609 R.S. 1.90
12 ft. Telephone cable, #278-366 R.S. 1.80
I 16-pin header plug Jameco .70
2 Resistors, lK, 1/4 watt, 5% R.S. .20
Mise. Silicone sealant, weights, labels Local lAO

Approximate
Cost $14.00

Suppliers: Newark Electronics


See Yellow Pages or call main office (312) 638-4411 for
local sales office address.
Minimum order $25.00
J ameco Electronics
1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
,/ <,

iI \\J
0

M
([J)\ )V
-:
-,

'-
'-1/
J

:::--
en - I
'-L-/

------
_J
(- -

-
-
\
-.
-
/r -I.
-

2 Airplane Wheel
The first chapter in this book of homebuilt controls for personal
computers explained the rebuilding of existing paddles and joysticks
to improve their electrical performance, beef them up mechanically,
and give them a better feel. In this chapter we will tell you how to build
a new type of control, one which can't be purchased at any price. We
call it an airplane wheel; a pilot might refer to it as a control yoke.
16 The Computer Controller Cookbook

AIRPLANE
WHEEL
SKE TCH
FIG 2-1

This control has two pushbuttons and provides two analog


inputs. The first is the degree of turn of the wheel, and the second is the
position of the wheel forward and back. By using these two inputs the
airplane wheel control closely imitates the actual controls of a small
aircraft.
There are several airplane flight simulator programs and related
games on the market, but they depend on input from the computer
keyboard or from standard game paddles or joysticks. Unfortunately,
Airplane Wheel 17
no one flies an airplane by punching keys on a typewriter, and that
isn't the way you learn to fly either.

USING THE CONTROL


To use this control you sit in a chair in front of your computer with the
leg board of the control under your legs and the central wheel support
between them. Thus seated, you can turn the wheel, push it forward
and back, press the pushbuttons, reach the keyboard, and see the
screen-all without changing position. All you have to do is plug in
the control, run your flight simulator program using the paddle rather
than the keyboard mode, and take off. The wiring shown in the
drawings is consistent with the A2-FSI Flight Simulator program
from Sublogic.

THE DRAWINGS
Before you get excited and start building this device, let's look briefly
at the drawings. Figure 2-1 is a sketch of the completed prototype
indicating the leg board, lower support and struts, the wheel itself, and
the hardwood grips. Note that two microswitches are mounted in the
grips, pot 1 is mounted in the wheel axis, and pot 0 is mounted on the
lower back strut.
Figure 2-2 is a side view that gives much more detail on the
assembly of the unit. Figures 2-3 and 2-4 show details of the
component parts. Figure 2-5 is the electrical schematic, which will be
explained in a separate section.

CONSTRUCTION
MATERIALS
The airplane wheel is constructed primarily of plywood and sheet
metal. It can be built entirely with hand tools, but the use of a table or
radial arm saw will sneed up the work. It is therefore helpful if you
PB I

i I HARDWOOD
IJ GRIP
STOPS
\ ..

POT j

..
t
I
iJ WHEEL

'- .

AIRPLANE
WHEEL
SlOE VIEW
STRUTS FIG. 2-2

POT
(5)

LOWER
SUPPORT

CABLE LEG
BOARD
Airplane Wheel 19

have access to a home workshop or a local high school woodshop.


The best material to use in constructing the control is l/2-inch
hardwood plywood. We made the prototype out of the maple plywood
door of a discarded kitchen cabinet. Regular fir plywood can be used,
but the unit will not finish up as nicely. Plexiglass scrap, 3/S-inch or
l/2-inch thick, would make a striking unit; plexiglass can be worked
with wood tools if you proceed carefully. Many plastic suppliers will
sell scrap by the pound at reasonable prices. Solid hardwood would
also produce a good-looking unit, but it would be necessary to use a
power plane to cut the hardwood down to the l/2-inch thickness
required.
The small parts needed to build the control include plastic
washers cut from coffee can lids and bushings cut from l/4-inch
(internal diameter) brass tubing. The latter can be purchased at a
hobby shop. A scrap of sheet metal, plexiglass, or Formica will be
necessary for mounting pot I. The required nuts, bolts, flat washers,
and wood screws are given in the parts list at the end of the chapter.

CONSTRUCTION STEPS
Assemble all the materials and parts you will need for the project.
Then start work by cutting out all the wood, metal, and plastic parts.
The large holes in the upper and lower supports are included simply
for decoration, to give the control a lighter, less massive look. They
were cut out with a hole saw and a power drill, but can be omitted if
this tool isn't readily available.
The physical size of pots from different manufacturers varies
somewhat, so if you begin the woodwork before you have the pots, just
drill 3/16-inch pilot holes for both the mounting hole and the shaft.
When you obtain the pots you can drill out the holes for an exact fit.
Potentiometers are designed to be mounted through thin metal.
To mount them on wood that is too thick for the pot bushing, first
mount the pot on a 1/16 to 1/4-inch piece of stiff material-aluminum
or steel sheet metal, plexiglass, or Formica. Then screw this piece
securely to the wood. This is the method used for mounting pot 1 (see
figure 2-4). Pot 0 is shown mounted directly in the wood, but it could
also be mounted in the manner just described.
When drilling sheet metal, never hold the work with your hand;
the metal will spin and cut your fingers. Hold the sheet metal with vise
t
PB 1 0 ell
rDRILL
TO
SUI T
,.._.,-- SW I TC H
l'---/"'-k---_-_-_--:[-34 2
_C, ,0
II Iis I @:I
I I I I
I I
BACK I I ,I I

I I
VIEW : I I I
@, I ,@
I I I , to
I I I I \0
, ,
I ,
I I
I ,
I
, I@ @, ,
I ,
I
I
I
\__L_..1 .: +- , __ _ _---j. .l

o o_____=------'l
WHEEL
TOP -HARDWOOD
VIEW SU [ T ··-tIT...:
( ,", --.l '\J

_1
PARTS
FIG. 2-3

I
. 16 - - - - - - - - - - - - - - - - ;

,-
, - -; --

LEG BOARD
I
to
I
I..J
I'"
BACK
VIEW

·- t
.--', Q GC 1 t5
SIDE
VIEW R PO T MOUNTING
V) pLATE
UPPER SUPRJRT
FRONT
VIEW

MORE
PARTS
+ FIG.
2 -4
" '-BUSHINGS !
4 ----'--

o *
25 t.o.
k5:o1
f"""9-
. . .G.r-
4-REG_
BRASS
BUSHING
o
;:: 3 -REG. I-REG
SIDE o l!)-.J
.<:
VIEW
22 The Computer Controller Cookbook

grip pliers or in a bench vise. With any of these materials, start with a
pilot hole of about liB-inch in order to locate exactly the center of the
hole, and back up the drilled piece with scrap wood to prevent
breakout damage.
Observe that the wheel is attached to pot I by set screws tapped
into the wood ("tapping" is the cutting of screw threads on the inside
of a hole). Drilling and tapping is usually done in metal, not wood,
but we have found that hardwoods like oak and maple work
satisfactorily if the tap has coarse threads like the #10-24 shown in
figure 2-3. No lubricant is required for tapping in wood. Two Allen set
screws at least lI2-inch long should be installed at right angles to each
other. The tapping is most easily accomplished before the steering
wheel parts are assembled.
Inside the potentiometer is a small metal tab that stops the pot
from turning a complete 360 degrees. (Most pots turn through 300
degrees.) This internal tab is fairly weak, so stronger stops must be
built to keep it from being accidentally broken in vigorous play.
Figures 2-2, 2-3, and 2-4 show one stop screwed onto the top support
and two screwed onto the wheel. These stops can be made from faucet
washers or small rubber feet attached with roundhead screws. You may
have to insert flat washers under them if they don't touch each other.
These stops will be precisely located during final assembly.
Both of the pots have 2-inch shafts. These long-shafted pots are
sometimes difficult to obtain. If you can't find them locally, you can
order them by mail. The ones for the prototype were ordered from
Newark Electronics. The minimum order is $25, so you may want to
go in with some other people on an order, Delivery time is four to six
weeks.
Two microswitches are mounted in the wooden grips for use as
pushbuttons. They are shown in figure 2-2 mounted at the top of the
grips; here, they are pressed with the thumbs. If you prefer, they could
be pointed away from the user or to the inside of the wheel and pressed
with the index finger. The switches and the #2 mounting bolts were
bought at Radio Shack, but suitable switches can be purchased from
many mail-order houses. The Radio Shack switches (Cat. No. 275-016)
have a small metal lever that is attached with a rather weak hinge.
Reinforcing this hinge with a matchhead-size dab of silicone sealant
helps to strengthen it.
The microswitches are mounted on the plywood wheel and
covered by the hardwood grips, which also have a hidden groove for
Airplane Wheel 23
the switch wires. The grips on the prototype were cut from scrap
walnut, so they are particularly attractive.
The plastic washers are inserted wherever two wood parts would
otherwise rub against each other. They are cut with scissors from
polyethylene coffee can lids; the central holes can be cut with a hand
paper punch. These washers provide smooth turning while relieving
the strain on the pot shafts.
The three bushings on the supports are installed where wood
moves against the bolt threads. These bushings on the prototype were
cut from model shop tubing with a small triangular file. There is also
a bushing in the one strut which goes over the shaft of pot O. Flat metal
washers are also used wherever bolt heads and nuts come in contact
with the wood.
The lower support has built into it a clamp for the shaft of pot O.
The pot itself is mounted on the end of one strut and moves with that
strut. The pot is fitted to the strut and held with silicone sealer. In
constructing the clamp, a pattern of holes is cut into the support to let
the clamp close down on the shaft when the #6 nut and bolt and flat
washer are tightened. We strengthened the wood around the clamp by
coating it with epoxy, and later redrilled the holes.

SUB-ASSEMBLY OF
WOOD PARTS
After you have cut out all wood parts and given them a preliminary
sanding, you can begin assembling them. The lower support is
attached to the leg board with two #8 x I-inch flathead wood screws
and wood glue. Counter-sink the screws flush with the wood surface.
Assemble the top wheel support in the same way. We prefer to use
Elmer's Carpenter's Wood Glue, but any good quality wood glue will
do. Keep a damp cloth handy to wipe off excess glue.
Next, assemble the wheel hub with wood glue by putting a 1/4-
inch bolt with flat washers through the central hole in each piece.
Tighten the bolt to clamp the three pieces together. The hand grips
have to be custom-fitted to the wheel and holes for #4 screws drilled
through the plywood wheel, but the grips are not glued on. For the
microswitches, drill mounting holes through the plywood, not the
gnps.
24 The Computer Controller Cookbook

FINISHING THE WOOD


If you have done a good job on the woodwork, it is worth doing the
same high quality work on the finish. Prepare the wood by rounding
all corners with a fine rasp, and sand all surfaces. An orbital sander is
best for this job: start with #80 sandpaper, then do a light sanding with
#120 paper to finish up. The plywood parts can be stained if you want
a dark finish, or they can be painted with an oil-base enamel in a color
you like.
Now you are ready to apply a satin-finish polyurethane varnish,
using two or three coats over a stain or one coat over enamel. The
polyurethane will give the enamel a rich look and keep it from leaving
marks on the furniture or the floor.

FINAL ASSEMBLY
Pot I should now be installed through its mounting plate. Be sure to
make a small hole for its spin prevention tab. Screw the mounting
plate to the top wheel support. The four brass bushings are installed in
the following locations: two in the top support, one in the front hole of
the bottom support, and one in a back strut. If the bushings fit tightly
you will not need to glue them. Pot 0 is glued on one of the struts. The
hole in the strut should be drilled out to a snug fit on the pot bushing
(not on the smaller shaft). Then cut a notch for the tab and glue the pot
to the strut with epoxy or silicone sealant.
Next attach the struts to the two supports, using two flat washers,
two plastic washers, and a nut for each pair. When you are certain you
have the unit assembled correctly, lock on the nut with Loctite thread
sealant, Super Glue, or fingernail polish. The bolts should be tight,
but the struts must move freely when moderate force is applied. You
can also install the clamp bolt in the lower support at this time, butdo
not clamp the pot shaft until the final adjustments are made.
You can lubricate the bushings and flat washers with a tiny
amount of petroleum jelly or candle wax. We think the wax gives a
better feel to the movement of the finished device.
Now press the wheel onto the pot shaft. You may have to chase the
hole with a drill bit to clear out excess glue and finish. The big plastic
washer goes between the wheel and the support. If the pot shaft sticks
out of the front of the wheel, you can either cut off the shaft or install
Airplane Wheel 25

additional large washers. The wheel stop on the top support can be
installed at this point, but the two stops on the wheel itself must be left
off until final adjustments are made.

ELECTRICAL
COMPONENTS
Electrically, this unit is just an overgrown joystick with two pots and
two pushbuttons. The wiring schematic (figure 2-5) is for the Apple II,
but you can build an airplane wheel for any computer that can handle
a two-pot joystick and at least one pushbutton. To do it, you must use
the correct pot values, find the right plug, and make changes (mostly
pin numbers) in the electrical wiring to fit your machine. Your task is
simply to search out this information concerning a standard joystick
for your system and copy the electrical connections, and use it to adapt
our schematics for your own use.
In the prototype, the pot I value is 150K ohms, an unusual value
but standard for Apple paddles. Pot I should be long-shafted,
completely enclosed, and of good mechanical construction. The parts
list at the end of the chapter gives a suggested manufacturer's part
number and supplier. If the pot does not have a screwdriver slot across
the end of the shaft, you will have to cut one with a hacksaw, since the
shaft must be turned with respect to the wheel during final
adjustment.
Pot 0 is a bit different. This pot does not turn through its full
range. (As noted earlier, a normal pot will turn through 300 degrees
from one stop to the other.) The struts that move potO will permit only
about 170 degrees of turn. If you desire a full reading you must use a
larger pot, one that will go from 0 ohms to 150K ohms over a turn of
170 degrees. You also have to choose a value for the pot that will let you
purchase the actual item.
For the Apple II, a value of 250K ohms works very well. Other
computers will require a value about one and one-half times that of the
standard pot. For an Atari which uses 1 meg-ohm pots, you will need a
1.5 meg-ohm pot which must also be long-shafted and mechanically
sound.
The pushbuttons in the prototype are microswitches that have a
metal lever on top. We purchased them at Radio Shack. There are three
26 The Computer Controller Cookbook
PB I P8Q

A.fR PLAN E
WHEEL
SCHEMATIC
FIG.2-5

POT&.
25&. K

C PIN
I .of 5
'--....----? 2 P8
'---+-___.----7> 3 PB I
6 GC
1& Gel
RI 8 GNO
IK
GAME I\O
R2 CONNEC TOR
I K

terminals on the bottom of each switch, labeled C, N.O., and N.G We


used the one marked C (common) and the one marked N.O. (normally
open). You can use any type of normally open, momentary-contact
switch that will fit neatly on the wheel.
The plug for the Apple II is a 16-pin DIP header, sometimes
called a component carrier. When you solder this device, be sure to
plug it into an unattached 16-pin socket so that the heat doesn't loosen
and misalign the pins. The #1 pin of the plug is marked by a cut-off
corner; the wires normally trail out the end near pin #8.
Airplane Wheel 27
Figure 2-5 shows two IK ohm pull-down resistors from the
pushbutton pins #2 and #3 to ground. If you are very careful, you can
mount these resistors inside the header itself.
The schematic also shows correction caps, which are necessary
only if the pots you are using have too Iowa resistance value (see the
discussion of correction caps in chapter I). If you use correction caps,
they can be mounted on a small piece of printed circuit board about
one foot up the cable. The electrical noise prevention cap shown in
figure 2-5 is optional, but could be mounted beside the correction caps.
To determine the number of conductors required for the cable,
count the +5 supply, the two pot wires, and the two pushbutton wires:
you will need five conductors. If you weren't able to find exactly the
pot size you need and are using correction caps, you will also need a
ground wire.
We don't like working with the flat ribbon cables that are used in
many commercial joysticks, having repaired too many broken wires in
them. Radio Shack sells a good 4-wire telephone cable (Cat. No. 278-
366) that works well in constructing controls if you are careful not to
overheat it while soldering. If you have the correct pot values and
choose to use only one pushbutton, you could get by with only four
wires and run a single cable. If you need more than four wires, you
should use two runs of cable and double up the +5 wire.

SOLDERING PROCEDURES
To do the soldering in this project you need a small soldering iron
(about 25 watts), resin-core solder, wire strippers, and a small pair of
long-nose pliers. Figures 2-2 and 2-4 show which terminals of the pots
to use for the various wires and where to route the cable. Start wiring at
the pushbuttons and work back to the plug. You will need a three-
conductor loop of cable to extend from the wheel to the back of the top
support. It must be long enough to allow rotation of the wheel
through 300 degrees. You can work out the correct length and location
of the anchors by trial and error.
Before you wire the unit, make two photocopies of figure 2-5.
Then, as you run each wire and make each solder joint, trace it in on
one of the copies with a colored pencil. After you have finished the
wiring, it is a good idea to have another person go over the unit,
checking out the wires with a colored pencil on the second photocopy
to make certain that you haven't omitted any connections.
28 The Computer Controller Cookbook
If you have a multirrieter you should also check the resistance
from pin #1 (+5 supply) to pin #8 (ground). You should always get a
reading of at least 50 ohms on any control, and the reading ought to be
much greater. Watch this reading while pushing the buttons and
turning the pots. It must always be high.

ALIGNMENT
Aligning the control requires a simple program that repeatedly shows
the reading of pots 0 and 1 and the condition, open or closed, of
pushbuttons 0 and 1. You can use the Controller Checkout program
from chapter 15. Or you can write your own program. Be sure to put a
slight delay between the two paddle readings. Check out the program
on a· standard joystick or paddle before testing your new controller.
Now turn off the computer and plug in the new unit, making
certain that the #1 pin in the plug is in the correct hole. Turn on the
computer. If it doesn't start up exactly as usual, turn it off at once and
recheck your work. Now load your check program and place the
airplane wheel in position under your legs.
We will start the adjustments with pot 1. Turn the airplane wheel
slowly and check that the pot reading goes from 0 to 255. Now center
the wheel and, using a standard screwdriver, turn the pot shaft inside
the wheel until the reading is 127 with the wheel centered. Press the
wheel firmly on the shaft and tighten the set screws.
To locate the two stops on the wheel (the single stop is already
mounted on the top support), turn the wheel until you feel one of the
stops inside the pot. Now back off this stop just a little and check that
the reading on the screen hasn't changed. Hold the stop in place and
mark its center with a sharp point, like an awl. Repeat the procedure
on the other side for the third stop. You may have to remove the wheel
to install the stops properly, then replace and center it again.
To adjust pot 0, pull the wheel as far forward as you can, leaving
the clamping bolt loose. Adjust the pot with a standard screwdriver
until the reading on the screen just reaches O. The forward motion
must be stopped by contact of the wood parts, not by the tab inside the
pot. Now lock the clamp by tightening the clamp bolt. Pushing the
wheel back should now bring the reading all the way up to 255, and a
reading of 127 should be at a center position that is comfortable to
hold. Press the pushbuttons to make sure they work.
Now load your favorite flight simulator program or space game
and take off.
Airplane Wheel 29

FINISHING TOUCHES
To give the unit a finished appearance and make it last longer, you
may want to do the following:

• To keep the cable out of your way and prevent it from being pulled
loose, you can tie it to the wood parts.
• Use silicone sealant to cover the exposed electrical connections and
the back of the plug. This is called "potting."
• The ends of the wire loop between the top support and the wheel
should be mechanically secured. You can tie one end to the pot
with dental floss and silicone sealant. Likewise, secure the other
end to the wheel with the same materials and a small screw.
• Glue felt on one or both sides of the leg board with contact cement
to give a nice finishing touch to the controller.
• You can personalize the finished unit by placing a paper cutout or
a hand-drawn emblem in the center of of the wheel. This should be
done after final pot adjustments are complete. Our prototype is
adorned with a tiger's head (easily recognizable from an ad for a
popular printer).

The drawings show the prototype exactly as built. You almost


certainly will want to make some improvements of your own,
particularly if you build more than one unit. As mentioned earlier, the
clamp and mount for pot 0 could be strengthened with some sheet
metal parts and set screws.
The wheel axis of the prototype is parallel to the leg board and
floor. A pilot who tested the unit suggested angling this axis down a
little in back to be more like the steering wheel of a light plane. This
could be done by adjusting the angles of the lower support.
The unit shown in the drawings is about right for most average-
size adults. You could extend the lower support as much as four inches
if the controller were to be used primarily by a taller individual, or
shorten it by two inches for children.
30 The Computer Controller Cookbook

Parts List
Airplane Wheel

Number Suggested Total


Required Description of Part: Supplier Cost
Pot, .15 meg, 2" shaft, JAIN200PI54UA Newark $4.00
Pot, .25 meg, 2" shaft, JA2N200P254UA Newark 4.00
(pots manufactured by Allen-Bradley)
2 Submini lever switches, #275-016 R.S. 2.80
4 Bolts and nuts, #2 x 5/8" R.S. 2.00
20 feet Telephone cable, 4-conductor, #278-366 R.S. 2.40
I 16-pin DIP header Jameco .70
I 16-pin DIP socket jarneco .70
2 Resistors, IK ohm, 114 watt, 5% R.S. .20
2 feet Hardwood plywood, I" x 2" 4.00
I foot Masonite, 118" tempered 2.00
2 feet Hardwood, I x 2 Scrap
I Bolt and nut, #6 x 3/4" .20
3 Bolts, 114 x 20 x 2" 1.50
3 Nuts, 114 x 20 .30
8 Flat washers, 114 .30
3 Rubber feet with screws 1.70
4 Flathead screws, #8 x I" .25
2 Set screws, #10-24 x 112" .50
4 Flathead screws, #6 x 112" .25
6 Flathead screws, #4 x 3/4" .50
I Brass tube, 114" I.D. Hobby shop .60
2 Coffee can lids, polyethylene Scrap
I Sheet metal plate, 2" x 2" Scrap
2 feet Cotton felt 1.00
I ounce Silicone sealant 1.20
I pint Polyurethane varnish 2.00
I pint Stain or enamel for finishing 2.00
Mise. Sandpaper, electrical tape, glue, etc. .90

Approximate
Cost $36.00

Suppliers: Newark Electronics


See Yellow Pages or call main office (312) 638-4411 for local sales office
address.
Minimum order $25.00
Jameco Electronics
1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
3 Multiple Socket
Extensions
In this chapter we will show you how to build .multiple socket
extensions for Apple computers. These devices provide a number of
convenient functions for the computer user: they bring the paddle
socket out of the case to a position beside the keyboard, they permit
switching between paddles without interrupting the program
32 The Computer Controller Cookbook

currently running and, with appropriate software, they will let you
use two standard joysticks at once.
Socket extensions are available commercially, of course, but no
single unit will have all the features of the socket extension we will
describe. Besides, you can construct a home built unit for about half
the cost of a commercial one. A multiple socket extension is an
excellent first project for learning to work on computer hardware,
since the device is simple and easy to construct. The materials to build
it are easy to obtain, and only a small multimeter is required for testing
the finished unit. What more could you want?
Figures 3-1 through 3-5 give you the details of units that were
built for the Apple II. We will discuss what might be done to construct
multiple socket extensions for other computers later in the chapter.

TYPES OF MULTIPLE
SOCKETS
There are two types of multiple socket extensions. Those which
permit the choice of one of two or more paddles will be referred to as
selection units. Those which permit two standard paddle sets or
joysticks to be used at the same time will be called two person units.
We will also describe special features for each type of unit,
including click action power switches, isolation diodes that prevent
paddles from affecting each other's readings, and zip (zero insertion
pressure) sockets. These special features will let you customize the unit
to your exact needs.

A WORD OF CAUTION
Good practice for working on electronic equipment requires that the
power to the unit be turned off before any plug is installed or removed.
The power switches on these multiple sockets are intended to allow
you to select among paddles already plugged into the sockets.
Plugging in a paddle when the power switch is off but the computer is
turned on violates good practice, although it is preferable to plugging
the paddle into a live socket. Remember: turn off the main power
supply to your computer before plugging in or unplugging a paddle
from any of these socket extensions.
Multiple Socket Extension 33

TOOLS REQUIRED
The construction of a socket extension is primarily a precise and
somewhat tedious soldering job. Soldering is the keystone of all
hardware skills and one that can only be learned through practice. It is
definitely a skill worth mastering.
For this project you need a small pencil soldering iron of about 25
watts and a standto hold it, a sponge to clean the tip of the iron,
desoldering braid to remove solder bridges, and fine resin-core solder.
Other tools you should have on hand include a pair of small diagonal
cutters, long-nose pliers (for bending fine wires), an X-acto or other
small-bladed knife, and wire strippers. The plier-type wire strippers
with an adjustment bolt work well but must be adjusted and tested on
each new wire size.

THE STACKED PLUG UNIT


The plugs -on Apple paddles are easily damaged and therefore have to
be replaced in many cases. It is helpful to replace the paddle plug with
a stacked plug and socket, thus providing an extra socket of the two-
person type. For this replacement you will need a 16-pin wire wrap
socket and a 16-pin DIP header. The construction details are given in
figure 3-1. The socket will ride on top of the header, providing not
only a new socket but also a handle for the plug.
First trim off the socket pins to an even lI2-inch and bend them
out slightly. (You might cut the #2 pin lIl6-inch longer.) Then
straighten the pin ends as shown in the end view of figure 3-1; this
allows the wire-wrap pins to slip over the spades of the header. Double
check to be sure that the pin 1 end of the header, marked with a cut off
corner, is matched to the pin 1 end of the socket, marked with a notch
or cut off corner.
Plug the header into another unattached socket so that its pins
will not misalign when heated. Solder pins 1,8,9, and 16. Then solder
pins 3, 5, 12, 13, 14, and 15. Cut off pins 4, 7, and 11 about lI8-inch
down from the socket. Using long-nose pliers, bend pin 6 over to fit
into spade 7 and bend pin 10 over to reach spade 4.
Now for the tricky part: pin 2 must be bent around behind pin 3 to
reach spade 4, but without touching pin 3. If this gives you trouble, try
cutting off the #2 pin 1/8 inch from the socket and soldering a 3/4-inch
piece of insulated #22 solid wire between the pin 2 stub and spade 4.
34 The Computer Controller Cookbook

PIN / S I DE
END
.. -----.--H·····--·-----e:-GLUE
: W IR E WRAP IF LOOSE
I SOCKET
::r: I
t-- L.il

CABLE
HEADER
CUT/I
OFF
CORNER t5 GClS)
GND.

o-CABLf CONNECTION
) 0 ('1
o
[
END
V fEW

GCI
PIN /6 SIDE

APPLE STACKED PLUG


F [G. 3 - I

If the old paddle plug that you are replacing with the stacked unit
needs pull-down resistors for its pushbuttons, these can be installed
between the socket pins. We used two 1/4 watt, l Kohm, 5% tolerance
resistors. They share pin 8 for ground; one resistor goes to spade 2 and
Multiple Socket Extension 35
the other to pin 3. Trim the wires carefully, bend them neatly around
the pins, and then solder.
The cable should be stripped of its outer cover for 3/4-inch and
the wire trimmed. Since the cable normally enters from the pin 8 end,
the +5 wire will be longest and the ground wire shortest. Strip the wire
back 3/16-inch, twist the strands, bend them into a small hook, and tin
the wire. Your wire stripper must be set so that none of the fine wires
are cut. Try several adjustments on a scrap of the same wire until you
have it set correctly. One at a time, press each wire into the correct fork
or close the hook around the pin shaft, and solder it.
The pin I end should be marked with light-colored fingernail
polish, model enamel, or white typing correction fluid covered with
clear fingernail polish. Sometimes the plastic top of the socket comes
loose and has to be glued back on with Super Glue or clear nail polish.

TESTING THE STACKED


PLUG UNIT
If you have a multimeter you should check your wiring for continuity
and to insure against shorts. Pin 1 to pin 8 must measure in excess of 50
ohms, and the measurement is usually much greater.
If you have difficulty inserting a plug into the new socket the first
time you try it, stick a medium sewing needle into each of the holes in
the socket to realign the internal parts with the holes. If you plug the
control with this stacked socket into the Apple and then plug a
standard set of paddles or a joystick into the new socket, pot 0 of the
second joystick acts as pot 2, and its pot 1 acts as pot 3. Similarly, its
pushbutton 0 acts as pushbutton 2, but its pushbutton 1 remains
pushbutton 1 and is shared with the original paddle (the Apple II has
only three pushbuttons). Incidentally, if you have made the shift key
modification for upper/lower case, it will hold pushbutton 2 closed
unless the shift key is pressed. This will interfere with the use of the
pushbutton on the second joystick plugged into the stacked plug".
You now have all the hardware you need to play two-person
competitive games with full joystick control. There is not much
software available that has this feature, but you can dream, or even
write your own.
36 The Computer Controller Cookbook

THE SELECTION SWITCH


Now let's look at the construction of a multiple socket that can be
placed beside the Apple to let you choose between two paddles with the
flick of a switch. Figure 3-2 is a sketch of this unit showing the
component layout. The terminations of the main cable wires and two
side cables are not shown because they would hide the components.
These cables will be discussed later. This multiple socket extension
has all the most popular features, including zip sockets, a click switch,
and isolation diodes. If you don't need all of these features and want to
leave one or more of them off, the cost of the parts will be reduced.
The zip plugs used for this unit cost about $6.20 each (see the parts
list at the end of the chapter), compared to $1.00 for a good standard
socket. The zip plugs are larger and have a small lever on the side that
locks and unlocks the socket. If you have only one set of paddles and a
joystick and want to switch back and forth between them, you
probably won't want to pay extra for zip plugs, so buy standard, gold-
plated sockets.
We prefer a switch that clicks and makes positive contact to the
simple slide switches commonly used on commercial extension
sockets. A click switch, however, extends below the circuit board,
requiring the foam block shown in figure 3-1 for a base.
Figure 3-3 is the schematic for the selection socket. It is basically
very simple: 13 pins of the plug are connected to their counterparts on
each socket. The +5 supply (pin 1) is filtered with a capacitor and
switched between the two sockets. The isolation diodes are the only
complication.
Each socket has seven IN914 or equivalent general purpose
silicon diodes. On the pushbutton lines, they prevent the pull-down
resistors of the plugged in paddles from being in parallel. This would
waste +5 current and, if more than four paddles were plugged in atone
time, might overload the +5 supply. The use of these diodes makes
necessary the three 10K pull-down resistors (R3, R4, and R5) on this
board.
The four diodes on the game control inputs prevent the pots in
the unused paddles from affecting the readings of the one in use. These
diodes are a must if correction caps are used on a controller in that
socket. Since they have an effect on the paddle readings, some devices,
such as the sketch pad in the next chapter, will have to have their
calibrations checked when used in sockets with diodes.
- .... "
• , • , (I (fJ "•
@ B
.. ...
--
1
IIIIQ9
00000000 e
.; --
00000000-
...

..

,.
TOP VIEW

SIDE CABLES NOT SHOWN

SIDE VIEW

. .,•
FOAM BLOCK '-t- T .. r
I

MULTIPLE SOCKE T WITH


ISOLA TIO N DIODE S
FIG, 3-2
TOP VIEW
;-6- -i- -J :t-
I 16 15 14 13 12 II IQ I 16 15 14 13 12. /I ((9 9'
I I 1 1

I SOCKET-I 1 LED-I LED-2: SOCKET-2 I


... ; . --.

r
e c-/2=l
If). j1F -r

MULTIPLE SOCKET
rttttttttJ • WI TH ISOLATION DIODES
I 1
, GAME 1\0 I FIG. 3 - 3
: CONNECTOR :
I , (j) DIODES 01 TO 014
I . I ARE IN914
: I 2 4 5 6 1 81 DOUBLE UP '"5
:,J __t_-, __ t _tul_._tut;L AND GND. WIRES
Multiple Socket Extension 39

THE CIRCUIT BOARD FOR


THE SELECTION SWITCH
Figure 3-4 shows the bottom of half of a Radio Shack printed circuit
board (Cat.No. 276-154A EXPerimental), with modifications to suit
this device. The board was cut in half by scoring both sides with an X-
acto knife and breaking it over the edge of a table. Each half will make
a two-socket unit. Drill a hole in the board to suit the switch you
choose and 2 holes for a wire tie to secure the main cable.
The existing copper lanes then have to be cut in 24 places, as
shown by the dashed lines in figure 3-4. This is done by making two
cuts, 1/32 of an inch apart, with an X-acto knife and removing the
copper sliver between the cuts. Some skill and practice, as well as a
sharp knife blade, are required for this step.
Smooth the edges of the board and the drilled holes with a fine
file. Clean the copper lanes by rubbing them vigorously with a pink
eraser. This last step, a standard electronics practice, is vital.
The sockets are installed first. Figure 3-4 shows the pin locations
from the bottom: both # I pins go toward the cable end. The socket pins
and all wires should be bent over flat for 1/16 of an inch before
soldering, since this circuit board does not have the metal-lined holes
(often called "plated-through") that a more expensive board would.
The 1N914 diodes can now be installed on pins 2, 3, 4, 6, 7, 10, and
11 of each socket. The end with the black band is the cathode, or
positive terminal, and must point away from the socket. Bend the
wires over flat, solder them, and cut off the excess. In eighteen places
shown in figure 3-4, the wires must be bent across an open space to
make a bridge from one small copper pad to another. Use the wires cut
off of the diodes to make striaght wire jumpers the same length as the
diodes for pins 5, 12, 13,14, and 15on both sockets. This step will make
it easier to install the cables.
One of the long copper traces that runs through the socket is used
for the ground bus. The negative lead of the capacitor and one end of
each pull-down resistor (R3, R4, R5) go to the ground bus. In addition,
a wire from pin 8 of each socket must be run to this bus, as shown in
figure 3-2.
The single-pole double-throw switch requires three insulated
wires on the underside of the board. The first wire runs from the plus
wire of the cap to the center common of the switch, and the other two
wires run from pin 1 of each socket to the opposite switch terminal.
lLil E=:J E:::!I-E::!l E3 rL!l E3 0

... I·
i

-
• •
• •1
I

••
• • _ -':L'.----=--:::-------:-.
I

- , . . I_ _ •
• • ....,__:o;:;I

.. 1

,.. e' I I i · .1 • I. & • ., •

l:iJ-.@
-1"=1 r=,'
,... e, . :.: . J. • .1 • I- • • ., •
I, • • el· •• ., • -r. ,. • • .,
e . ·1·· I·· .,.
• • • L.:..I
• --=---=----'
· II
I· • ·1 ,. . . ., Fl G. 3-4
IR-2. • ., •

• •

• •
L.:..I·

,. . . ., CIRCUIT
I· . . .,
· . .'
BOARD
..
I
I'
/-
I" ., .
I
,. • ,. • • '1 • FOR
I· I' • • '1 I ,-I·----'-'·1 • · is'- ·1 •
MULTIPLE
• ,. '1 •
I' '--,._---l SOCKET
;

,...
• ·1
·1 . I'
i
!.
,. •

'"'-1,_---',1
·1

· ,.
<!. ., . WITH
DIODES

·· ,.,.
• • l, I· R-S .1 • ,. • ·1 • .
• '1 • ., · a . . ., . BOTTOM VIEW
,. R-3 ., ,. ·1 SOLDER JOINTS

·
+5

,.
• ,. C-I ., • -SINGLE WIRE

-1
., /. - ., - . ., . .MAJOR PART

<.!)- ,. .,

·
· I· . . ., .
. I· ""'--,..----'
• ·1 . ,. "
,- . ., .
• TWO WIRES
• MAIN CABLE

.,
"
-WIRE BRIDGE
I. L.:...!' ·1 ,. '1

..
--- CUT TRACE
I- ,\ I· I· ., .
o HOLES
I'

L.:...I,_ _----l
I
I, '1 -1L,_--,---,-,.,
.,
" •

• • , 'e I· .. .. " .
-H
I'.,
"'-1' -r.--,---..
el -, 1& • • • ,
1/2 RADIO SHACK
CAT NO 276-/54A

-H " S "
.,'1
... ,
I· •
I- :-: •
.
II-i!J ,- :-: '1 •
I· - . e' It .1· I_ .:
-_:;. : C,..-. . -
Q G 8: 1-. •.I: . '?J: r;-"-.----c.'- - - - - - . I

••• Fl.-I
II •• (I (I ........ jo . ,

o WIRE TIE 0

CABLE
Multiple Socket Extension 41
The LEDs (light emitting diodes) used for the prototype are small
and rectangular, one red, one green. They are slightly more expensive
than round LEDs, but that is the only difference. Purchase round ones
of any color, if you prefer them. Install the LEDs beside the socket and
even with its top. From the positive terminal, run a wire around to pin
I of each socket. Then install the current-limiting resistors RI and R2
on a wire run to the ground bus for each. The LED for socket I is in an
area where there are no copper pads, so loop one wire around the other
one before you solder them.
On the pin I side (see figure 3-4), three bus lanes are used for the
pull-down resistors of the pushbuttons. Short insulated jumper wires
are needed to run between pins 3 and 4 and these buses on each end, as
shown in figure 3-2. Both #2 pins are jumped to a bus below the board.
As detailed in figure 3-5, two of these jumper wires go into holes
through which cable wires must also be inserted, so you must wait
until the second wire is ready before you solder them both. There are a
total of five such double-wire holes, and it is somewhat tricky to install
and solder the wires. When using a general-purpose circuit board, you
will run into a few difficulties like this as a matter of course.

CABLES FOR THE


SELECTION SWITCH
The two side cables noted previously must now be made up and
installed. (They were omitted from figure 3-2 for the sake of clarity;
their locations are shown on figure 3-5.) The one on the pin I side has
three conductors for pins 5, 6, and 7. The one on the pin 16 side has six
conductors for pins 10, ll, 12, 13, 14, and 15. You can use two pieces of
ribbon cable or individual wires for these cables.
The main cable requires 14 conductors. You can use a DIP
jumper cable; these come with DIP plugs on each end. Cut off one
plug and fan out the wires. Be certain to check the jumper for
continuity end to end and for each wire, since DIP jumpers sometimes
have open pins.
We prefer to use 16-wire ribbon cable (cut from 20-wire ribbon)
and double up the wires on pins I and 8. This improves the electrical
characteristics of the unit and lets you add the stacked plug/socket
described earlier. The pull-down resistors R3, R4, and R5 need not be
42 The Computer Controller Cookbook

put inside the plug since they are on the board, but careful soldering is
required to place 16 wires in so small a space.
Separate two inches of ribbon on the board end of the cable into
individual wires and trim them to the required length. The longest
wire is the double ground that runs to the central bus. The +5 wires
that run to the plus end of the cap are only a bit shorter. The rest of the
wires connect along each side of socket 1. Each wire is trimmed,
stripped, twisted, tinned, inserted into its hole, and then soldered.
People with small hands have a definite advantage in doing this
type of electronic work. You will find that a stand or clamp to hold the
board is a great help.
The tables should be laid down neatly and secured with a wire
wrap. A I-inch thick block of white plastic foam, stiff but flexible,
from a shipping box makes an excellent base for the unit. Cut out a
hole for the switch and secure the board in place with a small amount
of silicone sealant. If you are concerned about the exposed wires you
could cover the top with a sheet of plastic with three holes cut into it.

TESTING THE
SELECTION SWITCH
To test the selection unit, measure the resistance from pin 1 to pin 8 of
each socket. The reading should be infinite at all switch positions.
Inspect the solder side of the circuit board, looking for bridges between
copper lanes and cold solder joints that have an excess of dark resin. To
double check your work, ask a friend to check conductance wire-by-
wire, with the multimeter on a low ohms setting, and color in a second
photocopy of the schematic.
When you are satisfied that the circuit tests out correctly, plug in
the selection socket and turn on your computer. (We assume that you
first turned your computer off if it was already on.) If the computer
does not start up in a completely normal fashion, turn it off at once and
recheck your work. If the computer starts up correctly, try the switch
and watch the LEDs. Next, turn off the computer and plug a trusted
paddle into your new socket extension. Start up the computer again
and run the Controller Checkout program from chapter 15.
If there are any bugs in the unit, they will quickly become
apparent. Turn off the computer and carefully check the solder joints
Multiple Socket Extension 43
associated with any feature that didn't work properly. Most problems
are visible on close inspection. Also, remember to test the stacked plug
that is now inside the computer case.

CONSTRUCTION OF
OTHER TYPES OF
EXTENSIONS
Figure 3-5 is the circuit schematic for a two-person game multiple
socket board. This unit has an ON/OFF switch for both sockets and
does not need isolation diodes. Pins 2 and 4, 6 and 7, and 10 and II are
cross wired. Like the stacked plug, this circuit gives you the two-
person game feature, but makes it available outside the Apple case.
Alternatively, you could make up a four-socket board that
included both schematics (figures 3-4 and 3-5), with a three-position
rotary switch in the center. The rotary switch would direct power to
sockets I, 2, or 3, while the fourth socket on the board would be
attached to socket 3 as shown in figure 3-5. Seven isolation diodes
would be required for socket 3 (none for socket 4), but the connection
to socket 4 would be located between the diodes and the sockets. But
why stop at four sockets? There is no particular limit except the size of
the circuit board.
The owners of computers other than the Apple will find it
beneficial to bring the game ports out of the case and add a choice
switch. The type of plug is different for each computer, and of course
the pin numbers will change. In many systems, all the plugs and
sockets would be on short cables, with the switch, diodes and resistors
on a circuit board in the center. It will take some work to find the
correct pin out information and to locate a supplier for the connectors.
Some systems may use pull-up resistors, connected to the +5 rather
than the ground, instead of the Apple pull-down resistors. Other
systems may not need resistors at all.
There is one other type of multiple control worth mentioning.
The multiplexing control, for which the computer chooses the active
control, is not used for games. When the control input is a
measurement (for example, of temperature or light level) and you
must log the measurements from more than four sensors
TOP VIEW i

SW-I

I IQ
J1J
I

I'
I
t--1n t--8:1---}
15 13 \/,2 1/ IQ \/'9 1
,
I ,

GAME 1\0 I I
MULTIPLE SOCKET
, CONNECTOR till' I FOR
t _:_ __I DOUBLE PADDLE GAMES
FIG, 3 - 5
Multiple Socket Extension 45

automatically, you would use a multiplexing control.Tn this way you


could monitor a solar hot water system or a science project. This type
of multiple socket is quite similar to the units we have just described
but requires a few additional integrated circuits.

IN CONCLUSION
The multiple socket extension is one of the most popular additions to
the Apple and other personal computers. The home built version not
only costs less than a commercial unit but has more features and is an
excellent beginning project in computer hardware.
46 The Computer Controller Cookbook

Parts List
Multiple Socket Extensions

Number Suggested Total


Required Description of Part Supplier Cost
Experimental Bread Board, #276-154A R.S. $3.70
2 lfi-pin ZIP DIP sockets, #216-3340 Jameco 12.40
2 16-pin W.W. sockets, gold plated Jameco 1.40
I 16-pin header plug jameco .70
2 ft. Ribbon cable, 20-conductor R.S. .40
14 IN914 (orlN4148) diodes Jameco 1.00
I Capacitor, 10 uf, 15 volt R.S. .40
3 Resistors, 10K ohm, 114 watt, 5% R.S. .40
2 Resistors, I K ohm, II4 watt, 5% R.S. .40
2 Light Emitting Diodes R.S. 1.50
Misc. Silicone sealant, solder, etc. 1.l0

Approximate
Cost $26.00

Suppliers: J ameco Electronics


1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
4 Sketch Pad
The capacity of the Apple and other home computers to produce
complex graphics gives us an exciting new artistic medium, but it is
often difficult to use. There are several commercial software packages
that simplify entering images into the computer, but the lack of
suitable drawing instruments limits their use. Graphics paddles and
graphics tablets are currently on the market, but the cost of this
hardware is prohibitive for many would-be computer artists.
48 The Computer Controller Cookbook

o 0
UPRI G HT

o 0
P£ «cu.

SKETCH
PAD
F[ G. .4 -1

If you are interested in experimenting with computer graphics


but can't spend much money on hardware, consider building this
versatile sketch pad, which will let you draw directly into the high
resolution graphics screen. We will show you how to construct the
sketch pad for a total cost of about $30.

FEATURES OF THE DEVICE


The sketch pad has a drawing surface slightly larger than a standard
sheet of paper (8-112 x 11 inches). You can attach drawings and
Sketch Pad 49
photographs to the pad and trace them into the hi-res screen, or you
can use a blank sheet of paper and simultaneously draw on the paper
and the screen. You can also use the sketch pad to read graphs, strip
charts, and business charts directly into the computer.
Figure 4-1 is a drawing of the finished device. Features to note are
the baseboard, the upright post which can be adjusted to change scale,
the head with its two potentiometers, the cantilever, the pencil holder,
and the cable with a box for the pushbuttons.
The uni t is constructed of pI ywood and sheet metal and can easily
be made in a home workshop or shop class. It could be built
completely with hand tools, but the use of a table or radial arm saw
speeds up the job. The wiring is extremely simple, so the electronics
work shouldn't intimidate an interested builder. All in all, this is a
good beginner's project.
We have included three programs in Applesoft Basic (see chapter
15) to give you a start in using the sketch pad. A Linearity Test
program shows how well this sketch pad or a similar commercial
graphics unit is working. The Drawing program, lets you draw
directly onto the hi-res graphics screen in three different modes, store
pictures on disk, and then retrieve them. The Digitizer is a program
that lets you measure points on data sheets and enter them into your
computer for data analysis, a process called "digitizing the data." The
sketch pad will digitize quickly and with reasonable accuracy, and this
program will store and retrieve the data from disk as well. We will
examine all of these programs in detail later in the chapter.

PRECISION AND
LINEARITY
Simple game controllers can be rather sloppy devices, since accuracy is
often sacrificed for speed and feel. But in constructing a sketch pad,
you want all the precision you can get.
Two parameters are important in obtaining that precision. First
is the theoretical precision of the electronic circuits, whether they are 8
bit, 10 bit, or greater. Second is the uniformity or linearity of the
mechanical to electrical converters, in this case the potentiometers.
These considerations arise whenever you are continuously changing
quantities (analog) to numbers (digital) or vice versa.
50 The Computer Controller Cookbook
The paddle input on the Apple II and most other home
computers is a timer circuit which converts a resistance value into a
number between 0 and 255. This is an inexpensive and stable 8 bit
analog to digital (A to D) converter. It is also an extremely slow one.
The best possible precision it can have is one part in 256, or about
0.57%. This sounds pretty good; old style panel meters had an accuracy
of about 5% at best.
The problem with even 0.5% precision is that errors creep in
because of aging components and temperature changes, so that the
theoretical precision is rarely achieved. And, if you have to measure
several numbers and use them in mathematical equations, the
inaccuracies tend to add up. Expensive computer systems usually have
10 or 12 bit A to D converters. (The most accurate converter we have
seen was a 24 bit system in an astronomical observatory.) The more
precision you try for, the more difficult it is to calibrate and stablize the
system so that you can approach its theoretical limit.
The second problem is linearity. For the sketch pad, linearity
defines how straight a line it will draw. The electronic timer circuit
has strikingly good linearity, but the potentiometers do not. If we draw
a graph of the resistance of a pot versus the degree of turn of the pot
shaft, we should get a straight line. But if the manufacturing processes
for the resistive element in the pot are not extremely uniform, the
measured reading will vary from the ideal straight line. If you use
cheap, non-linear pots in the sketch pad, the lines you draw with it
will be bent. Your drawings will look like the reflections in a funhouse
mirror.
There is not much you can do to increase the precision of the
Apple's 8 bit digitizer, at least not cheaply. But eight bits is almost
enough for Apple graphics, anyway. The resolution of the hi-res
screen is 280 by 192 picture elements, and the two paddles resolve 256
by 256. This is more than enough precision vertically, and we are only
short by 8% horizontally.

CONSTRUCTION
Figure 4-2 gives a top view of the baseboard and details of other
wooden parts. The first step in constructing the sketch pad is to gather
all the materials and cut out the parts.
The prototype was made from l/2-inch hardwood plywood (part
of a salvaged kitchen cabinet), but standard fir plywood would work as
1
1<," I );
"
'o(
',. I ' '\ I
j ...

: -
" J)
\
,-

> s: = = iJ
-

=-\
-;

I I

I TOP
VIEW
\
itP
!

PA PER 8.5 X /I
BASE
BOARD

-----------/2 --------------
1----- 6.5 ----------i
CANTILEVER BRACE
.@: :@:
I I I I
1\ I I.
f: I I I I ""
t ,
I I : l : :'

WOODE N PARTS FIG 4-2


METAL PA RTS FIG.4-3 POT
MOUNT
PENCIL HANG ER 2
HOLDER

...,'"
-J

@ @
sc

'"t
...,
ex:
....
<1: 0) / ELECTRONICS
o
u
BRASS o
PB&
o
PBI
BOX

TUBE

@ @)

I iI:11

HEAD
DETAIL
FlG.4 -4

FRONT
VIEW
Sketch Pad 53
well. The drawing surface of the baseboard must be sanded smooth.
The wooden parts of the uprights and cantilever were cut from the
same plywood and also had to be well-sanded, particularly along the
edges. Most of the holes shown in figure 4-1 are for #8 x l-inch wood
screws. They were drilled with a Screw Mate drill, which produces
exactly the right shape hole and counter-sink.
Most of the metal parts (see figure 4-3) were cut from a l/16-inch
thick piece of aluminum scrap. Galvanized steel about l/32-inch thick
would also give good results. You must be able to work the material
with hand shears, but it can't be so flimsy that the parts are easily bent.
When you are drilling sheet metal, you should hold it with vise grip
pliers or in a bench vise to keep it from spinning and cutting your
hand. The front and back of the upright have countersunk holes for #6
flathead wood screws. File all edges and corners smooth as soon as you
cut or drill them.
The parts for the head, which holds the two pots, are somewhat
complicated; figure 4-4 shows them in detail. It helps if you have your
pots in hand so you can trial-fit them. If your first attempt doesn't look
right, make another.
Cut out the two metal pieces that form the hanger (as shown in
figure 4-3), then drill only the two central pop rivet holes. Pop rivet
the pieces together. Now open up the bottom parts of the hanger and
bend them around a l/4-inch bolt to form the pot shaft clamp. Bend
back the bottom tabs so that they don't quite touch. With the bolt still
in place (it substitutes for the pot shaft), drill the clamp bolt holes for
the bottom shaft. Drill the top bolt holes. Then, using this metal piece
as a pattern, drill the matching holes in the cantilever parts and the
masonite spacers.
Cut out the pot mount piece and brace, file the edges smooth, and
drill the holes for the pots. You will need a hacksaw for the two small
cuts. Use the pots to mark the positions of the spin prevention tab
holes. Now bend the pot mount to look like the one in figure 4-4. For
the prototype, the metal was bent in a bench vise with custom-made
oak jaw faces. Fit the brace in position and clamp it with vice grip
pliers in order to drill the pop rivet holes. Install each pop rivet after its
hole is drilled, working from the outside to the inside.
The holder for the drawing instrument is made from brass tubing
available at your local hobby shop. You may want to make several
different size holders for pencils, pens, and a plain wooden pointer or
stylus. Be sure to take the instruments to the hobby shop with you for
trial fittings. Cut the brass tubing with a small triangular file. If the fit
54 The Computer Controller Cookbook

is a little loose you can insert a 3/8-inch wide strip of heavy


polyethylene. sheet (a garbage bag is a good source) inside the tube.
You may have to cut the erasers off the Pencils.
Next, cut a 1-114 inch wood plug from 3/8-inch maple dowel to
fit inside the top of the tube and glue it in place with epoxy. After the
glue has completely set (preferably overnight), drill the pot shaft hole,
the bolt hole, and the saw cleft stop hole. Make the saw cleft with a
hacksaw and file all edges smooth.
Put together the wood parts with wood screws and carpenter's
glue and then fit and mount the metal parts. Install the clamping
bolts, but leave them loose; the upright extension should slip
smoothly into the upright. You may have to sand and rasp the
extension some more to get a smooth adjustment.
When everything fits, take off the metal parts and fine sand the
wood. All wood parts should be finished with two or three coats of
satin-finish polyurethane varnish. When the varnish is thoroughly
dry, reassemble the entire device.
To prevent the sketch pad from scratching your furniture, you
can glue cotton felt to the bottom of the baseboard with contact
cement. To make a better surface to work on than the finished wood,
attach a heavy piece of drawing paper to the unit with drafting tape.

ELECTRICAL
COMPONENTS
The utility of the sketch pad is dependent on good potentiometers: the
pots must be as linear as possible. We have had good luck with the pots
that meet military SPecifications (Mil SPec) described in the parts list,
but even with these you should consider buying a few extras so that
you can choose the ones that draw the straightest lines. The pots listed
have short shafts; they are just long enough for the homemade clamps.
If you have a choice, get long-shafted pots and saw off the shafts as
needed.
The pots do not travel through their full turning of 300 degrees, so
you will need pots with values much greater than the standard values
'of your computer. The 1 meg-ohm pots listed work well for the Apple
II, which normally uses 150K pots.
Sketch Pad 55
If you can't find good pots with the higher values, or if you find
some especially good pots at a surplus store, you can use correction
capacitors, as described in chapter 1. Correction caps can easily be
mounted in the pushbutton box, and you are much more likely to
obtain straight lines if you use them.
The pushbuttons, which should be at least 3/B-inch in diameter,
are mounted in a small plastic box. Your fingers will tire quickly if the
buttons are smaller than this. The correction caps, pull-down resistors
(Rl and R2), and the filter cap (Cl) are mounted on a small piece of
printed circuit board that is placed in this box.

WIRING
For the electronics work on this project you will need a small pencil
soldering iron of 25 to 40 watts and fine resin-core solder. The
necessary hand tools are long-nose pliers, diagonal cutters, and wire
strippers.
The cable from the pots to the pushbutton box must be very
flexible and have at least three conductors. Using four-conductor
telephone cable with the +5 wire doubled up worked well for the
prototype. The cable should be about 30 inches in length-long
enough to loop to the top of the upright and then run to the
pushbutton box. Figure 4-4 shows the pot terminals to which you will
solder the wires.
The run from the pushbutton box to the plug requires six
conductors. Two lengths of telephone cable will work nicely. Ribbon
cable can also be used for this run if that is what you have on hand. If
you have extra wires, double up the +5 supply and ground. The length
of this cable will depend on how far away from the computer you want
to place the sketch pad for general use.
The plug is a standard 16-pin DIP header. You can mount
resistors Rl and R2 on it if you like. Be very careful to identify pin 1 by
its marked corner. The cable usually enters the header from the pin B
end.
The best way to check your wiring is to make two photocopies of
figure 4-5. On the first copy, color in each wire, component, and solder
joint as you progress. Go over your work again and color in the second
copy as a final check. This is standard practice in electronics.
PIN
2 PBi9
>- 3 PBI
- 6 GC t9
119 Gel
I +5
PB
.--
0-
<)
--""'"
8 GND
N.O.
< ? GAME
PB I RI R2 PLUG
N.O. 1;--1 I K. I K.

SKETCH PAD
X-A X IS
SCHEMATIC
PO T '"'---"'---- FIG.4-5
I MEG.

Y-A X IS_ >


POT I
I MEG. ?
9
Sketch Pad 57

TESTING AND ALIGNMENT


If you have a multimeter, check the resistance from pin 1 to ground pin
8. It should be at least 50 ohms (normally, it will be much higher) even
when you press the buttons and turn the pots. Shut down your
computer, plug in the sketch pad, and turn the computer on again. If
your computer does not start up in the normal way, turn it off at once
and recheck your work. Then run the Controller Checkout program
from chapter 15.
To adjust the pots, tape a blank piece of paper on the board and
mark the spot in the center where the pencil is exactly straight up and
down. With a program running that shows the pot readings, and with
the clamping bolts loose, turn the pot shafts within the clamps until
both readings are 128 when the pencil is on the mark.

°
Now tighten all three clamping bolts. Move the pencil around the
paper and make marks at the and 255 points in each direction. The
reading in the top left-hand corner should be 0,0, just as the top left-
hand corner of the hi-res graphics screen is 0,0. If one or both axes are
backwards, you can reverse them by moving the +5 wire to the other
outside pot terminal and resetting the 128,128 point.
Try moving the upright up and down to change scale. Mark the °
and 255 limits for different upright heights to learn the range of sizes
available for drawings. You should be able to adjust from about 6 x 8
°
inches down to 3 x 4 inches. If and 255 fall off the baseboard, you will
need the correction caps as discussed earlier.

LINEARITY TEST
The Linearity Test program (see chapter 15) provides a test of the
linearity of your pots and the accuracy of the sketch pad as a whole. To
make this test you will need paper, a compass, and a straight edge.
Tape the paper to the board and run the program.
As shown in figure 4-6, draw a line front to back down the center

°
of the paper. Mark the points on this line where Y, as shown on the
screen, becomes and where it reaches 255. Using the compass, bisect
this line (the required arcs are shown in figure 4-6). Draw the bisecting
line completely across the paper. Bisect each half of the first line with
short cross marks. Mark the points on this line 5, 6, 7, 8, and 9, as
shown in figure 4-6.
58 The Computer Controller Cookbook

BASE

Y=fY '

(J) TEST POIN TS


x
x
)\ x
X=fY X::255

x x
L INEARI T Y TEST
X ><
FIG.4-6 x
@
Y=255

Mark the 0 and 255 points on the X axis line and bisect the line
between these points. The central point #2 mayor may not fall exactly
on the Y axis. Bisect each half of the Y line and mark points 0 to 4.
Now for the linearity test. Carefully place the pencil on point 0
and press the 0 button, then do the same for points 1,2,3, and 4 in tum.
Move to points 5 through 9 and at each press pushbutton 1. The screen
will now show the correct reading for each point, the value actually
read, the error, and the error as a percentage of full scale. The lowest
repeatable score could have as low as 0.5% as the worst error
Sketch Pad 59
percentage. Sketch pads with error rates below 4% will generally
produce good drawings. Run and test several times to see how good
you are at hitting the same points. Pots with large error values will
draw distorted pictures, but the distortions may lead to interesting
effects.
After testing the unit as described, you may want to cover the
exposed wires on the pots and the DIP header with several coats of
fingernail polish or with silicone sealant. Gluing cotton felt to the
bottom of the pushbutton box will keep it from scratching the
desktop. Be sure to mark pushbuttons 0 and I clearly.

THE DRAWING PROGRAM


Now that the device (and perhaps its builder) have been thoroughly
checked out, we can begin to draw with the sketch pad. The Drawing
program listed in chapter 15 is a fairly detailed sketching program. It
lets you draw pictures in three different modes, save your work on disk,
and retrieve it. The program is menu-driven and includes instructions.
First tape a clean piece of paper onto the board. To run the
program, select item "#1 on the menu to clear the hi-res screen. Next
enter item #4, Drawing Continuous Points, and read the instructions.
Press RETURN. As you move the pencil, dots will appear on the
screen. The 0 pushbutton will show the values X, Y, and HCOLOR.
Pressing numbers 1 through 7 on the keyboard will change HCOLOR
to the number pressed. The ESCAPE key will bring you back to the
mam menu.
Again, press 1 to clear the screen; now select item 5, Drawing by
Continuous Lines. The rules are similar to those for selection 4, but we
think the resulting drawings look better. You might trace a plastic
circle template to see how distorted the circles are on the hi-res screen.
Tracing the same shape several times will give you some idea of how
accurately you can copy drawings. Press ESCAPE to return to the
mam menu.
The third drawing mode is 6 on the menu, Drawing by Reference
Point Lines. Both pushbuttons are used here. Pushbutton 0 does just
what it did before. Pushbutton 1 has a new function: it fixes the stylus
location as a reference point, which will be shown as a small blinking
cursor on the screen. To draw in this mode, think of your picture as a
series of straight lines. Move the stylus to one end of a line and press
button 1. Find the other end of the line and press 1 again. A line will
60 The Computer Controller Cookbook
appear on the screen between the reference points. This drawing mode
is least affected by the non-linearity of the pots.
You can use all three modes in one picture: draw straight lines
with the reference point mode, draw curves with the continuous line
mode, and fill in areas with the continuous point mode. To erase,
simply change HCOLOR to 0 or 4 (black) and retrace the line. You can
shift between the modes without erasing the screen.
Main menu selections 2 and 3 place and retrieve the entire hi-res
screen on the disk (this requires 34 disk sectors). Practice saving and
retrieving a simple practice sketch before spending a lot time on a
drawing. You don't want to risk losing a masterpiece by making a
simple mistake.

THE DIGITIZING PROGRAM


The digitizing program (see chapter 15) assumes that you have a stack
of up to 41 graphs or charts, each with up to 15 data points, and that
you need to transfer this information into the computer. You must
first name the disk file. If you want to add to an existing file, answer
that the file is not new-the program will get the file off the disk.
Adjust the height of the sketch pad upright so that the stylus will
just cover the entire area where points are found on any of the graphs.
If all your graphs are the same size, make a reference corner by taping
strips of cardboard to the sketch pad base. This will make it easy to
place each graph in the same location.
Write down the values of X =0, X =255, Y =0, and Y =255 on the
axes of the graphs. These readings will be needed in the next step. Press
pushbutton 0 to continue.
Enter the units of the X axis (centimeters, days, whatever), then
the graph axis value for X = 0 and the graph axis value when X = 255.
Do the same for the Y axis. Since the 0,0 point is in the upper lefthand
corner, the value for Y = 0 is usually larger than the value for Y = 255.
Now you are ready to transcribe data. Place sheet 0 on the
baseboard, move the stylus to the first point, and press pushbutton O.
The screen will show the X reading, the Y reading, the X axis value in
the X units of the graph, and the Y axis value in the Y units. Continue
moving the stylus and pressing pushbutton 0 to enter up to 15 data
points.
Sketch Pad 61
Pressing pushbutton I at any time will bring up a question
asking if a new sheet is desired. A YES answer brings up a new sheet, a
NO answer sends you to the disk storage routine.
This digitizing program is intended as an example to get you
started. You will probably want to add correction features and
restructure the data files to suit your data reduction programs. The
number of sheets and points is limited by the size of your computer's
memory.

SUMMING UP
The sketch pad is an inexpensive, easy-to-build device that can be used
for computer art work and data entry. Its major limitation is the
imprecise linearity of inexpensive pots. (Commercial units, however,
also have difficulty achieving good linearity.) The programs included
here let you check the quality of the sketch pad and help you get started
with drawing and data entry.
62 The Computer Controller Cookbook

Parts List
Sketch Pad

Number Suggested Total


Required Description of Part Supplier Cost
3 Linear taper pot, 1 meg, mil spec,
CMUI052 Jameco $9.00
1 lfi-pin DIP header Jameco .70
2 Pushbuttons, #275-609 R.S. 1.90
1 Box, #270-230 R.S. 1.90
12 feet Telephone cable, #278-365 R.S. 3.00
2 Resistors, lK, 114 watt R.S. .40
2 sq.ft. Plywood, 112" hardwood preferred 4.00
1 sq.ft. Sheet metal, aluminum or steel 1.00
2 Bolts, 114 x 2" .60
2 Wing nuts, 114" .30
2 Flat washers, 114" .10
16 Flathead wood screws, #6 x 112" .60
10 Flathead wood screws, #8 x 1" .60
3 Bolts with lockwashers and nuts,
#6 x 112" .40
2 Bolts with nuts, #8 x 1-3/4" .30
6 Pop rivets, 118" x 3/16" .40
1 Brass tube (to fit pencil) Hobby shop .60
Misc. Cotton felt, sandpaper,
varnish, etc. 2.50

Approximate
Cost $28.00

Suppliers: J ameco Electronics


1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
5 Homebuilt Atari
Joysticks
In this chapter we are going to look at some homebuilt joysticks for the
Atari and Atari-compatible systems. We will describe two different
designs for Atari joysticks: one is similar to the commercial unit, but
the other is a new type of joystick that can be customized for individual
hand fit and high-speed action. We will also include the electronic
circuit needed to wire these Atari joysticks for use on an Apple
computer.
64 The Computer Controller Cookbook

..

HAND
GRIP

TIPPING DISK

JOYSTICK
SKETCHES
F [G. 5 -I

THE ELECTRONICS OF THE


ATARI JOYSTICK
The Atari joystick is simply a collection of five normally-open,
momentary-contact switches. These five switches allow the computer
to detect a movement in eight directions and to read the input from a
FIRE button. The four switches which control direction are paired so
that only one switch of each pair can be pressed at a time. One pair
controls up or down on the screen, the other pair controls left or right.
Homebuilt Atari Joysticks 65
These switches are paired by mechanical linkages rather than by
electrical circuits. The fifth switch, the FIRE pushbutton, is
mechanically independent of the others, but all share one common
electrical conductor.
This construction is completely different from that of Apple-type
joysticks, which feature two lever-controlled variable resistors. The
Apple joysticks are analog input devices, having many values over
their range, while the Atari type are digital, with only a few discrete
input commands.
In an Atari-type joystick you need precise control so that you can
give an exact command every time, good feel so that your hands don't
tire, and, above all, speed. Another helpful feature, but one that most
commercial joysticks for the Atari lack, is tactile feedback, which
means that there is a definite sound and feel when electrical contact is
made. The joystick should also have good mechanical strength to
insure long life, since it will see heavy use.
Most commercial units for the Atari do not meet the above
requirements. They are often awkward to hold, particularly for
lefthanders; it is difficult to tell when contact is made, and handle
movement is limited and rubbery. We think you can obtain a far
superior joystick if you build your own. Constructing an Atari-type
joystick may seem to be a somewhat mundane exercise, but working
out the details of precise, rapid hand movement makes this task an
excellent lesson in man/machine interface.

FEATURES OF TWO
HOMEBUILT UNITS
Figure 5-1 shows sketches of two joysticks for the Atari. Each unit is
constructed from a block of hardwood in which the switches and
wiring are embedded. The hand grip joystick, like the standard unit, is
·used by holding the block in one hand and the grip in the other. The
FIRE button on top of the handle will feel natural to most players. The
weight of the homebuilt unit improves the feel, and the switches click
to give you tactile feedback.
To operate the tipping disk unit, you hold the block in one hand
and work the FIRE button with the index finger of that hand. (Your
index finger can press a button more quickly than your thumb.) With
i I..
I t(
_
GROO"" ""'J TRIGGER

II _ j,«> BASE
I
I I
I,i,
I,
I I
I I
I I
II( HANDLE
I! GRIP
SIDE
VIEW

HANDLE

SS SECTION
A-A ( SHOWING
CRG WIRE HOLES)

" T (;:;\
ii 10 ATARI JOY STICK.
WOOD
'PLUG FIG. 5 - 2

TIPPING DISK

Tl PPING DISK
JOYSTICK
FIG. 5-3
Homebuilt Atari Joysticks 67
the finger tips or palm of your other hand you press the disk to direct
the movement. With the tipping disk joystick, the player controls the
computer with hand movements that are quite different from those of
the conventional units.

CONSTRUCTION OF THE
HAND GRIP JOYSTICK
Figure 5-2 presents a side view of the component parts of the hand grip
unit. The base is a hardwood block that you make by gluing three 3/4-
inch thick boards together. We used oak for all the wooden parts of the
prototypes, but any attractive wood free from cracks and large knots
will do as well. You could use clear pine, but the finished unit will not
be as strong or good looking.
Cut the microswitch grooves with a dado blade in a table or radial
arm saw (or use a router or handsaw). Since it is somewhat difficult to
cut grooves in this small a block with a power saw, you might want to
start with three 14 by 3-inch boards. Apply carpenter's glue and clamp
them together. Drill the large holes and cut the microswitch grooves
for four blocks into the one large piece. This accomplished, you can
then saw the large piece into four blocks. This is easier than trying to
work with a small block and scarcely increases your cost. If you want to
make only one joystick, choose the best of the blocks and discard the
others.
Cut out the large central hole with a hole saw in an electric drill or
with a large adjustable auger bit in a brace. It is easiest to do this before
the grooves are cut.
The rubber hose shown in figure 5-2 serves as a flexible joint. It is
the type used for automobile heaters and was purchased at an auto
supply store. Other types of hose might be used if they are springy and
not too stiff. Size the wood plug and the base for the hand grip for a
snug fit in the hose.
The hand grip was cut from a single piece of 3/4-inch thick
lumber. With a wood rasp, contour the front of the grip to fit the
fingers of your hand. The microswitch groove was cut with a small
handsaw and a 1I4-inch wood chisel. If you prefer, you can move this
switch to the front of the grip so that you can operate it with your index
finger rather than your thumb. The hole down the middle for the fire
button wires was drilled with a 1I4-inch paddle drill.
68 The Computer Controller Cookbook
Drill the hole for the wood plug and then carve out part of the
bottom of the block to make a cavity in which to place the wire
connectors. Glue the plug in place. For the wire of each microswitch
drill a 3/16-inch hole; drill a slightly larger hole for the main cable. All
of these holes lead to the bottom cavity.
Rasp off the outside corners of the block. (The amount of
rounding off you choose to do is one aspect of customizing your unit.)
Sand all surfaces smooth, taking special care with the hand grip. The
best finish for the wood parts is two coats of polyurethane varnish.

CONSTRUCTION OF THE
TIPPING DISK JOYSTICK
The construction of the tipping disk is much the same as that of the
hand grip unit. If anything, the tipping disk is easier to build. Figure
5-3 shows details of the parts. Cut out the three pieces of hardwood and
glue them together. As noted before, it is easier to make several blocks
at once and cut them apart later. Drill the 3/B-inch central hole and cut
the mieroswitch grooves, following the instructions for the hand grip
unit.
The groove for the FIRE button is on the side of the block; in
figure 5-3 it is shown for right-handed players. The right or left hand
orientation of the unit is set when you cut this groove and the hole for
the main cable. To properly locate the groove, hold the partially
finished block in your hand and find the most comfortable place for
your index finger.
Drill the holes for the wires and the main cable and chisel out the
bottom compartment as before. Round off all outside corners until the
unit rests comfortably in your hand and sand all surfaces smooth.
The tipping disk itself is made of masonite or other thin material.
It can be any diameter that suits you, either larger or smaller than the
base block. Cut it out with a coping saw, and round off and smooth the
edges. The disk and the block should be finished with polyurethane
varnish before you begin wiring the unit.
The tipping post is a short piece of 3/B-inch dowel, one end of
which is rounded. The exact height of the post and shape of the
rounded top affect the feel of the finished joystick, so it is one of the key
elements for personalizing the unit. Do not glue this piece into the
block until you have tried the action and then shaped the end to get the
Homebuilt Atari Joysticks 69
response you want.
The springy foam cross that fits beneath the disk was cut with
household scissors from 1I2-inch thick polyurethane shipping
material. The thickness and shape of this foam piece is another
important element in personalizing the unit.

ADJUSTING THE SIZE OF


THE JOYSTICKS
The dimensions given for both these joysticks will produce a unit that
fits an adult's hands. Smaller hands will need a smaller block. You can
reduce the 3-inch square dimensions of the block to as small as 2-114-
inches for the tipping disk and to 2-1I2-inches for the hand grip unit.
The smaller blocks are somewhat harder to wire. If you cut a wood
block large enough to make three or four units, you can cut them down
to the exact size you need. (Remember the woodworker's lament, "I've
cut it off twice already, and it's still too short.")

ELECTRICAL
COMPONENTS
The key electrical parts of these units are the switches. They are, in
fact, almost the only electrical parts. Radio Shack submini lever
switches were used for the prototypes. Discount mail order houses like
PolyPaks (see chapter 14 for their address) have similar switches for
about half the price. Look for those described as "Leaf"
microswitches. The size of these switches and their terminals varies, so
it is best to have them in hand before cutting the microswitch grooves
in the wood block. Since the hinges on the Radio Shack switches (and
probably most others) are a bit weak, they were strengthened with a
matchhead-size dab of silicone sealant.
The cable for each unit requires six conductors. We used two runs
of 4-conductor telephone cable with stranded wires, but you could use
any small, flexible 6-conductor cable.
The plug for the homebuilt Atari joystick is a DE9S socket from
Jameco Electronics; it is a first cousin to the RS232 socket used on
70 The Computer Controller Cookbook
many peripherals. The hand-wired version of this socket requires a
separate plastic hood. The two plastic tabs on the hood stick out too far
and must be filed down. The two clamping screws included with the
hood aren't needed for this project.
Distinguishing plugs from sockets on computer equipment can
be confusing. A connector is a plug if the small metal parts that
conduct the electricity are metal prongs. It is a socket if these small
parts are receivers for the prongs (note the letter "S" for socket in
DE9S). Either type of connector may be mounted on a cable or in the
electrical device itself. Be careful not to order the wrong type.

ELECTRICAL WIRING
Figure 5-4 is the electrical schematic for any Atari-type joystick. Each
of the five microswitches is wired as a normally-open, momentary-
contact switch. All of their common terminals (a small "c" will
identify them) are connected together and wired to pin 8. Each switch
has its own wire on the normally open (n.o.) terminal.
To install the switches, solder two 3-inch pigtails of insulated
wire to each switch. Telephone cable wire is excellent for this purpose.
Use one color of wire for all the common terminals and five different
colors for the normally open terminals. Poke the wire through the
holes. Position the switches with their hinges toward the center on the
disk unit and down on the hand grip unit. The switches on the hand
grip unit should just touch the rubber hose in its central position.
The switches were wedged into place in the grooves with flat
slivers of wood from a popsicle stick and fixed in place with silicone
sealant. Apply only a small amount of sealant and let it set for a few
hours. (If necessary, you can add more when you have completely
checked out the joystick.)
Now turn the block over. Trim the wires short, but leave enough
length to make the solder joints. Bring the main cable into the cavity
and strip and tin all wires. Group all the common wires together, twist
them, and solder the joint. Solder each of the five other 2-wire joints,
wrap each joint with a small piece of electrical tape, and press them all
into the cavity.
Strip and tin all the wires on the socket end of the cable. Pass the
cable through the hood and solder each terminal. It is easier to solder
the socket if you clamp it upright in front of you in a small vise.
Homebuilt Atari Joysticks 71

CHECKING THE CIRCUITS


You can use a multimeter set on a low ohms scale to check the wiring.
Place one lead on socket terminal 8 and with the other lead move in
turn to terminals 1, 2, 3, 4, and 6. On each terminal, press all the
switches to be certain that the correct switch, and only the correct
switch, shows continuity when pressed. Examine the socket solder
joints for solder bridges and cold joints covered with dark resin. Make
any necessary repairs. Don't assemble the connector until you are
entirely satisfied with your work.

TEST RUN
Turn off your Atari. Plug in your new joystick and turn the system on
again. If it doesn't start up in the normal way, turn it off immediately
and recheck your work. Then run your favorite game to tryout the
unit. If you get crazy responses, you have probably wired some of the
switches to the wrong connector pins.

FINISHING UP
When the switches work correctly you can put the finishing touches on
the new joystick. The hand grip unit could probably use more silicone
sealant on the switches and on the main cable where it comes out of the
block. In addition, you can fill the bottom cavity with sealant, cover it
with a piece of plastic, and clamp or weight it to a flat surface. After the
sealant has set overnight, peel off the plastic, trim any excess sealant,
and glue cotton felt to the bottom with contact cement.
The tipping disk unit deserves some personalizing touches. First
secure the switches, main cable, and cavity as above. Then try out
different combinations of thickness of the foam cross and height of the
tipping post and shape of its top until you get a response you like.
You can even do without the post altogether, or you can eliminate the
foam by gluing the disk to the post with silicone sealant. Use whatever
combination feels good and improves your speed. When you get the
combination you like, glue the foam to the block and the tipping disk
with contact cement.
,I
,- - -DE9S BACK
SOCKET
VIE.W

--t-05 -,

RIGH T I
4 ! COMMON
L, LEF T I 8
3 I
,J

DOWN
I

2
7o-r
TRIGGER
UP 6
I
"/

- - - ----------"

M ICROSW/TCH ATARl JOYSTICK


FIG 5 -4

-
"*-t-
----t-t> <1--'-
-+-l> <:r--L
---+-i:>
<J.--!-
--L.t> 10 IGC/
GNDI I
R4 __
-.,68K R 1 -IK
/6 -PIN HEADER
TOP VIEW

DOWN MICROSWITCH
APPLE
JOYSTIC K
TRIGGER FIG. 5-5
Homebuilt Atari Joysticks 73

ATARI JOYSTICK CIRCUIT


FOR THE APPLE
If you own an Apple computer you may want to make an Atari-type
joystick for playing games that require only limited directions.
Snoogle and many other arcade games are more enjoyable when
played with Atari-type paddles than with Apple paddles because the
former have faster response. The resistance values of the two
potentiometers in such a paddle, however, are limited to "full on,"
"average," and "full off."
The construction of this joystick for an Apple is almost the same
as it is for the Atari systems, except that you will have to make the
bottom cavity slightly larger. Figure 5-5 gives you the schematic for
wiring the unit. Note that two of the switches (down and right) use the
normally closed terminal. The resistors R2, R3, R4, and R5 can be
placed on a postage stamp size piece of printed circuit board and
hidden in the cavity in the block. Resistor Rl can be placed in the
header plug so that only a 4-wire cable will be needed.
This circuit works by mimicking a pot, using two resistors and
two switches. If you don't press a switch, the game control inputs see
the 68K resistors and read approximately 128. If you press the left (UP)
switch, the game controls see zero resistance and read O. If you press the
right (DOWN) switch, the controls see 168K (68K plus lOOK) and read
full scale, 255.
Resistors R3 and R4 are not absolutely necessary, since the game
controls read full scale when open, but it is easier to understand the
circuit if they are shown. The stacked plug and socket described in
chapter 3 works very well with the Apple-adapted joystick.

SUMMING UP
You can build joysticks for the Atari in a home or school workshop.
The materials will cost you less than the purchase of a commercial
joystick, and the great advantage is that you can personalize your
joystick for the exact feel and action you want.
74 The Computer Controller Cookbook

Parts List
Homebuilt Atari Joysticks

Number Suggested Total


Required Description of Part Supplier Cost
5 Lever switch, #275-016 R.S. $7.00
10 feet Telephone cable, #278-366 R.S. 1.20
I Socket, 9-contact, DE9S
(D-submin. connectors series) Jameco 2.00
I Hood, DE-9H (D-submin. hoods) Jameco 1.20
I sq.ft. Hardwood Local 2.50
Mise. Silicone sealant, finish, ete. Local 1.10

Approximate
Cost $15.00

Suppliers: Jameco Electronics


1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
/V: -..........

r
/1 x
--"\ \

"-.. I
'--.Y
/" "'" //

,- /
_/
/
-

-
- !.r-
"-
l[l '-

-: I:::" ::::,....--

6 Race Car
Steering Wheel
There are several auto racing programs on the market, but playing
them with a standard joystick or paddle doesn't give you the sensation
of driving a real machine over a race course. In this chapter we will
build a steering wheel that closely simulates the controls of an
automobile. This analog input device has a single potentiometer that
76 The Computer Controller Cookbook

is turned by the steering wheel and a push button that serves as the
accelerator or horn. A special plug/socket lets two of these units
operate at the same time, thus opening up the possibility of two-
person competitive racing programs. With this controller and
appropriate software, game players can learn valuable driving skills
like recovery from skids and automatic reactions to traffic hazards.
This steering wheel puts you in the driver's seat.
The steering wheel prototypes were tested on an Apple II Plus
computer using the International Grand Prix program (Riverbank
Software, Inc., P.O. Box 128, Denton, Maryland 21629). The unit will
work on any program that uses one paddle and one pushbutton. The
design can easily be adapted for other computers by duplicating the
pot value, wiring, and connector of the standard paddle for that
machine.
This controller is similar to the airplane steering wheel described
in chapter 2, but its design is even simpler. In fact, this is one of the
most straightforward projects in the series: the parts are easy to find,
construction is mostly woodworking, and the wiring requires
minimal familiarity with electronics. Take some care with this project
and you will be proud of the result.

CONSTRUCTION OF THE
WH.EEL SUPPORT
Figure 6-1 is a sketch of the finished unit. A detailed side view is given
in Figure 6-2. The key parts are the leg board, the lower and upper
supports, the pot mount, the three stops, and the wheel itself with hub
and switches.
Figure 6-3 gives you details of the construction. The pot is shown
mounted on the upper support so that you can see which electrical
terminals are used and the location of the cables. A detailed cross-
section of a microswitch mount is also shown. The two microswitches
are wired as a single pushbutton.
Most of the parts are l/2-inch plywood. Scraps of birch plywood
were used for the wheels of the prototypes, but common fir plywood
would look almost as good. The plywood was too thick to make a
comfortable leg board, so lI8-inch tempered masonite was
substituted. The wheel hub was cut from a scrap of hardwood (oak or
Race Car Steering Wheel 77

RACE CAR
STEERING
WHEEL
SKETCH
FIG. 6-1

maple is preferred) since hardwood will drill and tap better than
softwood. Mount the pot on a scrap of sheet metal that is stiff but that
can be cut with sheet metal shears.
RACE CAR
STEERING
UPPER WHEEL
SUPPORT
SIDE VIEW
FIG. 6-2

LEG
CABLE ..-------::::: BOARD
;:::---
FELT
1Q.2 -

0 PLASTIC
WASHERS

rI' ... 1-
2-REQ

WHEEL
BACK VIEW

DETAILS
FIG. 6-3

STOP
MOUNT
o C
UPPER SUPPOR
T

16
-- - 1I- - = = -
LEG BOARD

9 I
'-'I -<;t,

o @
SUPP
2-REQ.

'(
':.
I
I
@
o 0
80 The Computer Controller Cookbook

Cut the two lower supports from two 3 x 9-inch pieces of 1/2-inch
fir plywood. This will produce a medium-size steering wheel. If the
unit will be used primarily by adults, you may want to add two to four
inches to the length of the supports. The extra length is especially
desirable if you use the wheel while holding a small child in your lap.
Children like to play with this controller even when they are too young
to understand what the program is all about. A pair of wheels, one
with the longer supports, works well for parentichild games.
The holes in the supports are merely for decoration. The large one
was cut with a hole saw in a drill and the small one with a I-inch
paddle bit. Center the two lower support pieces one-half inch apart on
the leg board and attach them with four I-inch x #B flathead wood
screws and carpenter's glue.
The upper support is fashioned from three plywood pieces and
the sheet metal plate on which the pot is mounted. Put the two larger
pieces together with two wood screws and glue. Cut out the sheet metal
plate, then drill, counter-sink, and fit it to the pot mount. Hold the
metal with vise grip pliers while drilling, or the sheet will spin and cut
your fingers. Size the central hole (usually 3/B-inch) to fit the pot. The
small hole is for the spin prevention tab on the pot. The four corner
holes are for 1/2-inch x #6 flathead screws. Don't install the small stop
mounting block until you complete and trial fit the wheel.

CONSTRUCTION OF
THE WHEEL
The wheel itself can be any size that suits your needs. The 10 and 1/4-
inch diameter of the prototypes was determined by the size of the
material on hand. For wheels much larger than this the size of the
upper support will have to be increased. Draw the wheel on plywood
with a compass and straight edge and cut it out with a saber saw or
copmg saw.
The hardwood disk for the hub was cut out with a power drill
hole saw. Drill and tap the two holes before attaching the hub to the
wheel. No lubrication is used for tapping in wood, but you should
remove and clean the tap several times during the process. Attach the
hub to the wheel with carpenter's glue and clamp it with a 1/4-inch
bolt and flat washers through the center hole until the glue dries.
Race Car Steering Wheel 81

For the prototypes we purchased Radio Shack #275-016 lever


switches. Cut a rectangular cavity for them in the wheel spokes with a
small wood chisel or X-acto knife. This cavity should stop one ply
short of coming through the plywood. Then drill a small hole the rest
of the way through for the wire.

FINISHING AND ASSEMBLY


Sand all wooden parts and remove sharp corners with a fine wood
rasp. Fill any holes in the edges of the plywood with wood putty or
with wood splinters and glue. Smooth the edges of the sheet metal pot
mount with a fine file.
Now slip the top support between the two bottom supports and
secure it with wood screws and glue. Make certain that the screws,
which come in from opposite sides, miss each other. The angle of the
finished wheel is set by this step. Figure 6-2 shows the approximate
angle, but you can suit yourself since this adjustment is a major factor
in personalizing the unit.
Install the pot mount with the pot in place. Place several of the
washers shown in figure 6-3 on the pot shaft. At least one washer
should be polyethylene plastic (cut, for example, from a coffee can lid).
The rest of the washers can be masonite, wood, or plastic, cut out with
a hole saw. It is easier to add washers than to cut off a pot shaft; about
l/4-inch thickness of washers will be enough to take up the extra pot
shaft length.
Drill out the central hole in the hub to remove glue and then fit
the hub onto the shaft. Curve the top of the stop mount with a rasp to
loosely fit the curve of the hub. You can put a thin piece of cardboard
between the hub and the stop mount while marking its position.
Then, with the wheel removed, attach the stop mount with a single
screw and carpenter's glue.
Now remove the wheel and pot mounting plate and sandall wood
parts. The wheel will look best if stained and varnished. The other
wood parts should get two coats of a bright colored enamel. Finish up
with a coat of satin-finish polyurethane varnish over all the wood
parts. A coat of varnish not only improves the appearance of the device
but also keeps the enamel from leaving marks on furniture and floors.
82 The Computer Controller Cookbook

ELECTRICAL WIRING
For the electrical work you will need a pencil soldering iron of from 25
to 42 watts with a fine point, a damp sponge for cleaning the tip of the
iron, wire strippers, a pair of small long-nose pliers, and small-
diameter resin-core solder. Even if you are a beginner you shouldn't
have much trouble with the electronic work involved in this project.
Use the proper tools and be careful with the soldering.
Make two photocopies of the schematic (figure 6-4). On the first
copy, color in each wire and solder joint as soon as you complete it.
When you finish your work, color in the second copy while checking
each connection.
Buy long-shafted pots of good mechanical construction. They
should have a screw driver slot on the end; otherwise you will have to
cut the slot with a hacksaw. Figure 6-3, the back view of the upper
support, shows the terminals to which you will be soldering the cable
WIres.

PIN
I +5
6 GC
PB

PO T RI 8 G NO.
IK GAME
156JK CON T RO L
PLU G

RACE CAR
STEERING WHEEL
SCHEMATIC
FIG.6-4
Race Car Steering Wheel 83

PIN I SIDE END PIN /6 SIDE

SPECIAL PLUG/ SOCKE T


FOR FIRST UNIT
FIG. 6 - 5

For the switches: use any small momentary-contact, single pole


single throw, normally-open switch that can easily be mounted on the
wheel spoke. The hinge on the Radio Shack lever switch is somewhat
weak so it was reinforced with a matchhead size dab of silicone sealant.
The two switches are connected together by a pair of small wires and
either of them will act as pushbutton o.
As you can see in figure 6-4, only a 3-conductor cable is required
for a unit. We used 4-conductor telephone cable and doubled up the +5
supply wire. The cable can be secured to the lower support with a
plastic wire tie passed through the two small holes shown in the lower
support.
The cable from the pot to the wheel can be secured by forming a
small flag, or tab, on the side of the cable with electrical tape. Wrap
several layers of tape around the cable, leaving the l/4-inch flag off to
one side. On the pot mount end secure the flag under the mounting
plate; on the wheel end use a small flathead screw and washer to secure
the flag. Figure 6-3 shows each end of this cable so that you can route it
correctly. The cable is about 11 inches long and makes a loop behind
the wheel. We used a piece of the 4-conductor telephone cable,
although only two small conductors are needed. You will work out the
exact length and placement of the cable after the stops are installed.
The plug/socket shown in figure 6-5 is similar but not identical to
the one for two-person games described in chapter 3, "Multiple Socket
Extensions." With this plug/socket a second single-pot paddle can be
84 The Computer Controller Cookbook

plugged into the back of the first race car wheel and the second unit
will function as GCI and PBl. You will be able to use two steering
wheels for competitive racing games as soon as someone out there
writes the software.
The plug/socket is a standard wire-wrap socket on which all pins
except 6, 3, and 10 are cut to lI2-inch. Cut pin 6 to about 5lB-inch and
cut pins 3 and 10 to liB-inch. Then bend out the pins slightly and
straighten them to fit over the spades of a 16-pin DIP header. Plug the
header into a loose socket before soldering and double check to be
certain that both # I pins are on the same end. Pin 6 must be bent across
to reach spade lOon the header and pin 2 bent to reach spade 3. Install
the pull-down resistor RI between the socket pins. The cable usually
enters from the pin B end. If you have difficulty inserting a plug into
the socket after the soldering, stick a sewing needle into each hole in
turn to realign the socket parts.
If you decide to make a second steering wheel you will want to use
a standard plug/socket on it so that foot pedals can be used with the
wheels. Foot pedal controllers are discussed in chapter B.

FINAL ADJUSTMENTS
Now mount the single stop on the upper support. For all three stops
you can use small rubber feet or faucet washers held on with panhead
screws. Reinstall the wheel with the washers on the pot shaft, leaving
the set screws loose. The best set screws are the Allen type, but those
with standard screwdriver slots will work.
At this point install the main cable and plug but leave the cable
that runs to the switches disconnected. Check your work visually
against the schematic (figure 6-4). If you have a multimeter, check the
resistance between pin I and pin B. This must measure at least 50 ohms
on any controller and should be completely open (infinite) on this
unit.
Turn off your computer, plug in the new controller, and turn the
computer back on. If start up is not completely normal, turn it off
immediately and recheck all your work on the steering wheel. When
the system starts up properly, run the Controller Checkout program
from chapter 15.
You need to see the readings of GCO and PBOcontinuously so that
you can adjust your unit for full scale and zero. Try turning the wheel
Race Car Steering Wheel 85

left and right to determine if you can get readings over the full range
from 0 to 255. Center the wheel and adjust the pot shaft inside the
wheel with a screwdriver until you obtain a reading of 128. Then press
the wheel firmly onto the shaft and tighten the set screws.
Turn the wheel gently clockwise until you feel the internal stop.
Back off until the reading just becomes 255 and place the second stop
on the wheel snugly beside the first stop, which is mounted on the
upper support. Mark the center of the second stop with a sharp point.
Follow the same procedure counter-clockwise for 0 and mark the third
stop. Turn off the computer and unplug the steering wheel. Remove
the wheel from the pot shaft and install the two stops on it.
The wheel can now be reinstalled and centered on 128. The
readings should cover the full range from 0 to 255, but when you turn
the wheel you should hit the external stops before you reach the weaker
stops inside the pot.
Install the pushbutton cable by first attaching it to the upper
support. Then experiment with various lengths of cable while turning
the wheel. This cable should make a single loop behind the wheel to
keep it out of your way while you are playing. When you have
determined the correct length and direction for the cable, install a tape
flag and screw it onto the wheel near the hole for the switch wire.
As noted in figure 6-4, both switches are wired in parallel so that
each of them can function as PBO. This lets you use either hand to press
the pushbutton. The cable wires are attached to the common and
normally open terminals. You can secure the pair of wires between the
two switches to the back of the wheel with silicone sealant.

FINISHING TOUCHES
You may want to cover exposed electrical connections with silicone
sealant (clear sealant is the least messy to work with). You can cover the
bottom of the leg board with cotton felt, gluing it on with contact
cement. A decal or paper cutout glued to the center of the wheel looks
sporty. Be sure to draw a number on the sides of the lower support with
a felt tip marker. We used 0 for the first wheel and 1 for the second.
Numbering the units will help you keep track of which is which when
you playa game, and besides, all racing machines have a number. Test
your unit one more time with the Controller Checkout program and
then run your favorite racing game.
86 The Computer Controller Cookbook

Parts List
Race Car Steering Wheel

Number Suggested Total


Required Description of Part Supplier Cost
1 Pot, .15 meg, JAIN200PI54UA Newark $4.00
2 Submini lever switch, #275-016 R.S. 2.80
10 ft. Telephone cable, #278-366 R.S. 1.10
1 16-pin DIP header Jameco .70
1 16-pin wire wrap socket Jameco .70
3 sq. ft. Plywood, fir, 112" 2.00
1 sq. ft. Tempered masonite, 118" 1.00
11 Flathead wood screws, 1" x #8 1.00
4 Flathead wood screws, 112" x #6 .50
4 Panhead wood screws, 112" x #6 .50
3 Rubber feet, small .70
Mise. Paint, varnish, glue 2.00

Approximate
Cost $16.00

Suppliers: Newark Electronics


See Yellow Pages or call
main office (312) 638-4411
for local sales office address.
Minimum order $25.00
Jameco Electronics
1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
I
If!lol"..-+---+---+---+---+--.-4

1000000001
.., 000000001

7 Super Stick
Commercial analog joysticks for the Apple and other home computers
are powerful tools for directing a cursor and playing games, but for the
most part they are flimsy units. They don't give the player the
sensation of handling actual machine controls. Super Stick, by
contrast, is a much larger device, about the size of the control stick for a
high-performance aircraft. Super Stick is not quite as fast in response
as the lightweight commercial units, but it has the robust feel of a
controller for a real machine.
88 The Computer Controller Cookbook

This chapter gives you construction details for two different


versions of Super Stick. The machined version is the most challenging
construction project in the book, and the finished device is the most
elegant. It is the only design we've included that requires metal
machining tools for its construction. It makes an exciting project for
an experienced hobbyist or a student in an advanced metal shop class.
The second version, made from sheet metal and wood, is not quite as
elegant, but it can be built in the home workshop. The materials for
either unit are not difficult to obtain. You should read through the
instructions and decide which would be more appropriate, keeping in
mind your needs and the tools you have available.

CONSTRUCTION OF THE
MACHINED SUPER STICK
Figure 7-1 is a sketch of the machined version. The hardwood handle
contains two pushbuttons and is supported by a double-articulated
wrist that serves as the mount for the two potentiometers. The upper
structure is supported by a machined base and a sheet metal saddle that
straps to the leg.
Figure 7-2, in front and side views, gives many more details of the
completed device. It shows the location of the pots and pushbuttons, as
well as details of the pot wiring.
Figure 7-3 provides details of the component parts. The handle
grip is fashioned from two pieces of 6 x 1-1/4-inch hardwood. Walnut
is particularly attractive, but true mahogany also makes a striking
handle. Alternatively, you could use clear pine and paint the handle jet
black, to get a high-tech look.
Cut out the wood blanks with a radial arm or table saw and then
contour them into shape with wood rasps and sandpaper. Counter-
sink three flathead screws (1/2-inch x #4) into the wood to hold the two
halves of the grip together. Then drill the holes for the bolts (1/2-inch
x #2) to mount the pushbuttons and the shaft clamp for the top
potentiometer.
The machining attachment for a small metal lathe was used to
work the aluminum for the top clamp, wrist, and two base uprights.
You can use any material that can be machined, including aluminum,
brass, steel, or plastic. By starting with stock a little thicker than 1/2-
Super Stick 89

SUPER
STICK
tI SKETCH
I

I
I
FIG. 7- /

inch, we were able to take a slight amount off all the surfaces, thus
leaving them with a decorative pattern of machining marks.
First rough out the pieces with a band saw and machine them to
slightly larger than finished dimensions. Then drill all the holes and
PSI

PBf9

SUPER
STICK
FIG 7-2
SIDE
VIEW

BACK
VIEW

flI
'! 0
7-:1.!-) -
INSIDE FRONT VIEW
V)
..... l4J
..... ::t: ,
I
I
0.'" \
,
J
I
I '0
I
I
C\l
Lf'i ,
I

\.0
,
I

C\j
0

LEFT RIGHT
HALF HALF

\.. 0 DRILL &, TAP


\, I
I
iTO P ! CLA¥ fl.
o
r- 12
0

HARDWOOD
it
HANDLE
SUPER STICK
DETAILS
I I'

FIG. 7 - 3

p'lT
I

bW. Cl
'
BUSHING

f-- I -t co I
.1",
0 ....
-ROD'
1 0 '.
:': I,'
'
DRILL"
WRIST
BASE UPRIGHT

LEG MOUNT
-----S-H-EE--=-T-M-E-::-:r.=-A-L 8 . 5 1 - - - - - - - - - - - ' 4
I

o 0 U1
h
l\1
<p

@ <D

C\l
92 The Computer Controller Cookbook
tap the threads that are shown in figure 7-3. Choose the tap size that is
appropriate for available bolts and set screws. Caphead screws set in
counter-sunk holes are best for the top clamp and wrist, while panhead
bolts are best for the leg mount and base.
When you complete the rough work, go back over all surfaces
with a small milling tool on a final shallow pass. This will bring the
pieces down to exact dimensions and leave the characteristic
markings. On the prototype, all edges were beveled off with a power-
belt bench sander. You could also use a fine file for this step.
The brass bushings were cut from l/4-inch (internal diameter)
hobby shop tubing, but commercial brass bushings with thicker walls
would be easier to machine. You could even machine these bushings
from brass stock on a lathe. The bushings should not spin, so
remember to secure them in place with thread sealant.
Since you may have difficulty obtaining the thicker block needed
for the one-piece wrist, figure 7-4 shows an alternate construction of
the wrist using three pieces of l/2-inch stock. To insure that the top
clamp piece will move easily between the two uprights, two pieces of
shim stock are required for construction.
The pots will be needed during machining to measure the exact
size of their mounting bushings and shafts. Different manufacturers
vary the sizes slightly. If you do not have the pot when you do the
machining, leave 3/16-inch pilot holes for the time being. Trim the
pot shafts to the correct length and saw screwdriver slots in their ends.
The leg mount for the prototype was cut from l/16-inch
aluminum sheet and then drilled, using the base as the pattern. Pass
panhead screws up through the leg mount and base and screw them
into the two base uprights. The leg mount was finished with an orbital
sander to remove all tool marks and give a matte finish. You could use
a small cup wire brush in a drill press to obtain the swirled finish
found on the cowling of the Spirit of St. Louis.
When assembling the pot mounts, don't overtighten the set
screws and clamps, since this can crush the pots and make them hard to
turn. Put some sealant like Loctite on the bolt threads to insure that
they don't loosen.
The wood handle requires fine sanding, staining, and finishing
with two coats of polyurethane varnish. After you attach the leg mount
to the base and uprights, bend it to fit your leg. Cover the inside of the
leg mount with cotton felt. Attach a cloth or leather strap to the leg
mount with swat rivets from a leather supply store. Sew a piece of
Velcro to the free end of the strap and glue the Velcro mate to the leg
mount with epoxy.
DRILL 00'-
"
---'"
TO FI T--> o
POT

Pt;JE> 0
h3ri . . --- - --- --
1'5-----<>j Ji .':-.:-:-: r-r-'
DRILL&. TAP
4PLACES

1--.5-1
D
BRASS BUSHING
THREE PIECE
100--/.5 WRIST
I e
SHIM STOCK
$ Ii FIG. 7-4
FRONT
VIEW
LDRILL & TA P
2 PLACES

SHEET METAL
VERSION
FIG. 7-5

S CRI B E ME TAL

C 1 1
4 PLACES
_I

f.:J1
0 0 _ 0 .L 2 .5

1-£25-1'--
e I f1
r
8-
'\T
L i

;,il
o : h_n_

"J:qT I 0 0
I I 1;1-0 I cu t
o 0 -.J -LL J, POT
I MOUNT
BASE
2 REQ. TOP CLAMP
2 REQ.
16
LEG BOARD

\.

° f-- ---J SPAC ER


1

... BASE

1
UPRIGHT
2 REa.

II
II
0"
.,--,-'-,-\
.
""
---I.L..----l
94 The Computer Controller Cookbook

CONSTRUCTION OF THE
SHEET METAL VERSION
Since not everyone has access to a machine shop, we decided to include
a home workshop version of the Super Stick that can be constructed
from sheet metal and wood. No unusual tools are necessary for the
project. The result, shown in figure 7-5, is a solid, attractive device
with good, fast action.
The construction of the sheet metal Super Stick is similar to that
of the Sketch Pad (see chapter 4). For the metal work, only a drill, sheet
metal shears, file, and pop rivet gun are necessary. Either hand or
power saws can be used for the wood work.
The metal should be stiff, but thin enough to cut with hand
shears; aluminum or galvanized steel will do nicely. Cut out the six
metal pieces, then round and smooth all edges with a file. Make the
two cuts for the pot mount with a hacksaw.
Hold the metal pieces with vise grips or in a bench vise while
drilling them. To start each hole, strike a point with a center punch,
then drill a pilot hole of about 1/8-inch. Don't drill the pop rivet holes
in the pot mount until you are ready to install the rivets. The two holes
in the pot mount for the spin prevention tabs must be custom fitted to
the pots you choose.
You can make the bends in the sheet metal with a sheetmetal
brake, a vise, or vise grip pliers. Only one of the top clamps needs to
have the large side tabs shown in figure 7-5. The only bends that are
difficult to form are those for the pot shaft clamps in the base and for
the top clamp. Pop rivet the pieces together, then bend open the two
pieces and form the clamp around a lI4-inch bolt. Using washers on
the pop rivets keeps the sheet metal from bending in the wrong places.
The two sheet metal ends of the clamp should be about lI8-inch apart
with the shaft installed.
Don't worry if you fail in your first attempt to make the sheet
metal parts. Sheet metal is cheap, so discard the piece and start over.
Bend the pot mount in the direction shown in the front view (figure 7-
5). Clamp the predrilled brace in place with vise grips and drill the first
pop rivet hole. Install the rivet, then drill the holes and install the
other three rivets in turn.
Now cut off the pot shafts and saw screwdriver slots into their
ends. Apply Loctite to the pot mounting threads after you complete
the final adjustments.
Super Stick 95
The handle grips on the prototype were cut from hardwood scrap
with a radial arm saw and then shaped with wood rasps and
sandpaper. The bottom of the handle at the lower end where the top
clamp is attached is a little different than that of the machined version.
The notch on the sheet metal unit cuts both pieces, but the top clamp is
screwed to only one piece of the handle. You can make the inside wire
groove and switch cutouts with a saw or wood chisels.
The leg board and spacer are cut from tempered masonite. You
can make the base upright from any available wood or plywood. The
base should be held together with screws and glue, but the handle is
held together with counter-sunk screws only, since you have to open it
up again to wire the switches. Sand all wood parts and finish them
with two coats of polyurethane varnish.

ELECTRICAL WIRING
The wiring for this project is not difficult since Super Stick is simply a
two-pot joystick with one or two pushbuttons. The pots should be
mechanically superior and long shafted. You will have to cut the
shafts to length and add screwdriver slots, as noted previously. The
pots in these units do not travel through their full 300 degree turn. You
can use pots with values larger than standard for your computer, or
you can work with easier-to-obtain pots with values of WOK and add
correction caps as described in chapter 1. (The standard pot value for
the Apple is 150K; for this prototype we used 250K pots.) You can
mount the correction caps on a small piece of PCB in the cable about a
foot from' the plug and encase them in foam packing material.
For pushbuttons you can purchase any normally-open,
momentary-contact switches that can be mounted easily on the
handle. We used subminiature lever switches mounted with #2 nuts
and bolts. The switches and bolts came from Radio Shack.
If you choose to install only one switch you will need only four
wires in the cable. The telephone cable noted in the parts list is
adequate. For two switches a 5-wire cable is necessary, and this is
harder to find. You can substitute two runs of the 4-wire telephone
cable, which gives you extra wires to double up the +5 and ground if
you use correction caps.
The best plug for Super Stick is the plug/socket described in
chapter 3. The pull-down resistors RI and R2 (figure 7-6) can be
PBQ
,.,
,- _':'...1 I

, __ I
,
L - - -- -!C
N.O.

r- - T SUPER STICK
PBI I 0...:...'----.
1--
I N.O.
""-1 !
SCHEMATIC
1...--,---1'-'
_IC.
1- -
FIG. 7-6

POT

25fY K

PO T
I PIN
25(9 K +5
2 PB
3 PB I
6 GC (S)
Gel
8 GND.

GAME I/O
RI R2 CONN EC TOR
IK IK
Super Stick 97

mounted inside the plug. If you look carefully at the pots in figure 7-2
you can see which outside terminal is connected to the center terminal
with a loop of wire, as indicated in the schematic (figure 7-6).

TESTING AND ALIGNMENT


When you are through with the wiring, check your work against
figure 7-6. Then turn off the computer, plug in your new joystick, and
turn on the computer again. If startup does not proceed exactly as
usual, turn the computer off immediately and recheck your work.
Now run the Controller Checkout program and check the
pushbuttons and pot readings. Adjust the pots by loosening the
clamping bolts and turning the shafts with a screwdriver until you get
readings of 128 for both GCO and GCI with the handle straight up.
Then retighten the bolts and move the stick all around. You should be
able to get full range readings (0 to 255) in both axes.
If either axis works backwards to the way you intended, trade the
wires on the outside terminals of that pot and realign the unit. Now
you are ready to run one of your favorite games to test the action of
your new Super Stick. We think you will find game playing a lot more
exciting with a solid controller to grasp.

FINISHING UP
You can lock all the clamp bolts with Loctite or nail polish. The
cables should be securely tied to the pot terminals with dental floss;
coat the terminals with silicone sealant. A dab of sealant on the
pushbutton hinges will help to strengthen them. Secure the cable to
the base with a plastic wire tie.
The leg mount and strap cannot easily be adjusted down to fit a
child's leg. If you prefer, you can mount the machined Super Stick on a
leg board like the one the sheet metal version is mounted on.
98 The Computer Controller Cookbook

Parts List
Super Stick

Number Suggested Total


Required Description of Part Supplier Cost
2 Pots, .25 meg, JAIN200P254UA Newark $4.00
2 Submini lever switch, #275-016 R.S. 2.80
I 16-pin DIP header Jameco .70
I 16-pin wire wrap socket Jameco .70
14 ft. Telephone cable, #278-366 R.S. 1.50
2 Resistors, IK, 1/4 watt R.S. .20
4 lbs, Aluminum machine stock Shop 5.00
1/2 sq.ft. Hardwood Shop 1.00
I sq.ft. Sheet metal, aluminum Shop .50
Mise. Bolts, felt, glue Local 2.40

Approximate
Cost $20.00

Suppliers: Newark Electronics


See Yellow Pages or call main office (312) 638-4411 for
local sales office address.
Minimum order $25.00
J ameco Electronics
1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
Shop-These items were obtained through the shop in
which the work was done.
All other parts were purchased at a local hardware store.
8 Foot Pedals
To get realistic action from the airplane or race car steering wheels (see
chapters 2 and 6) you need to use foot pedals with them. But the need
for foot pedals goes beyond making games more enjoyable. Several of
the most important aspects of flying and driving involve the
coordination of hand and foot movements. You can't use the power of
the computer to learn to fly or drive until you can practice these
essential coordination skills.
100 The Computer Controller Cookbook

FOOT PEDALS
SKETCH
FIG.B-/

These skills are critical in dangerous situations, such as landing a


light plane in strong crosswinds or recovering from a skid on an icy
bridge. With the steering wheels, foot pedals, and appropriate
software, you can practice vital responses in a simulated but realistic
environment. You can learn to anticipate and prevent accidents and
gain the confidence you need to pass licensing tests.
At present there are no commercial programs that use both
steering wheel game controls and foot pedals. As this kind of hardware
becomes available, commercial programs will certainly be modified to
take advantage of this new feature. Meanwhile, you can write your
own. If you can come up with-even a modest program incorporating
Foot Pedals 101

foot pedals you could undoubtedly get it published as an article in a


magazine. The steering wheel/foot pedal combinations add such
realism to flight and traffic simulations that we are certain software
development will proceed at a rapid pace.
The program we used to test the foot pedal prototypes was
International Grand Prix by Richard Orban, from Riverbank
Software, Inc. This program uses one paddle for the race car steering
wheel and one pushbutton for the accelerator/brake. When this
program is used with the race car steering wheel (chapter 6), the wheel
controls the steering and the horn button controls acceleration and
braking. This is a vast improvement over a conventional paddle in
terms of feel and realistic action, but we all know that you don't brake
an automobile by honking the horn.
The prototype foot pedals were originally designed with two pots
and no pushbuttons. To use a foot pedal with the International Grand
Prix program we added a simple microswitch and a second cable and
plug (see figure 8-1). Now the car accelerates when you move the foot
pedal forward and brakes when you move it back. This is one step
closer to real driving.

CONSTRUCTION
This is the easiest project to build in the entire book. It is a good
exercise for the home or school woodshop, and the materials are
inexpensive and readily obtainable. All the wood parts are l/2-inch fir
plywood except the heel rest, which is hardwood scrap. You can
complete this project using only hand tools, but a table or radial arm
saw will speed your work.
Figure 8-2 shows side and back views of a completed foot pedal.
The left and right units are identical, so remember to make enough
parts for two units. Figure 8-3 gives you details of the separate parts
and a top view of both the base and the foot rest.
The eight pivot supports (figure 8-3) require careful attention.
Two are simple pieces of plywood with l/4-inch holes and a
thumbtack at one end. The holes in two more supports are lined with
brass bushings (l/4-inch ID). Another two supports have a l/4-inch
hole for the pot shaft and a drilled and tapped hole for a set screw. The
last two supports are drilled out for the pot mounting bushing
(usually 3/8-inch), tapped for a set screw, and notched for the spin
prevention tab on the pot.
102 The Computer Controller Cookbook

HEEL FOO TREST


REST

SET DOWN
SCREWS STOP

BASE

FEL T

FOOT PEDAL
S IDE AND
BACK VIEWS
FIG. 8-2
PO T

SWITCH

After cutting out the plywood and hardwood pieces, round the
corners and edges with a rasp or saber saw and sand all parts smooth. A
Screw Mate drill bit is ideal for drilling the screw holes. Assemble the
bases with l-inch x #8 flathead screws and carpenter's glue. Then
assemble the pots, upper pivot supports, and bolts. Attach the foot
board to the upper pivot supports with the same size screws. Now take
the entire unit apart and finish all wood parts with a bright-colored
oil-based enamel.
If you are installing the switch feature that lets the foot pedal act
as one pushbutton for the International Grand Prix program, you will
need a small sheet metal switch mount (see figure 8-2). Using hand
shears, cut this out of galvanized steel, aluminum, or brass. Drill the
top two holes in the metal to suit the switch and the bottom two for
l/2-inch x #6 panhead screws. For the prototypes we used a submini
lever switch. The switch and the small mounting nuts and bolts were
purchased at Radio Shack. Hold the sheet metal with vise grip pliers or
in a bench vise while drilling so that it won't spin and cut your fingers.

BASE FOOT REST

TOP VIEWS

FO

1 1·---.
I

:0'
I
,-- -:
I I

I I
I I I ::;: I
I I 1'1'1 I
---r
l()

....L...l--------------I-

4----;1
TACK

PLASTIC HEEL REST


- _ir
- - :_:"f!_fH---+
PI VOT
SUPPORT
SHE
W C 0 : I ao.
,-.25 J.D. (---.-----
l\.I

a 8.-REGINALL
4- REQ. DOWN STOP
3--
,:.
I'
TO POTS .r-.25!D,
2.-SETSCREW r :
2 -BUSHING 0 LJ
2 - THUMB TACK 1-'.51
BRASS
POT BUSHING
WIRING 2-REQ

SWITCR
MOUNT "
2-REQ ::"
FOOT PEDAL
DETAILS
FIG. 8-3
104 The Computer Controller Cookbook

It is best to make the mount a little short, then move it up into position
by shimming under it with thin cardboard, wood, metal, or plastic.
The thumbtack shown in figure 8-2 should throw the switch when
your foot is in a comfortable position, in the middle of the pedal's
range of movement.
The l/4-inch bolts that form half the turning axis must have flat
washers where the bolthead and nut touch the wood, and a plastic
washer between the two wood parts. After final assembly, lock the nut
by applying Loctite, Super Glue, or fingernail polish to the threads.

ELECTRICAL WIRING
The foot pedal prototypes were wired for two separate game control
arrangements. One arrangement has two foot pedals, each with one
pot and no push button. The second arrangement has a single
pushbutton on one foot pedal and was designed especially for playing
International Grand Prix.
Figure 8-4 is the schematic for the two-pedal version. The pots
have short shafts (7/8-inch) and are mechanically rugged. They do not
turn through a full 300 degrees, so their maximum values must be

PIN
I +5
6 GC(9
POT 1(9 Gel
& 8 GND.
100 GAME [\0
K CONNECTOR
C/ C2
.t t ot: .i tur:
POT TWO POT
/
100 SCHEMATIC
K
FIG. B-4
Foot Pedals 105
PIN
r - - - - - - - - - - -..... , f 5
r - - - - - - -.....- -..2 PBl9
\:- --;;N.a RI
IK
8
GAME [\0
GND

CONNECTOR
L __ ...J.

C.

ONE-SWITCH
SCHEMATIC
FIG. 8-5

'6 P[N W. W. SOC K E T


Q

la.J
Q "'""'-'IT--n- .....-,t-lr--..--'
la.J

a::
«

DIP
SIMPLE SOCKET/PLUG
FIG.8-6

about four times the normal paddle pot values. If you use lower value
pots, correction capacitors Cl and C2 will be needed. For the
prototypes, lOOK pots and correction caps were used. These caps were
placed on a small piece of printed circuit board and encased in a foam
block at the place where the cables from the two pedals come together
(see figure 8-1). If you use correction caps you will have to run the
106 The Computer Controller Cookbook

Correction Cap Calculation program from the software chapter to


work out their values.
The circuit for the single-pedal version is shown in figure 8-5.
The common and normally-open terminals of the switch are utilized.
The pull-down resistor RI is placed in the plug/socket (figure 8-6).
Note that all the pins on the socket pass straight through; no pins are
cut or bent. This circuit simply adds an additional pushbutton 0 to
whatever paddle is plugged into its socket.
If you make up two foot pedals and add the switch circuit (figure
8-5) with its separate plug/socket to the foot pedal with pot I, you will
be ready to play any existing games and the future software that will
use all the foot pedal pots. While you are waiting for the new software,
you can plug the two-pedal version into the plug/socket of the switch
version and play your favorite single-paddle games with your feet.

FINISHING UP
You don't want the foot pedals to slide under your feet, so the bottoms
should be covered with something that grips the floor. If you will be
placing them on wood or linoleum, cut and fit some pieces from an old
inner tube on them. Cotton felt will grip a rug; for thicker carpets try
incising shallow saw cuts across the width of the bottom. Extra weight
helps, so you can add extra thicknesses of plywood to the baseboard or
simply make the baseboard out of 3/4-inch stock.
Perhaps you want the units to spring back to the open position
when there's no pressure on them. You could do this by attaching
rubber bands from the heel rest to the middle of the base, or by placing
a urethane foam block under the middle of the footrest. There are
probably many other different ways to spring-load these foot pedals.
Use your imagination and experience to come up with a solution that
suits your needs.
Foot Pedals 107

Parts List
Foot Pedals

Number Suggested Total


Required Description of Part Supplier Cost
2 Pots, lOOK, short shaft Jameco $6.00
1 Submini lever switch, #275-016 R.S. 1.30
15 ft. Telephone cable, #278-373 R.S. 1.70
2 16-pin DIP headers Jameco lAO
2 16-pin sockets, wire wrap Jameco lAO
1 Resistor, l K, 114 watt R.S. .10
2 sq.ft. Plywood, 112" fir Local 2.00
2 Bolts, 114" x 1-112" Local 1.00
4 Flat washers, 114" Local .20
2 Nuts, 114" Local .10
1 inch Brass tubing, 114" I.D. Hobby shop .20
6 Flathead screws, 1" x #8 Local .50
4 Set screws, 112" x #10 x 24 Local .50
Mise. Nails, sandpaper, finish Local 2.10

Approximate
Cost $19.00

Suppliers: Jameco Electronics


1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
9 Converters: Between
Apple and Atari
If you or your friends have Atari game systems and an Apple computer,
you might want to use your favorite Atari joystick to play games on the
Apple. Or maybe you want to play games on your Atari using an
Apple joystick. With the two converters described in this chapter you
can have both these options.
110 The Computer Controller Cookbook

There are some limitations, however. The Atari-type joysticks


have a digital output, so you can use them on the Apple for only the
simplest games, like Snoogle, for which the joystick directs the
movement of a character. For the many arcade games that require only
digital input, Atari joysticks are much faster than conventional Apple
joysticks.
We will cover the construction of two small circuit boards that
function as converters: the first one, an Atari-to-Apple converter,
plugs into an Apple computer. You plug your Atari joystick into this
converter to play fast-action arcade games on the Apple. The second
converter plugs into an Atari system so that you can plug an Apple
joystick into it. Now you can play Atari games with your Apple
controllers.
The Atari-to-Apple converter will greatly increase your speed in
playing arcade games on the Apple, especially if it is used with
homebuilt Atari paddles like the Tipping Disk (see chapter 5).
Consequently, we expect that there will be greater interest in this first
type of converter. The second converter, the Apple-to-Atari, is
included because there is educational value in making up the circuit.
But even more important, newly developed flight simulator or race car
games for Atari-type systems will greatly benefit from being played
with the steering wheel and foot pedal designs given in this book.
Then your Apple-to-Atari converter will provide an exciting new
realism when you play these games.
Both of these boards are good beginning electronics projects.
Each has one or two integrated circuits, a few components, and some
cables and plugs. Each is easily assembled on a small piece of general
purpose printed circuit board. The parts are inexpensive and easy to
obtain.

CHARACTERISTICS OF
APPLE AND ATARI
JOYSTICKS
The Apple joystick and the Atari joystick are two completely different
devices. The Apple joystick has two lever-controlled pots and a
pushbutton, while the Atari joystick is a collection of five
Converters: Between Apple and Atari III

pushbuttons, four of which are mechanically connected in two pairs.


The Atari-to-Apple converter must make pushbutton closures look
like changing pot values. The Apple-to-Atari converter must make
changing pot values look like switch closures. In addition, there are
two other differences between these joysticks that may cause some
confusion when you build these converters.
First, the Apple joystick has its common connection (one side of
each pot and each pushbutton) connected to the +5 volt supply line.
The common connection for the Atari joystick (one side of each
switch) is normally connected to the ground wire. The easiest way to
design each of these connectors was to make the common connection
of the type required by the host computer. This means that pin 8 of the
Atari connector, which normally would be connected to ground, is
connected to the +5 volt supply (pin I) of the Apple game plug on the
Atari-to-Apple converter.
The second difference is that the connector on the end of an Apple
joystick cable has pins on it, so it is defined as a plug. The connector on
the end of the Atari joystick cable has holes in it, so technically it is a
socket. We have used the correct terms in the hope that you will order
the correct parts. If you get confused, blame Atari, since they have
installed a socket where you normally expect to find a plug.

CONSTRUCTION
Each circuit is made up from one-third of a' printed circuit board
(Radio Shack #276-154). You can mount the board in a small plastic
box like a cassette tape holder or inside a block of flexible packing
foam. To cut the circuit board, score it deeply with an X-acto knife and
break it over the edge of a table. Drill the holes for the wire ties with the
end of the knife and file all the circuit board edges smooth. Mounted
on the board are several resistors and capacitors and sockets for the
chips. Both boards draw the small amount of power they need from the
host computer.
Most of the connectors for both converters are mounted on short
pieces of cable. The Apple-to-Atari converter does have one socket for
the Apple joystick; this socket is mounted directly on the board rather
than on a cable.
112 The Computer Controller Cookbook

THE ATARI TO APPLE


CONVERTER:
CIRCUIT THEORY
Figure 9-1 is a sketch of the Atari-to-Apple Converter without an
enclosing box. Since this simple circuit can handle two joysticks,
giving you the option of playing two-person games, the sketch shows
plugs for two Atari joysticks. If you won't be playing such games you
can install only one connector and save a little money. The circuit
requires two chips, one capacitor, and fourteen resistors.
Figure 9-2 is a simplified schematic of the circuit that will help
you understand how the card works. As noted, two chips are used. The
74LS04, a digital chip, has six inverters. If the input to an inverter is
high (+5 volts) then its output goes low (nearly 0 volts), and vice versa.
The second chip, the 4066, is a special purpose CMOS chip. It acts like
four small single-pole, single-throw relays. If one of its control lines is

APPLE
PLUG

SKETCH- AJARl TO APPLE


FIG. 9-/ CONVERTER
Converters: Between Apple and Atari 113

A TAR! +5

R7 APPLE
68 K GAME
PLUG
8
Gel
RI2
lOOK
2
1/4
4066

L-- G NO.

A TAR! TO APPLE
SIMPLIFIED SCHEMATIC
FIG. 9-2

brought high (+5 to +15 volts), then one of the relays closes and
conducts electricity. If the control line is low (0 volts), then the relay is
open and does not conduct.
The Atari joystick has two internal normally-open switches that
correspond to the directions up and down. For the Apple to read these
two switch closures they must be converted to pot readings between 0
and 150K.
Depending on the position of the Atari joystick, the game control
circuit may read 68K (R7), 0, or 168K (R7 + RI2). These resistive values
are read as 128, 0, and 255 by the Apple, and the program interprets
them as center, up, and down.
With the handle in the center position, R7 is in the circuit but R12
is bypassed by one section of the 4066, so the reading is 128. If the
handle is pushed up, the switch in the joystick bypasses R7 and the
reading is O. If the handle is pushed down, the section of the 4066 opens
and the reading is 255.
The inverter in the 74LS04 and the pull-down resistor R3 make
the section of the 4066 operate the opposite of the down switch in the
joystick: when the down switch is open the 4066 section is closed and
VICe versa.
-
r---

RlL-...:.I-4vf-- ...J
0- I R;4/K
R-/ IK

.. " .
R-5IK vv
v v
/K
/K
L I L..- "

[C-I 74LS04
TOP VIEW

IlR9 68K \ R-7 68K


IIRi 0 681<
vv - RfJ 68K

I
,- - - - - - - - - 1
I -;-' __
,I
I
I A

R-13 100K : R-12 lD <0--+----'


I

R-/I 10eK I
.....
-J
o [C-2 4066
::>
l()
-+-
+11
Converters: Between Apple and Atari 115

This circuit is repeated for the left and right switches. Since there
are four switches in the 4066 chip and six inverters in the 47LS04 chip,
you can control two joysticks with just these two chips simply by
adding a few more resistors and a second connector.

THE ATARI-TO-APPLE
CONVERTER: WIRING
Figure 9-3 is the complete schematic of the Atari-to-Apple converter.
Once again, follow the procedures outlined in chapter 14 for checking
your wiring by coloring in two copies of the schematic. The Apple
plug is a 16-pin DIP header and is shown as it appears from the top.
The Atari connectors are shown from the back as they will appear
when you solder them.
A word of caution: the 4066 is a CMOS chip and these are easily
damaged by static electricity. Leave the 4066 in its protective package
until you have completed the circuit and thoroughly checked it out. It
is imperative that you use a socket on the board for this chip.
We used #24 solid wire from a scrap of telephone cable for
jumpers on the board. Ribbon cable was used for the cables to the
connectors. The cable for the Apple plug requires eight conductors,
but we doubled up the +5 supply and ground, so ten conductors were
installed. Two 6-wire runs of cable were used for the Atari sockets.
Double check your work before applying power to the circuit.
Color in the second copy of the schematic, using an ohms meter to
trace the wires. When everything checks out, plug the two chips into
their sockets on the board, making sure the #1 pins are in the correct
places, and install the plastic hoods on the Atari connectors. The
hoods have small plastic tabs that may have to be filed down. They also
come with mounting bolts, which aren't needed for this project.
To test the converter, tum off your computer, plug in the new
unit (without a joystick attached to it), and turn the computer back on.
If the computer does not start up exactly as usual, turn it off
immediately and recheck all your work. When the circuit checks out,
tum off your computer, plug in an Atari joystick, and turn on the
computer again. Now run the Controller Checkout program from the
software section and check out the game paddle reading of your new
adapter and joystick combination.
116 The Computer Controller Cookbook

THE APPLE-TO-ATARI
CONVERTER
Figure 9-4 is a sketch of the Apple-to-Atari converter. If an Apple-style
joystick or set of paddles is plugged into the empty socket on this board
and the Atari socket is plugged into an Atari game port, the Apple
joystick will perform like an Atari joystick.
The mechanical construction of this converter is quite similar to
the one just described. It is built on one-third of a general-purpose
circuit board and has one chip, twelve components, a cable and socket
to connect to the Atari, and a simple DIP socket for the Apple joystick.
Figure 9-5, the simplified schematic, shows that this converter
works on completely different principles than the first one. The pot in
the Apple joystick is used in a resistive bridge with RI so that the
voltage on pin I varies with the pot setting. Capacitor C3 reduces
electrical noise.
The LM339 chip contains four voltage comparators, each with
two inputs and one output. They compare the voltage on one of their
inputs with a reference voltage on the other input. They produce a
digital output to indicate whether or not the input voltage is greater
than the reference. The pull-up resistors R4 and R5 make the outputs
look like the switch closures of a standard Atari joystick.
The diodes D 1 and D2, along with resistor R3, provide two
reference voltages (0.7 volts and 1.4 volts) for the comparators. Here we
are using a property of a real diode, its forward conductance voltage
drop, which a theoretically ideal diode would not have. If we passed a
small current through an ideal diode there would be no voltage drop.
If we pass a current through a real silicon diode, however, there is a
drop of about 0.7 volts, and this drop changes very little with
fluctuations in temperature and current.
Two comparators in the LM339 compare the voltage from pot 1
with our two reference voltages and put out the correct digital signals
for the joystick position: left, right, or center. A similar circuit checks
pot 0 for the signals for up, down, or center.
You will have to adjust the circuit to use this converter with
joysticks that have correction caps. The resistive bridge circuit
measures resistance only, so if the pot is not 150K, resistors RI and R2
will have to be changed. The correct value is about one and a half times
the value of the joystick pot.
SKETCH - APPLE TO ATAR!
FIG 9 -4 CONVERTER

A TARI
SOCKET
r-------.----......----.---< 7 t 5
R5
1/2 IK
APPLE
JOYSTICK
3 L EFT
2/4
r-lr-'7".. C3 LM339
.f;;/LJf
>---""--<4 RIGH7

8 G NO
6

APPLE TO ATAR!
SIMPLIFIED SCHEMATIC
FIG, 9 - 5
+5 115 R5 116
R2 RI , R3 1/<' ii<.; IK
220K K '> 1K DE 9 S
'> ATARI
LM339 SOCKET
.......- - - - - - - - , ,-__ BACK VIEW

C
r -"I :'
4.5u f I I I I I

: APPLE SOCKET (J ;;- :' + : 8 I

I TOP VIEW , IN914 I I 7v----r---


, I 7 I I 2 I
I 9 . 16, '- t
n> : '6
-f- j - 1- -r- -: IN914 :- - - - - - -- - J . / _/ \
'\7D2 \, __ »>

C2
.&Iuf C3
.&/
. f
u

APPLE TO A TAR!
CONVERT ER
FIG. 9-6
Converters: Between Apple and Atari 119

Figure 9-6 is a detailed schematic for wiring the converter. Be sure


you layout the #1 pins on the chip and socket in the correct direction.
The plus lead of capacitor CI must go to the +5 supply. On the LM339,
the pins used for the +5 and ground are not those commonly used for
digital chips (the 74LS series), so double check them before applying
power.
Double check your wiring, do not plug any electronic device into
a live socket, and be quick to turn off the Atari if everything doesn't
look absolutely right.

FINISHING UP
As mentioned earlier, the circuit boards should be mounted in small
boxes to prevent the wires from shorting. You could use cassette tape
boxes, cutting out holes for the cables with a coping saw and small
files. Alternatively, you could encase the circuit in a foam block, as was
described for the Multiple Socket Extension (see chapter 3). Or you
could purchase a small electronics box, fit the circuit board into the
box before mounting the components, and drill and file out holes for
the cables. Depending on the box you use, you may have to cut the
PCB and arrange the components differently from those of the
prototype.
From the standpoint of their electronics, these two converters are
the most sophisticated projects in this book. A little care in their
construction, however, will give you an excellent lesson in electronics
and a device that will greatly increase your enjoyment of your other
controllers.
120 The Computer Controller Cookbook

Parts List
Atari to Apple Converter
Number Suggested Total
Required Description of Part Supplier Cost
I 74LS04 hex inverter chip Jameco s .30
I CD4066 quad bilateral switch chip Jameco .40
2 IC sockets. 14-pin, gold Jameco .90
I Header plug. 16-pin Jameco .70
2 DE9S sockets. 9-contact Jameco 2.80
2 DE-9H Dvsubminiature hoods jameco 2.40
I Capacitor. 4.7 microfarad. tantalum Jameco .45
4 Resistors. lOOK. 1/4 wall. 5% Jameco .30
4 Resistors. 68K. 1/4 wall. 5% Jameco .30
6 Resistors. I K. 1/4 wall. 5% Jameco .40
I Printed circuit board #276-154 R.S. 2.00
3 ft. Ribbon cable. 16-conductor, #171-16 Jameco 1.80
Mise. Box, silicone sealant Local 1.25

Approximate
Cost $15.00

Parts List
Apple to Atari Converter
Number Suggested Total
Required Description of Part Supplier Cost
I LM339 quad comparator Jameco s .70
I IC socket. 14-pin Jameco .40
I IC socket. 16-pin, gold Jameco .50
I DE9S socket. 9-contacl jameco 1.95
I DE-9H hood jameco 1.20
I Printed circuit board. #276-154 R.S. 2.00
2 IN914 diodes R.S. .20
I Capacitor. 4.7 microfarad. tantalum Jameco .45
2 Capacitor•. 01 microfarad. disc jameco .20
5 Resistors, I K. 1/4 wall, 5% R.S. .40
2 Resistors, 220K, 1/4 wall, 5% R.S. .20
2 ft. Telephone cable. #278-366 R.S. .30
Mise. Box, silicone sealant Local .50

Approximate
Cost $ 9.00

Suppliers: jamero Electronics R.S.-Radio Shack


1355 Shoreway Road See Yellow Pages
Belmont. CA 94002
10 Sound
Pushbutton
A lot of arcade game players will instinctively shout commands at the
screen when the action gets exciting. There are so many times when it
would be more fun to control game movements by vocal commands
than by pushing buttons. This device, the sound pushbutton, lets you
do just that, since making a sound will have the same effect as pressing
122 The Computer Controller Cookbook

a paddle button. A potentiometer provides sensitivity control with a


wide range of adjustment, so low-level background noise will not set
the device off. The construction is simple and the materials are
inexpensive and easy to obtain.

CONSTRUCTION
The sound pushbutton is encased in a small plastic box. The device
consists of a microphone element, a pot, and a circuit board with one
chip, three capacitors, one LED, and 14 resistors. It is connected to the
computer with a 3-wire cable and a simple plug/socket.
To begin, cut a piece of circuit board to fit inside the box. Cut the
board by scoring both sides deeply with an X-acto knife and breaking
it over the edge of a table. File off the corners of the board so that it
doesn't hit the screw posts in the box. Mount the board on ihe bottom
of the box with four small bolts. You will need spacers or extra nuts to
raise the board off the metal bottom of the box.
Next position the microphone on the center of one end of the
circuit board. Mount the element by looping wire over it and soldering
the wire to the board. Carefully determine where the microphone will
be located near the end of the plastic box and drill a 1/4-inch hole to let
sound inside to reach the element.
The sensitivity pot is mounted through the top of the box on the
end away from the microphone. You may have to add a 3/8-inch flat
washer to mount the pot on the thin plastic. Now drill a hole for the
cable in the end of the box just beneath the pot. Mount the LED on
long leads so that its base is about 1/4-inch above the circuit board.
Find the spot on the box just above the LED and drill a 3/16-inch hole
so that it can be seen. As a finishing touch, you might want to add
rubber feet to the bottom of the box so it will not scratch your desktop.

ELECTRONIC OPERATION
Figure 10-2 is an explanatory schematic which shows the appearance
of the sound signal at five points along the circuit path to the
computer. The key to this circuit is the LM3900 chip, a quad
Sound Pushbutton 123

CIRCUIT BOARD & BOTTOM


r------ - - - - - 0'
@j
...
LED
MICROPHONE

BOX & POT R7


@
,
)

SKETCH
SOU N 0 PUSHBU t ton
FIG./tY-1

operational amplifier that operates on +5 volts.


Operational amplifiers (op-amps) are basic and popular building
blocks for analog circuits. The standard op-amp has two analog
inputs (one plus, one minus) and a single analog output. It takes the
difference between the incoming signals and multiplies the difference
124 The Computer Controller Cookbook

by an enormous amount (the gain) to produce the output. The gain


may be as much as 100,000 to 1. To achieve control over such large
gains, a set of input and feedback resistors is used with the op-amp.
In the first section of the circuit (figure 10-2), resistor R3 is the
feedback resistor and RI and R2 are the input resistors. The gain of
this stage is R3 divided by Rl (lOOK divided by 3.9K = 26). The small
signal coming from the microphone, shown in the first waveform
drawing, is multiplied by 26 to become the second waveform. Resistor
R2 adds a zero voltage to the input from the microphone, helping to
prevent oscillations and improve temperature stability.
Most op-amps use plus and minus power supplies to provide a
full range of possible outputs. The LM3900 uses only the +5 supply, so
its output is limited to the range of 0 to 5 volts. When you are designing
a circuit with the LM3900 you have to make certain that your intended
output will fall in this range.
In the first stage of the circuit the input from the microphone is
amplified. The second stage provides additional gain, and this gain is
controlled by the sensitivity pot. This stage uses the LM3900's limited

"E L=-
/ I 2/ 3 I 4
an an
I 5/

MIC.
I IRI K _ I
/R4
5.1 K
jRI:
f(9j(
5

'--------------------4-----.....-------7>GND.
EXPLANATORY SCHEMATIC
SOUND PUSHBUTTON
FIG.
Sound Pushbutton 125

output range to amplify half the waveform so that weak signals will be
close to 0 volts and strong signals will be amplified to +5 volts.
The third stage of the circuit provides additional gain and filters
out the high frequency portion of the signal with capacitor C3. This
filtering makes the signal more like the steady pushing of a button and
eliminates bounce and electrical noise. The LED is also driven by this
stage.
The last stage compares the signal with half of the +5 volts
provided by the voltage divider (resistors Rl2 and RI3). The output of
this stage is then either 0 or +5 and is therefore a proper digital signal.

WIRING THE CIRCUIT


Remove the circuit board from the box and add a l-l-pin DIP socket to
the components (the microphone and LED) already on it. Now add the
wires, resistors, and capacitors, marking off each on a copy of figure
10-3 as they are installed.
Since there is no mechanical strain on this device, the pot you buy
does not have to be an expensive one. If you purchase the pot given in
the parts list, you will have to shorten the shaft and add a knob. The
cable requires only three wires. Telephone cable with four wires works
well for this unit and gives you an extra wire to double up the ground.
The best plug for this unit is a simple plug/socket similar to the
more complex one described in chapter 3. For this one, do not bend or
cut short any of the socket pins. You will almost always be using the
sound pushbutton with another controller, and you want all the
controller functions to pass through the plug/socket.

TESTING
When you have finished the wiring, examine your work closely for
solder bridges and shorted wires. Plug the LM3900 into the socket in
the board and check to make certain there is at least 50 ohms between
pin I and pin 8 of the plug. We got a reading of 1.3K when we tested the
prototype. Mount the circuit board on the bottom and close the box.
Turn off your computer. Plug the new sound pushbutton into the
game I/O connector and turn it on again. If the computer doesn't start
vv
R7 16)('Y K
SENSITIVITY

r-;: < R8
< RI5 Rs RI/ w RI2 ' RIG
< IK 16) K I('Y K < _ < 16) K 2('Y K < /6)"
< 0< 2' ""
0-- ..., ;);; .."
14 0 L-.., ---< 8 P IN
E r -- - - - - - - - _ .. - _ .. - _ .. - _ .. -, CI ' I
MICRO
C2 RI r- II I L....-.< IO.uf .-
3.9 K _ _ I + ,
1-
I " v v /' r I
f>- 4
C<d 3 I .-'
2 P 86J
.r- / ..a .. tAl I + ". I RI3
8 GND.
It>-' 2CYK -:;7AME 1\0
(2)1 I 2 I U1
- - 1-
PLUG
I ;);;
J
"-----;:..: ---- ---- ---'n- --"7-
L- .ll-_ _ >R 3 •
R2 ICY('lK
>R5 > R4
'>5,1 K 3.9K 5.1 K
'>

SC HEMATIC SOUND PUSH BUTTON


FIG. /(;) - 3
Sound Pushbutton 127
up exactly as usual, shut it down immediately and recheck all your
work on the new unit.
Now run the Controller Checkout program from the software
chapter and watch the screen to determine if the 0 pushbutton
responds to sounds. Try various settings of the sensitivity control
while making sounds of differing volume.
Turn the computer off, plug a controller you know is in good
working order into the back of the sound pushbutton plug, and rerun
the Controller Checkout program. Test all the functions of the sound
pushbutton and the controller. Now you can try it out with your
favorite games. Instead of wearing out your fingers, you can yell at the
screen and get a response.

OTHER COMPUTERS
The output of the sound pushbutton is very close to a standard digital
signal and should be acceptable to any computer system that has at
least one pushbutton input and that can provide a small amount of +5
voltage. You will, of course, need a different plug, and the plug pins
may have different numbers than the ones shown for the Apple. See the
section on other computers in the Electronics Tutorial for more
information on how to adapt this controller to other computers.
128 The Computer Controller Cookbook

Parts List
Sound Pushbutton

Number Suggested Total


Required Description of Part Supplier Cost
I Experimental box, #270-230 R.S. $1.60
I Pot, lOOK, #271-1722 R.S. 1.l0
1/2 Printed circuit board, #276-154 R.S. 2.00
I LED, round, any color R.S. .40
I Microphone element, #270-092 R.S. 3.00
I Quad op amp, LM3900 Jameco .60
I 14-pin DIP socket Jameco .40
I 16-pin DIP socket, wire wrap Jameco .70
I 16-pin DIP header Jameco .70
2 ft. Telephone cable, #278-366 R.S. .30
I Cap, 10 microfarads at 10 volts Jameco .20
2 Caps, .2 microfarads at 10 volts Jameco .30
2 Resistors, 3.9K, 1/4 watt Jameco .20
2 Resistors, lOOK, 1/4 watt Jameco .20
2 Resistors. 5.1K, 1/4 watt Jameco .20
I Resistor, 51K, 1/4 watt Jameco .10
3 Resistors, 10K, 1/4 watt Jameco .30
2 Resistors, 20K, 1/4 watt Jameco .20
I Resistor, I Meg, 1/4 watt Jameco .10
I Resistor, IK, 1/4 watt Jameco .10
Mise. Bolts, spacers, felt Local .60

Approximate
Cost $14.00

Suppliers: Jameco Electronics


1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
11 Desk Switched
Outlet Box
On the Apple and most other home computers the ON/OFF switch is
not conveniently located and frequently wears out. This switch
usually causes more problems than any other single piece of hardware
in the system. The switch itself is difficult to replace because it is built
into the power supply box. It would also be handy to automatically
130 The Computer Controller Cookbook
turn on other devices like the monitor and the printer at the same time
that the computer is switched on. There are commercial switched
outlets that serve this purpose, but they are priced much too high ($30-
$50) in relation to the materials they contain. Besides, the switches in
these units are usually located beside the outlets and thus are no easier
to reach than the original Apple switch.
This chapter covers the construction of a desk switched outlet box
in which the ON/OFF switch is placed in an attractive box beside the
computer and the outlets are in back of and below the desk. Special
add-on features, including a power-on light, a voltage spike
suppressor, and an electromagnetic interference filter are also
outlined. You can install only those features that you decide you need.
The materials for this project are readily available. Most can be
found at any hardware store that has a home electric department and
the rest can be found at Radio Shack. A few simple household tools
including a screwdriver, long-nose pliers, and a soldering iron are
required. Construction involves primarily the assembly of ready-made
parts.

CONSTRUCTION OF THE
OUTLET BOX
The outlet box is a standard 4-inch square conduit box with a front
plate for two duplex outlets, a cover (if the front plate does not include
one), and two cable clamps. If you want to include some of the special
features you will need a larger box. Local electrical supply houses
usually carry larger multiple conduit boxes or single outlet boxes that
bolt together side by side to house any number of outlets.
We pop riveted a small sheet metal tab to the back of the box so
that we could hang it under the desk with two panhead screws. If you
plan to place the box on the back of your desk you can attach plastic
feet or cover the bottom with felt.
To install the cable clamps, knock out two of the metal slugs,
place the clamps through the hole, and tighten the nut inside the box.
The clamping screws should face the front of the box. A bit of Loctite
or Super Glue on the nut threads will secure the nut.
The box for the ON/OFF switch should be decorative. You can,
of course, use any metal or plastic box, but most electronic and
electrical boxes look out of place on a desk. Our prototype switch box
LAMP II&. II.AC.

DESK CABLE 2
BOX BLACK\GREEN
WHiTE

c£l BLACK I I I BLA CK


SW-/
SP-ST ()
III I OUTLET-I OUTLET-2
IS 2)CLMfP BACK
VIEW
CABLE /
Q o
0
CLAMP I I I BRASS . SILVER
Q ==1>
BLACK BRASS )J SIL VER ADDITIONAL
-- OUTLETS
WHITE
PLUG
3-PRONG GREEN LWIRE
NU;
'll,;
WIRENUT"" Q
GNO h Q
TO
BOX I GREEN
WHITE

DESK SWlTCHED
OUTLET BOX
FfG. / /-2
Desk Switched Outlet Box 133

has sloping hardwood sides and a sheet metal top and bottom, as
shown in figure 11-1. Making the sloping sides is a good exercise in the
use of a radial arm or table saw. If you don't have a shop manual that
demonstrates how to set the angles you will have to do some trial and
error work on scrap wood. The corners are held together with wood
glue and finishing nails driven into predrilled holes. After the four
sides were glued together, the top was sloped and the bottom flattened
with hand tools. You will have to file out a notch in the back for the
cable. Sand the hardwood pieces and finish them with polyurethane
varnish.
Cut the top and bottom plates from aluminum or steel. Drill and
file the top to fit the switch and the lamp. Drill and counter-sink holes
in the bottom plate for six #6 flathead screws. Attach the top to the box
with silicone sealant or epoxy so that no screws will show. Finish the
top plate with an orbital sander to a. uniform matte finish and then
varnish the entire box.

ELECTRICAL ASSEMBLY
For the electrical work you will need wire strippers, long-nose pliers,
wire cutters, and a medium-size standard screwdriver. This project
requires a soldering iron of about 50 watts to tin the wires and solder
the connections on the switch and lamp. A 50 watt iron is larger than
the size called for in the other controller projects, but it is a standard
iron used for many household jobs.
The electrical wiring is shown in figure 11-2. Note that wire
colors are indicated. These colors are an important part of the
National Electrical Code and must be followed scrupulously. The
Electronics Tutorial in chapter 14 contains a detailed explanation of
the correct procedures for wiring this unit and other AC appliances.
You should review the section on AC Codes and Wiring Practices
before starting this project. As before, coloring in two photocopies of
the wiring diagram (figure 11-2) is the best way to keep track of and
check your work.
The easiest way to obtain the cable is to purchase an extension
cord long enough to make both cables. A 12-foot cord is usually
sufficient. Cut off the outlet end and about four feet of cable to make
cable #2. Number 14 3-conductor cable is best for almost all home and
office computer systems.
134 The Computer Controller Cookbook

You will have to join several wires together in four places, as


shown in figure 11-2. This is most easily done with wire nuts; yellow
ones are the correct size for this project if you use #14 wire. The proper
installation of wire nuts is covered in the discussion of AC Codes in the
Electronics Tutorial.
The varistor shown in figure 11-2 removes voltage spikes from the
incoming line. It has two bare solid-wire leads. You should cover all
but the last 1I2-inch of each of these leads with insulation stripped
from scrap wire to insure that the leads don't touch the metal box.
You can attach green wire pigtails about six inches long to the
green screws on the two outlets. Attach another pigtail to the box with
either a green screw or a green metal clip. You can group these pigtails
and the green wires from cable #1 together with a yellow wire nut.
Make the connections between the outlets with scrap wire of the
correct color and size. Alternatively, you can purchase a short piece of
3-wire #12 Rolex cable (used for the wiring in houses) and remove the
outer cover to provide three separate wires of the correct size and
insulation color.
Choose a switch that looks good on the desk box. A simple
ON/OFF switch, single-pole single-throw (SPST), with lO-amp
current capacity will be suitable for all but the largest computer
systems. If the switch you purchase has more sections (double-pole
single-throw or double-pole double-throw), you can parallel the SPST
sections to increase the current capacity. Some of the better switches
have a llO-volt AC light built into the switch.

TESTING
When you have completed all the connections and checked your work,
screw the box together and tighten the cable clamps. Plug the unit into
a 3-wire house outlet with nothing plugged into the new outlet box. If
the circuit breaker doesn't blow, throw the desk switch. The lamp on
the switch box should tum on and off with the switch. If it stays
lighted all the time, it is connected to the wrong side of the switch.
Now plug a light load like a reading lamp into the outlet box and
try the switch again. If you encounter any problem (a blown circuit
breaker or a switch that works backwards), unplug the unit, recheck all
the wiring, and make corrections. When the unit works properly with
a household lamp you can plug your computer into the outlet.
Desk Switched Outlet Box 135

FINISHING TOUCHES
There are several other features you may want to add to your unit. If
you are concerned about lightning strikes or other severe electrical
surges, you can add two additional varistors. One should be installed
from the black wire to the green and the other from the white wire to
the green wire beside the first varistor.
If electrical interference is affecting your television set or your
neighbor's when your computer is on, you might add an EMI filter
like Radio Shack's #273-100. This will prevent electrical noise from
leaving the computer by way of the AC line. Since most such noise is
radiated directly into the air, this probably won't help your television
reception much. If you add the filter you will also need a larger box.
If you decide you want a fuse and fuse holder you will, again, need
a slightly larger outlet box. Alternatively, small pushbutton-style
circuit breakers can be purchased through large mail-order electronics
houses. A rating of 10 amps at 110 volts would be suitable for most
personal computer systems.
If unauthorized people have been using your system or turning
off the computer when you have intentionally left it on to run a long
program you may want to add a key switch to the desk box. Mount the
key switch (for example, Radio Shack #49-523) in the switch box either
in series (lock OFF) or parallel (lock ON) with the main switch. Since
the key switch usually has a lower amp rating, use the main switch
routinely and key only when you need the lock feature.
We are confident that you will use the Desk Switched Outlet Box
more than any other device in this series of designs. We have built at
least a half dozen of them. They make great gifts for anyone who uses a
computer, either at home or at work.
136 The Computer Controller Cookbook

Parts List
Desk Switched Outlet Box

Number Suggested Total


Required Description of Part Supplier Cost
I Outlet box, 4" square Local $2.00
2 Outlets, 3-wire duplex Local 2.00
I Box cover Local .50
I Extension cord, 12-ft.,
3 - #12 wires Local 4.00
I Lamp, 110 volt AC, #272-708 R.S. 2.00
I Varistor, #276-570 R.S. UO
I Switch, #275-641 R.S. 2.00
2 Cable clamps Local .50
3 Wire nuts, yellow Local .50
I Ground clip, green Local .25
I Box, ornamental 4.00
Mise. Glue, finish, feet, ete. Local US

Approximate
Cost $21.00

Suppliers: R.S.-Radio Shack


See Yellow Pages
All other parts were purchased ata local hardware store.
12 AC Outlet
Controller
The control of household devices that run on alternating current (AC)
is one of the most often discussed applications for the home computer.
Most people assume that this type of control requires complicated
electronic circuits. In fact, it is not difficult to design or build a
computer controlled AC outlet and, thanks to the availability of solid
138 The Computer Controller Cookbook

state relays, it is only moderately expensive to add this capability to


your home computer. These relays use solid state components, usually
triacs, to control normal AC current with a low-power digital signal.
The Computer Controlled AC Outlet is little more than a normal
outlet box with the addition of a solid state relay and two cables
connecting it to the computer and the AC power supply.
The Apple has four annunciator outputs that can directly drive
these relays. Other computers, like the Commodore VIC-20, have
pushbutton inputs that can be converted to digital outputs by setting
soft switches in the computer's memory. Solid state relays will work
well with these systems, too.

THE AC RELAY
The input of a 5-volt solid state relay requires little current and can be
driven by outputs rated at I TTL (transistor-transistor logic), which is
approximately 5 milliamps at 5 volts. The 74LS chips referred to in
these projects are TTL chips. By comparison, a single LED requires
about 20 milliamps for normal light levels and may overload
annunciator outputs.
The output of a solid state relay is rated by the maximum current
(measured in amps) it can carry and the maximum RMS AC voltage it
can control. Inexpensive relays are usually rated between 4 and 10
amps of 110 volts AC. More expensive ones (up to 40 amps of 440 volts)
can be purchased for controlling higher-powered equipment.
Solid state relays handle only alternating current. They can turn
on direct current but they can't turn it off. These relays have no
internal moving parts or contacts to wear out. They should last for
many years if they aren't cooked to death by extensive overheating or
shorted out by a voltage spike.
The current ratings given in manufacturers' data sheets are for
resistive loads, like incandescent lamps or resistance heaters. To use
the relays on inductive loads (e.g., motors and heavy transformer
devices), you must purchase relays that have about twice the rating of
the device's normal operating current. To protect the relay from
voltage spikes, particularly those caused by suddenly turning off an
inductive load, you must add a varistor, as shown in figure 12-2.
To protect the relay from overheating, make certain that its metal
bottom is in good thermal contact with a metal heat sink. If the relay is
AC Outlet Controller 139

mounted in a heavy metal box and the back of the box is exposed to free
air, a small relay will be cooled adequately. For higher powered and
multiple relays you may have to install an aluminum heat sink in the
back of the box and space the relays an inch or more apart. Use a heat
conductive compound like Radio Shack #276-1372 on the metal backs
of the relays to improve heat transfer. Since the relay backs are
insulated from the AC, you don't need a layer of electrical insulation
between the relay and the box.
Good news: There has been a recent breakthrough in the
manufacture of solid state relays. The new technology, called S3X, lets
the relays function with fewer parts than the present design. The new
units exhibit markedly better performance with inductive loads and
will generally run cooler. These relays should be available soon, and
perhaps we'll be able to purchase the old style units at cheaper prices
from the surplus houses.

MECHANICAL
CONSTRUCTION
The solid state relays for the prototype conduit box were purchased
from PolyPaks (see the parts list for their address). They are smaller
than most other solid state relays and have solder terminals instead of
the usual screw terminals. You may be able to get them from PolyPaks
or from another surplus electronics company. If not, the standard
commercial relays are a stock item at Newark and other large houses. If
you can't obtain the small relays, you will need a box larger than the 4-
inch square indicated in the parts list.
The prototype box has a cover for two duplex outlets and two
cable clamps. One or even two of the smallest AC relays can be
mounted in this box, taking the place of one of the outlets.
To be absolutely certain that the AC wires will not make contact
with the wires running to the computer, you should fashion a sheet
metal partition to divide the relays into two sections. First make a
cardboard pattern and then cut the partition out with tin snips. Attach
the partition to the box with bolts or pop rivets. You can also make a
sheet metal hanger for the back of the box, or devise some other
mounting arrangement. You should also cover two of the outlet holes
with a piece of sheet metal.
140 The Computer Controller Cookbook

GAME-
1\0
CABLE

A.C. (\
CABLE I o

CONTROLLED
A.e. OUTLET
FIG. /2-1

For larger or more powerful systems (more than two outlets or


more than 10 amps total) you will need a bigger electrical box. Called
NEMA boxes (National Electrical Manufacturers Association), these
can be either #4 (vented) or #12 (sealed). For extremely high-powered
systems (4 kilowatt or greater) you will have to cut the back out of the
box and replace it with a large aluminum heat sink. You could make
your own box out of sheet metal or other non-flammable material. On
a large system the loads should probably be cabled directly to the relays
without the use of sockets and plugs.
The cable that runs from the box to the computer will be too small
for normal electrical cable clamps. You can use a strain relief (Radio
Shack #278-1636) instead, or enclose the cable in tape and heat
shrinkable tubing.
AC Outlet Controller 141

ELECTRICAL WIRING
The wiring in this project is similar to that of the Desk Switched
Outlet Box in chapter 11. Once again, it is necessary to follow the
electrical code guidelines, so review them before starting to wire this
unit (see the section on AC codes in the Electronics Tutorial).
Figure 12-2 is the schematic for a two-relay system. The power
cable is a 3-wire # 14 extension cord with the outlet end cut off. If you
are using two relays on the same outlet you must separate the two
sockets electrically. Break off the small metal bridge between the two
brass screws on the black wire side only. For currents of up to 10 amps,
#14 wire will be adequate. For high-current systems you will need #12
or larger wire.
The two varistors shown in figure 12-2 provide protection from
voltage spikes. These are necessary to control inductive loads like
motors or flourescent lights.
The current in the control lines to the computer is so
inconsequential that extremely small wire in this cable will meet the
electrical requirements. You will, however, need a cable that is strong
enough to withstand a reasonable amount of wear. If you have extra
wires in the cable it is a good idea to double up the ground wire.
The best plug for the AC outlet box is a stacked plug similar to the
one described in chapter 3. All the pins of this one, however, should
pass straight through, with no tricky crossovers. A stacked plug lets
you plug in the AC outlet box and still use conventional controllers,
providing they do not require the annunciator outputs.
The outlet box must only be used with 3-prong grounded systems.
You must clip or screw the green wire of the power cord to the metal
box and connect the green screws on the outlets to the box with green
WIres.
If you like, you can add a fuse and fuse holder or circuit breaker for
each circuit. As noted for other special features, this may necessitate
using a larger box.

TESTING
Check your wiring using the procedures we have described for
coloring in two copies of the schematic. After you have finished the
connections, assemble the box and tighten the cable clamps. Before
l7U
r

PIN-
GND 8 ( I
Q:cl
A NfJ. 15 < . STRAIN RELIEF

ANI 14< . 3 V 64 36 V 64
0
+-5 GND +-5 GN D
GAME 1\0
SOLID STATE u
METAL SOLID STATE
CONNECTOR :-- -GND- -- r U_ RE LA-Y_-/ - - - PARiirloiv- - - - RELAy--i - n ' __ - __ u U

I TO ==t>
----L. 80 X ADDITIONAL
RELAYS
2 I

VARISTOR
11r:;) V.AC.

BLACK

CLAMP OUTLET-I BACK VIEW

= BLACK era
c=: ==f>
WHITE Q:[) BRASS o ADDITIONAL
SILVER OUTLETS
BRAKE'"
BLACK
GREEN

CONTROLLED A.C.
OUTLE T GREEN
Fl G. 12 - 2
WHITE
- ' - GND
TO
BOX
AC Outlet Controller 143

testing the unit on your computer, you should plug it into a household
outlet. With a multimeter, measure the AC voltage between each of the
computer connector leads and the metal box to be sure that no AC is
read on any of the pins. Plug an incandescent lamp into the AC outlet
box; the lamp should not come on.
Now unplug the outlet box from the wall. Make sure your
computer is turned off. Install the plug into the computer's game
control socket, plug the outlet box into house current, and turn on the
computer. If the computer doesn't start up in a completely normal
fashion, turn it off immediately, unplug everything, and recheck all
your work.
Run the Annunciator Checkout program in the software chapter.
A lamp plugged into this controlled socket should turn on and off as
the checkout program runs.
How large an AC control system could an Apple handle? Each of
the four annunciator outputs could control a relay, and the relays are
available with ratings up to 40 amps at 440 volts. If you want to get
serious, however, you will have to add a simple multiplexing card
(four 74LS chips). The four annunciator inputs and the strobe line
could then drive 32 relays, for a total of 560 kilowatts. That should be
enough power to provide the mind-boggling light show for a "Who"
concert.
144 The Computer Controller Cookbook

Parts List
AC Outlet Controller

Number Suggested Total


Required Description of Part Supplier Cost
I Outlet box Local $2.00
I Cover for box Local 1.50
2 Cable clamps Local .50
I Duplex outlet Local 1.00
2 Solid state relays Poly 20.00
I Extension cord,12 ft.,
3-#12 wires Local 4.50
15 ft. Telephone cable, #278-366 R.S. 1.70
I 16-pin DIP header Jameco .70
I 16-pin socket, wire wrap Jameco .70
1/4 oz. Heat sink compound, #276-1372 R.S. .50
Mise. Bolts, feet, etc, Local .90

Approximate
Cost $34.00

Suppliers: J ameco Electronics


1355 Shoreway Road
Belmont, CA 94002
Minimum order $10.00
PolyPaks, Ine.
16-18 Del Carmine Street
Wakefield, MA 01880
R.S.-Radio Shack
See Yellow Pages
All other parts were purchased at a local hardware store.
om
e

e
00
s

®
e


13 Construction
Notes
In building these controllers you can choose from a variety of
materials and make a great many modifications to suit your
requirements. We have put together prototypes of all the designs;
when we made more than one prototype the units were never exactly
alike. We used scrap materials extensively and often adjusted the plans
to take advantage of available materials. If you can't find a specified
part or material, substitute something else that you can find.
146 The Computer Controller Cookbook

READING THE DRAWINGS


The illustrations in this book are not the kind of mechanical drawings
that a professional machine designer would produce. They were done
as illustrations of how the projects were put together and could not be
sent to a machine shop for professional fabrication. They do include
all the necessary information and dimensions, and the text gives you
the steps to follow for constructing the units.
Where they are omitted, the dimensions are not critical and you
should adjust them for available materials or for your physical size.
(Do not attempt to make up a limerick here-a classic already exists.)
For items like pot mounts you should first purchase the specified part
and then adjust the dimensions of the mounting holes to fit that part.
Don't be afraid to adjust the dimensions of the device to suit your
needs and materials. The worst that can happen is that you have to
build a second or third unit before you get exactly what you want.
Your early attempts will sometimes make nice gifts for your friends (of
various dimensions). The entire process is an important experience in
working out man/machine interactions.

TOOLS FOR CONTROLLER


CONSTRUCTION
You can build all the controllers in this manual with common hand
tools. Many of them are even easier to construct if you have access to a
radial arm or table saw. As noted in the introduction, most of these
designs make excellent projects for school wood, metal, or electronics
shops. The following tools are best for constructing the units:

(1) A radial arm or table saw with a plywood blade


(2) A 3/8-inch variable speed drill with twist drills, screwmate drills,
and a counter-sink
(3) Vise grip pliers (one of the all-time great tools)
(4) Drill and taps for common bolt sizes (#8-32 and #6-32)
(5) Pop rivet gun and small pop rivets
(6) Bench vise with wooden jaw inserts
(7) Orbital sander and sand paper
(8) Miscellaneous hand tools: screwdrivers, hacksaw, sheet metal
shears, etc.
Construction Notes 147
The following tools are not required, but if they are available you can
do more advanced work on some of the projects:

(9) A drill press or holder for the electric drill


(10) Mandrel and hole saws for the drill
(11) A metal lathe with milling attachment

If a particular tool is not available there is almost always some way


around the the problem. The text makes many suggestions for
alternatives you can try.

MATERIALS
Many of the materials for these controllers were salvaged or scrap. The
parts list for each project gives the materials actually used for the
prototypes, but don't be afraid to experiment with alternatives. Here
are some suggestions on what to use and where to get it.

Lumber. The hardwood lumber for many of the prototypes was scrap
from furniture projects. Clear softwood is also suitable, except for
those parts that must have holes drilled and tapped into the wood. Just
remember that the hardwoods can be finished more attractively than
the softwoods.

Plywood. We salvaged much of the hardwood plywood for the


prototypes from a pair of old kitchen cabinet doors. Many hardware
stores sell small pieces of hardwood plywood. Maple is probably the
best for these projects since it is extremely hard and doesn't splinter
easily. Common fir plywood can be substituted and will look just fine
if carefully finished.

Plastic. In constructing many of these devices you could replace


plywood and metal parts with plexiglass with striking results. You
can often purchase scrap plexiglass in pieces large and thick enough
for the units from local suppliers of industrial plastics. The scrap, sold
by the pound, is about as expensive as hardwood plywood. You can
successfully work plexiglass with woodworking tools once you are
accustomed to its peculiarities. Sand the sawcut edges with
increasingly fine sandpaper until the saw marks are completely
148 The Computer Controller Cookbook

removed. Then you can polish the edges with Crest toothpaste or a
polishing compound from the plastics supplier.
Many of the projects specify plastic washers cut from coffee can
lids. This plastic is polyethylene; it has a soapy feel and serves as a
lubricant between wood parts. You can cut it with household scissors.

Metals. The one controller prototype that requires machining, the


Super Stick, was made from machinist's aluminum. The machined
parts could also be cut from brass, steel, stainless steel, or machinable
plastic, depending on available scrap and the desired final appearance.
The sheet metal we used was either l/16-inch soft aluminum from an
old cookie sheet or galvanized steel scrap from heavy heating
ductwork. The sheet metal must be stiff enough to hold its shape but
light enough to be worked with sheet metal shears.

Glues. Wood parts were glued with Elmer's Carpenter's Wood Glue, a
tan liquid, and felt pieces were attached with Elmer's Cabinetmaker's
Contact Cement. The latter can be cleaned up with water, a nice
feature for the home craftsman. No lockwashers were used: all bolts
were secured with thread sealant on final assembly. The bolt threads
must be oil-free for this to work properly. You can substitute. Super
Glue or fingernail polish for the sealant.
Wherever rubbery adhesion was needed, we used G. E. Silicone
Glue and Sealant. Also known as RTV (room temperature
vulcanizing), this was used to form strain reliefs for cables and for
insulation over electrical connections. Don't use an excessive amount
of RTV in any application since it can ooze out and look very sloppy.
Clear sealant is the least messy to work with. You should also note that
this material contains an acid catalyst and can cause eye and skin
irritation if handled carelessly.
00
S


14 The Electronics
Tutorial
This chapter will help those of you with a limited background in
electronics get started on the controller projects. We trust that more
experienced hands will also find many suggestions that will speed up
their work.
If you follow the guidelines in these sections and the specific
details in the project chapters, you should produce creditable results in
150 The Computer Controller Cookbook

your electronics construction. You will benefit most from the tutorial
if you read through the chapter and then refer back to specific sections
as you work on a project. The following topics are included:

1. Electronic Components
2. Where to Buy Electronic Components
3. Reading Schematics
4. Controller Electronics
5. Adapting the Controllers to Different Computers
6. Tools Required for the Electronics Work
7. How to Solder
8. AC Codes and Wiring Practices
9. Safety Precautions
10. References

ELECTRONIC
COMPONENTS
The following electronic components are used in constructing the
projects in this book. They are also the ones found in most beginning
electronics projects and, in fact, make up the majority of all electronics
equipment.

Resistors. These colorful two-wire devices resist the flow of electrical


current. A current flow through a resistor results in voltage across it
(Ohm's law):

Voltage = Resistance x Current


V = R x I

This equation is used more often than any other equation in


electronics. If you know any two of the variables, you can calculate the
third.
Resistors are measured in ohms or thousands of ohms (K-ohms).
Most resistors are banded, using a standard color code that gives their
value in two digits (first and second bands), a multiplier (third band),
The Electronics Tutorial 151

and a tolerance (fourth band). The colors and corresponding digits


are:

Resistor Values

Color Color
Digit (Bands 1 and 2) (Band 3) Multiplier
o Black Black 1
1 Brown Brown 10
2 Red Red 100
3 Orange Orange 1,000
4 Yellow Yellow 10,000
5 Green Green 100,000
6 Blue Blue 1,000,000
7 Violet Violet 10,000,000
8 Gray Gray
9 White White
Tolerance
(Band 4, if present)
No band ±20%
Silver ±1O%
Gold ±5% (now standard)

Examples of resistor values as indicated by their colored bands are:

330 ohm 5% Orange, Orange, Brown, Gold


1K ohm 10% Brown, Black, Red, Silver
50K ohm 5% Green, Black, Orange, Gold

Resistors are also rated by the power they will dissipate without
burning up. Power is defined as voltage times current and is measured
in watts. All the resistors we will be using in these projects are 1/4 watt.

Power = Voltage x Current


P = Vx I
152 The Computer Controller Cookbook

Potentiometers. These devices, commonly referred to as pots, are


resistors with a sliding contact. They were originally used in a voltage
divider circuit called a potentiometer circuit, which is where the name
comes from. They can also be employed as variable resistors, which is
how they are used in most of the controller circuits. A true
potentiometer has at least one wire on each of its three terminals. Pots
employed as variable resistors use only two terminals and often have
the unused terminal wired to the center terminal.
Like all resistors, pots are measured in ohms, K-ohms, or meg-
ohms (millions of ohms). In operation, most pots make nearly one
complete turn (usually about 300 degrees). Other pots, in order of
frequency of use, turn one, ten, twenty, five, or three times. It is also
possible for a pot to slide in a straight line. The knobs on most
electronic devices turn potentiometers.
In choosing pots for electronic devices, mechanical
considerations are usually more important than electrical ones: How
good is the bearing? How long is the shaft? Is the shaft round or
flattened?
The primary electrical property we look for is linearity. That is, a
graph of the amount of turn of the pot shaft versus the resistance
should be a straight line. The description of the Sketch Pad project
(chapter 4) goes into linearity in more detail since it is critical for good
sketching. Generally, the more expensive the pot, the better the
linearity.
Some of the best available pots are rated "Military Specification"
(Mil Spec or Mil No.). These pots have excellent mechanical
construction and good linearity, so look for this rating in the
electronics catalogs.
The value of the potentiometers in the standard Apple paddle,
150K ohms or .15 meg-ohms, is an uncommon one. Pots of this value
are sometimes hard to find. Chapter 1, "Rebuilding Paddles and
Joysticks," gives a procedure for using pots with values like 250K,
which are easier to find. The Atari and the Commodore VIC-20
computers use the much more common value of 1 meg-ohm.
Capacitors. These components, often called caps, store an electrical
charge. Caps always contain two electrical conductors with an
insulator between them. They are measured in farads: if a cap is 1
farad, then a current of I amp flowing into it for I second will charge it
to I volt. A I-farad cap would be about the size of a bathtub. The caps
we will be working with are measured in microfarads (one-millionth
The Electronics Tutorial 153

of a farad) and are small enough to fit on a printed circuit board. When
designing circuits you must avoid using very large value caps since
they are just too big physically. We will use capacitors to smooth out
DC voltage, to pass AC while blocking DC, and paired with a resistor
in a timing circuit.
For large values (l to 10 microfarads) we will generally be using a
type called electrolytic caps. They must have one lead (marked with a
dot or a + sign) attached to a more positive DC voltage than the other
lead. Electrolytic caps do not last as long as most other electronic
components, so we will avoid using them whenever possible. But
electrolytic caps made with the metal tantalum are smaller and longer
lived. Although more expensive, they are usually worth the extra cost.

Wires and Cables. The wires used for digital electronics are much
smaller than those used in household wiring. Sizes #22 - #30 are most
often employed in electronics work. Lamps and power tools use #12 or
#14. The bigger the number, the smaller the wire; even numbers denote
copper wire. As far as the electrical requirements of these controllers
are concerned, you could use wire that is hair-fine (#42). You would
have difficulty working with it, however, since it breaks so easily. On
the other hand, wires that are too thick will not fit into the solder lugs
on digital electronic parts and circuit boards.
There are only two conductors in these projects that might work
better with larger wires. They are the +5 volt power supply line and the
ground wire. If these wires are too small, the controller functions
might lose independence, in which case pressing a pushbutton would
cause a pot reading to change. Fortunately, doubling up these wires
works as well as using larger-size wire, and it is much easier to obtain
cables with a few extra wires than cables with a few wires of a different
SIZe.
Flat ribbon cable is often used for commercial controllers, but we
don't like it because it has no protective cover. The wires on the outer
edge of the ribbon break too easily. We used 4-wire telephone cable,
inexpensive and readily available, for most of the controller
prototypes. The insulation on this cable, however, can be damaged if it
is overheated during soldering.
We have also made serviceable cables by pulling plastic insulated
wire through plastic tubing (e.g., plastic aquarium tubing). We have
also used a homemade rope-making machine to braid cables, with
good results.
154 The Computer Controller Cookbook

Circuit Board. In many of these projects you have to mount electronic


components on a board and attach wires. You can do this job in a
professional way by utilizing printed circuit boards (PCB) that come
with pre-drilled holes in a regular pattern and copper lanes on one
side. All the components and wires are placed on the top side, which is
bare, and all the soldering is done on the bottom side, which has rows
of copper lanes. The two sides of a circuit board are commonly referred
to as the component side and the solder side. One panel of PCB (Radio
Shack #276-154) is big enough to make two or three controller circuits.
You can cut a board by scoring it deeply with an X-acto knife and
steel straight edge and then breaking it over the edge of a table. You can
also spin the knife to enlarge the holes for mounting bolts and
switches. The copper lanes must be cleaned with a pink pencil eraser
before you start to solder.
For the prototypes the circuits were wired by soldering short
jumper wires between the pre-formed copper pads on the standard
boards. This is called point-to-point electrical wiring and is the best
procedure to follow for these small circuit boards. For larger projects
you can use a procedure called wire wrapping, in which fine wires are
wrapped around metal posts with special tools. Wire wrapping is used
extensively to build prototyes of digital circuits that have more than
three chips.
If you were making large numbers of a circuit board you would
use photographic techniques to produce custom-printed boards
specifically for that circuit. This more complex and expensive
procedure would eliminate most of the hand wiring involved in point-
to-point wiring and wire wrapping.

Integrated Circuits. These components, the key to digital electronics,


are referred to as chips. On a tiny chip of silicon, transistors, diodes,
and resistors are arranged in a circuit. The circuits we will use, called
DIP (Dual Inline Packages) chips, are encased in black rectangular
boxes with silver wires projecting out of the sides, like the legs of a
caterpillar.
We will use three types of chips in these projects. The first,
transistor-transistor logic (TTL) chips, have numbers that begin with
74 or 74LS. TTLs, the most common type of digital chip, operate on
+5 volts only. They are cheap and easy to find, medium fast, and
provide a wide range of functions.
We will also use a few chips called CMOS (complementary metal
oxide semiconductor). They can operate on 3 to 15 volts and consume
The Electronics Tutorial 155

an amazingly small amount of electrical power. CMOS chips also


provide a wide variety of functions and are used extensively in battery-
powered equipment. They cost more than TTLs and can easily be
ruined by static electricity during installation. Leave CMOS chips in
their protective packages until just before inserting them into their
sockets.
The third type we will use, the analog chip, handles continuously
changing (analog) signals and is used in amplifiers and voltage level
sensors. A piece of digital equipment usually requires at least a few
analog chips. They are quite similar to the TTLs but may require
voltages other than +5 volts (often ±1O or ±15 volts).

WHERETO BUY
ELECTRONIC
COMPONENTS
Radio Shack stores are definitely the handiest to shop at of all
electronics suppliers. The quality of most of their components is
acceptable. Their potentiometers, however, are of poor quality and we
cannot recommend them. The selection is often limited: an outlet will
stock only a few of each catalog item and will often be sold out of the
part you need. Radio Shack prices are somewhat high, but this is to be
expected from a convenience store. Radio Shack reference books are
quite good. Many professionals look down on this chain, but they
have so often provided a part that kept one of our projects moving at a
critical time that we are grateful that the stores are almost everywhere.

Discount mail-order houses handle lots of surplus and seconds and


their prices are low. Sometimes you get a real buy; sometimes you get
junk. These companies periodically mail out fliers and run ads in
electronics and computer magazines. They usually require a
minimum order of about $10. We have ordered several items from
PolyPaks Inc. (16-18 Del Carmine St., Wakefield, MA 01880) with
good results.

Small mail-order houses have a limited selection of good quality


components and usually put out a catalog that will be sent to you for a
156 The Computer Controller Cookbook

price. These houses are listed in the pages of electronics and computer
magazines. We have been particularly pleased with Jameco
Electronics (1355 Shoreway Road, Belmont, CA 94002). The
minimum order is only $10, and their turnaround time is remarkably
fast.

Local over-the-counter stores for the most part sell wholesale to


electronic repairmen and commercial customers, but some stores will
sell retail for cash. Look in the Yellow Pages under "Electronic
Equipment and Supplies-Dealers." Telephone first to find out if
they sell to the public and what hours they are open, but don't try to
order by phone. The counter people often have encyclopedic
knowledge of where to get obscure parts, but they must give preference
to their large customers. It is best to go to the counter in person and
patiently wait your turn. If the part you need is fairly common or used
frequently by repairmen, ham radio operators, or serious electronic
hackers, then the store will have it.

Big catalog stores have an enormous stock of components and put out
large catalogs. They cater to commercial accounts but will usually
accept a minimum order of about $25. To buy from them you must
first locate the local sales representative, either by going to the Yellow
Pages or by contacting the firm's central office. The local rep will send
you a copy of the catalog and, when you are ready to order, will use a
computer to make certain the items you want are in stock. An order
will generally take two to three weeks, but if an item is out of stock
there may be a delay of six to eight weeks. Work with the sales rep and
the catalog to find substitutes for out-of-stock items. We have ordered
parts from Newark Electronics (500 N. Pulaski Road, Chicago, IL
60624) and Allied Electronics (401 E. 8th St., Fort Worth, TX 76102).
Both of these firms have offices nationwide.

READING SCHEMATICS
Most information about the wiring of electronic devices is presented in
stylized drawings called schematics. Schematics are not difficult to
comprehend once you are familiar with a few basic symbols.
The Electronics Tutorial 157

RESISTOR CAPACITOR
-YV\I\IVL- --1/(--

E L £ e TRO LY TIC
MEC ROSWI TC H CAPA eITOR
+D-
CHIP
PUSH BUTTON
:-1--t- - -1- -1- -I-- -I,
I....
J-
I

-I- I

I I I
-1- -1- -1- -1- +- -1-'

The solid lines on the schematic represent electrical conductors


like wires and printed circuit lanes. If there is a dot where two solid
lines meet or cross the conductors are connected. If there is asmall loop
or no dot the conductors do not connect.
All the component terminals which are continuously connected
by solid lines will be at the same voltage; together these are called a
node. In making up the circuit you do not have to make the joint
exactly where the dot appears on the schematic. The solder joints can
be made at any convenient location as long as the terminals shown as
one node are connected in the final wiring.
The wiggly lines represent resistors and are labeled RI, R2, and so
on. A wiggly line with an arrow pointing at it is a potentiometer. The
arrow represents the wiper arm of the pot and is usually, but not
always, the middle terminal.
Switches are shown as dots with a swing line that looks like a
door. Terminals for switches are labeled n.o. (normally open), n.c.
(normally closed), and c (common). For the most part we use single-
pole, double-throw switches, with one each of these three kinds of
158 The Computer Controller Cookbook

terminals. With a single-pole double-throw switch, a single wire can


be switched between two terminals. The small microswitches used for
triggers and pushbuttons in many of the projects are single-pole,
double-throw. They make an audible click when pressed, a good
feature in a controller.
We also use a pushbutton switch with only two terminals. This is
a normally-open momentary-contact switch and usually appears on
the schematics as two circles with a curved bar almost touching them.
Pushbuttons with tops at least 3/B-inch in diameter are the least tiring
to press, and those that make a click are preferable.
Capacitors show up on schematics in two styles. Both are
represented by two parallel lines. For non-electrolytic caps, one of the
lines is slightly curved. In the symbol for electrolytic caps, one of the
lines has two extensions and looks like a three-sided box reaching out
to enclose the other line. The positive lead is marked with a plus sign.
Chips are shown in this book as dashed lines that form boxes
around special symbols. In order to understand how chips are related
to their representations on the schematic, it is important to know how
the pins are numbered. This is more difficult than you might suspect,
and mistaking pin numbers is probably the most frequent cause of
burned-up chips.
Place the chip with its legs pointing down on your worktable,
with the notched end away from you. You should be able to see the
manufacturer's insignia and read the part number indicating the type
of chip, like the 74LS04. That number may begin or end with extra
numbers which indicate ratings, for example, the military
temperature range. Chips often have a date code that can,
unfortunately, be mistaken for the part number. Pin 1 is on the left side
closest to the notch and is sometimes marked with a dot or circle. The
pin numbering continues down the left side, across the bottom, and up
the right side of the chip. For these projects we will be using DIP chips
with either 14 or 16 pins.
The best way to mount chips is to buy chip sockets for them. Make
all solder connections to the sockets and then plug in the chips as the
last step in constructing the circuit. Pin 1of a socket is often marked by
a cut-off corner.
The game connector for the Apple is a 16-pin DIP header
(sometimes called a component carrier) that plugs directly into a
standard chip socket. A DIP header looks similar to a chip but has
small forked lugs to which wires can be soldered. Other home
computers use different types of connectors. Information about them
The Electronics Tutorial 159

can be found in the operating manual for the machine or by


examining a standard set of paddles for the system.
Reading schematics is a fundamental requirement for learning
about computer hardware. With practice you will soon be able to read
them and turn the various symbols into functioning electronic
circuits.

A Note on How to
Check Your Work
The best way to check your wiring on electronics projects is to make
two photcopies of the schematic before you start. As you add a wire to
the circuit, draw over the appropriate line on the first copy with a
colored pencil. Color in each wire, joint, and component as you add it
to the device. When everything is colored in you know you have
finished the circuit.
Color in the second copy, point by point, as you check over your
work, either visually or with a multimeter. Many professionals use this
method of coloring in two schematics to check their work. To provide
an even better check, you can ask someone else to color in the second
copy as they check the circuit.

CONTROLLER
ELECTRONICS
The electronic circuits in home computer game controllers are not
difficult to understand. They have several digital inputs
(pushbuttons), some digital outputs (annunciators), and a few analog
inputs (game controls). The circuits don't change much from one
make to another. Even though these circuits are very simple, they can
be adapted to perform a great many tasks. The projects in this book are
only a sample of their many applications.
The digital inputs expect inputs of either 0 or +5 volts. Their
input resistance is several thousand ohms, so they don't draw much
current. Less than 4 milliamps is required to turn them on; this is
referred to as 1 standard TTL input. Since these inputs should not be
floating (an input that is not connected to either the +5 supply or
160 The Computer Controller Cookbook
VOLT
+ 5 - - -

+5

lGND.

Tt TIME
TIMER CHART
F [G. /4-1

ground is described as "floating"), a pull-up or pull-down resistor is


used in the circuits. The Apple uses pull-down resistors connected
from the input to ground, while the Atari uses pull-up resistors
connected from the input to the +5. For the controller prototypes we
used I K ohm resistors for either application. Digital inputs in
controllers may be driven by either switches or TTL chips.
The annunciators are usually rated to drive I TTL input.
Annunciators can supply no more than 5 milliamps of current. This is
not enough for an LED, which needs 20 milliamps. Therefore an
inverter or other chip must be placed in the circuit before an
annunciator can power an LED or even a large number of TTL
inputs.
Two types of analog inputs are used on home computers: the true
analog-to-digital converter and the timer. Some Radio Shack
computers and all expensive data logging systems used in industry use
true A-to-D converters. In these, a continuously changing (analog)
voltage is converted to a series of numbers (digital), When a pot is used
The Electronics Tutorial 161
as an input device for these circuits it must be wired to provide a
varying voltage. To do this, it must be wired in a true potentiometer
circuit, which requires three wires (+5, ground, and signal). You can
tell that a pot is connected for this kind of circuit if you see that three
separate wires are attached to it.
The timer type of analog input uses a circuit based on a popular
chip, the 555 timer. This timer is controlled by both a capacitor inside
the computer and by the game control pot wired as a variable resistor
(two wires). When a reading is called for, the computer starts the timer
and begins to count from 0 to 255. The number it has reached when the
timer goes off (see below) is the reading.
Drawing 14-1 shows how the timer is controlled. When the timer
is started, the capacitor is discharged and then allowed to recharge
through the resistor in the controller. The resistance of the controller
is dependent on the setting of the mechanical knob. The lower the
resistance, the faster the capacitor can charge, so less time is available
for the computer to count. When the amount of resistance in the
controller is high (i.e. the controller is at its highest setting) the
capacitor will charge to the trigger reference voltage more slowly,
allowing the timer's counter to reach a higher val ue before the timer is
tripped. When the trigger reference voltage (about 1.7 volts) set in the
design of the timer is reached, the timer is tripped and sets a flag so that
the computer will stop counting. This length of time is controlled by
the product of the capacitance times the resistance of the controller.
Chapter 1 gives you more information on this kind of circuit in the
discussion of correction capacitors.

ADAPTING THE
CONTROLLERS TO
DIFFERENT COMPUTERS
The circuits for the game paddle inputs of most home computers are
quite similar. They differ mainly in the connectors used and the value
of the pots. In this section we'd like to discuss the basic similarities and
differences in game controller design, and give you some hints on how
to adapt the projects described in this book for different home
computers.
162 The Computer Controller Cookbook

Apple II
All the designs in this book were tested on the Apple II Plus, which
uses a 16-pin DIP plug for its connector. This plug fits a standard IC
socket, but it isn't very strong and is often damaged. The new Apple
II/e adds a 9-pin D connector to the back of the console, but we think
most people will continue to employ extension sockets and standard
DIP connectors. The 9-pin D connector is the same socket used by
Atari, but the sockets for the two machines are not pin compatible.
The Apple II uses 150K ohm pots and a timer circuit. As noted
previously, 150K ohms is a non-standard pot value and is sometimes
difficult to find. Pull-down resistors are used on the pushbutton
inputs. These are connected from the input (pins 2,.3, or 4) to the
ground (pin 8). The factory paddles have 570-ohm resistors hidden in
their connectors, but we prefer to substitute I K resistors since this
value is easier to obtain, saves a little power, and is adequate for
pushbutton inputs.

Atari Systems
You shouldn't have any trouble adapting the controller designs to
Atari systems. They use a 9-pin D connector that is strong and readily
available. The D connectors that you can wire yourself have plastic
cases or hoods that may be too large for the Atari sockets. You can file
away some of the plastic for a good fit. The plug pinout is shown in
figure 14-2, which shows the game control schematic for the Atari and
Commodore VIC-20 computers.
The value of Atari paddle pots is I meg-ohm, a size that is easy to
find, but quite large. Such large value pots tend to wear out sooner
than those of lower values. The pots have two wires, indicating that
this is a timer circuit.
To use the Correction Cap Calculation in the software chapter,
change line 18 to read: 18 RMX = 1000 : CI =.00I : NM$ ="ATARI".
The pushbuttons have pull-up resistors going to the +5 supply, but the
circuit seems to work just fine without them. We generally used l K
resistors for pull-ups when working with Atari computers.
The Electronics Tutorial 163

The Commodore VIC-20


The Commodore VIC-20 has an attractive game input circuit custom-
made for this system. You can readily adapt this circuit to the
controller projects. The VIC-20, however, has only two analog inputs
so you can't use two standard joysticks at the same time or the foot
pedals along with the airplane wheel.
Commodore, like Atari, utilizes a 9-pin D connector. The pinouts
for the two systems are identical (as shown in figure 14-2). The system
uses the pots in timer circuits. You can use the Correction Cap
Calculation by changing line 18 to read: 18 RMX =1000: CI =.001 :
NM$ = "VIC-20".
The pots are I meg-ohm and are wired as variable resistors for a
timer circuit. The internal capacitors are .001 microfarads. The
pushbutton inputs, which can also be made to act as outputs, or
annunciators, do not seem to need resistors. We generally add IK pull-
ups anyway, since it is considered good electronics practice.

IBM Personal Computer


The IBM Personal Computer does not come with a game connector,
but you can purchase a game control adapter card that fits into one of
the computer's card slots. With this card the computer can read up to
four pots and four pushbuttons. All the projects are easily adapted for
use with this card, except the controlled AC outlet (chapter 12). The
controlled outlet requires an annunciator output, which is not
provided by the IBM card.
Figure 14-3 shows the schematic for two joysticks for the IBM Pc.
The joysticks have timer-type potentiometer circuits and use lOOK
pots. The pushbuttons connect from the pushbutton lines to ground
and require no pull-up or pull-down resistors.
The IBM uses a 15-pin D connector, usually available from the
same sources as the 9-pin connector used by Atari and the 25-pin (RS-
232C) connectors in the D connector series. Note (on figure 14-3) that
the +5 volt supply and the ground are available on several pins. You
can use any of the pins indicated on the drawing.
The Correction Cap Calculation should allow you to use lower
values for the pot. You will have to change line 18 in the listing to read:
18 RMX = 100 : CI = .011 : NM$ = "IBM PC". This line gives the
POT
X
r>
1
-
-
IMEG >

I
,---.:--.l- JOY I
DOWN
'J

PO T l.

Y r-;;-;>
1M EG JOY2 X
1_ J , LEFT PADDLE
PB
I
Y
PADDL E
RIGHT PB
..... I

1
I
I , v ic -20;
I I &
('6
...-
/0,
...-'"\
I ATARI
I I GAME CONTROL
DE9S L +5: l -.I
SCHEMATIC
SO CKE T GNO: 8 3'"'-u-'-;----.--1 FfG /4-2
BACK VIEW I
_ _
IIou
9
_' . . . . , . . 1
4,,-1I
v-:-,_ _...J
(-{J 5 I
.......... - .
..... 1-

L
<C >
OT 2
....... PI fiJriJ
<
PO
(9
1(9 (9
T
K: • .'
'---
..... <1

-
K

PO T .....{ P OT3
<I 1? I <9<9 K
1 <I >'
16) (9K ;> """'-

'---
'--

P
4 v 0

PB v

5
-0
'"

IBM PC
+5r-
GAME CONTROL
...... +-5
I I SCHEMATIC
.....
84 2 FIG 14-3
-
r;

3_ I

GND 4
....
..... ,
:P2
D
5
'? :GND
GND D
.."

PI 6
-..... - I DA /5 P
B5 7
[>
14: B7
-
;'I
PLUG
IS'
<II
BAC/f... VIEW
+5
j
I
166 The Computer Controller Cookbook
maximum pot value as lOOK, the internal cap size as .011 microfarads,
and the computer's name.
Instructions for reading the game inputs are given in detail in the
documents that come with the game control adapter card. No changes
in these instructions are needed for the IBM PC to read the controllers
in this book.

Radio Shack Models


Some Radio Shack computers come with a game controller; others can
take an add-on device to accept the game controller. You can adapt
most of these projects to any Radio Shack model that can handle their
standard game paddle.
Radio Shack paddles use the DIN (Deutsche Industrie-Norm)
connector. It originated in Europe and comes in several pin
configurations. Make certain the connector you buy not only has the
right number of pins but also has them in the correct pattern.
The lOOK pots are wired as voltage dividers or true
potentiometers. The true potentiometer circuit will accept a wide
range of maximum pot values, but since correction caps work with
timer circuits only, they cannot be used to control pot values here. This
creates a problem with controllers like the Airplane Wheel and Super
Stick in which the pots do not travel through their entire range. For
these controllers we recommend that you start with a pot of about 250K
and use the painting procedure described in chapter 1 under the
heading "Zeroing Joystick Elements" to reduce the resistance of the
unwanted portions of the pot to zero. Complete the mechanical
construction and remove the back of the pot by straightening the two
metal tabs. Then mark the limits of travel for the pot wiper and paint
the pot element with conductive paint from the marks to the terminals.

Other Computers
In general, if a home computer can handle a pair of paddles with a
total of two pots and two pushbuttons, most of the controllers in this
book can be adapted for that computer.
The user manual or perhaps a reference book will give you the
information you need concerning the game connector and its pin
assignments. You may have to take apart the factory paddles to learn
The Electronics Tutorial 167
the standard pot value. You can then work out the paddle circuit with
an ohm meter. Look for the standard components and circuit designs
we've described above. Draw your own schematic after finding out
which pins are connected to which pot and switch terminals. Look out
for pull-up or pull-down resistors that may be hidden in the connector
or embedded in plastic parts.
For each new computer model that appears on the market, a
magazine article will quickly follow that evaluates its paddles and
joysticks and usually explains the paddle connection. If the system in
question has been around for awhile, look through back issues of
Creative Computing and other magazines that regularly review
computer equipment. You might even ask the person who sold you
the computer where to find out this kind of information.

TOOLS REQUIRED FOR


THE ELECTRONICS WORK
You will need the tools we discuss here for the electronics work in the
controller projects. These tools are also often extremely useful for
carrying out other household tasks. You may already have several of
them on hand.

Soldering Iron. Most of these projects require a small pencil soldering


iron of 25 to 42 watts with a liB-inch chisel point. Larger irons are
likely to damage the components, the circuit board, or the insulation
on the wiring. Different models, even if they have the same wattage,
may deliver different amounts of heat to the joint. If you do much
electronics work you will probably end up with two or more irons so
that you have just the right one available for a particular job.
You will find these soldering aids indispensable: a roll of solder
wick (Radio Shack #64-2040) to correct your mistakes, a piece of wet
sponge to clean the tip, and a stand for the iron. Good soldering is the
most important skill in electronics and will be covered in detail in the
next section.

Long-nose Pliers. A small pair (5-inch) is best for electronics work.


Don't use them for jobs like bending coat hangers or you will ruin
them.
168 The Computer Controller Cookbook

Diagonal Cutters. You will need diagonal cutters, called dikes, to cut
off wires close to the circuit board. Again, a 5-inchpair is best for this
work. Don't use these to cut coat hangers either.

Wire Strippers. A pair that looks like wire cutters and is adjusted by a
bolt through the handle is most suitable for these projects. You will
have to change the adjustment for each wire size and test the strippers
on scrap wire after each adjustment to make sure that you don't cut any
fine copper wires. It takes practice to use wire strippers without
damaging the wire, but developing this skill is crucial for wiring the
projects correctly.

Multimeter. Although not absolutely required for these projects, an


inexpensive multimeter is extremely useful for checking your wiring
before plugging a new unit into your computer. An analog
multimeter with a half-dozen resistance and DC voltage ranges will
serve nicely. Any Radio Shack multimeter on sale, sometimes for as
little as $10, is a good buy. The more expensive digital meters are
difficult to use. A less expensive meter will serve you better for these
projects.

HOW TO SOLDER
Soldering is the most basic and critical skill in electronics. Many
components will be destroyed if they are not soldered well, and since it
is almost impossible to turn a poor soldering job into a good one, it is
important to do the job right the first time. Fortunately, it isn't hard to
learn to solder correctly. If you follow the suggestions below and put
in even a modest amount of time in practice, you should have no
problem mastering the technique.

Use the correct.iron for the job. For electronics work use a pencil iron
of 25 to 42 watts with a liB-inch chisel tip. A larger iron can lift the
copper lanes off the circuit board, melt wire insulation, and damage
components. The transformer-type pistol-grip irons used for
household repairs have too large a point and too much power for
electronics work. Only one of the projects, the Desk Switched Outlet
Box, uses an iron this large.
The Electronics Tutorial 169

Buy small-diameter resin-core solder. One acid-core solder joint will


destroy an entire electronic device. Acid-core solder is used to work
sheet metal and usually comes in large diameters. If you have any
doubt about the type of core, don't use the solder. The solder for these
projects should be a 50/50 tin/lead alloy about .032-inch in diameter.

Keep the tip of the iron clean. Rub the tip frequently over a damp
sponge to remove excess solder and resin. You will find it helpful to
keep the sponge in a jar lid on your workbench.

Make good mechanical connections before applying solder. Twist


multi-strand wire tightly-loose strands will cause shorts. Wrap wire
around posts with the long-nose pliers. Push wires through the
printed circuit board and bend them slightly on the bottom side. When
you are ready to solder, take your hands off the work. All the wires to be
soldered should stay in place. You can't hold a wire in place with your
finger and start soldering; the result is a bad joint and a burned finger.

H eat the joint, not the solder. Cover the clean tip of the iron sparingly
with solder (this is called tinning the tip), and then place the tip on the
joint. When the joint begins to heat, touch the solder to the joint, not
to the iron. The solder should melt and then flow as a liquid over the
joint. When the joint is uniformly covered, remove the solder and then
the iron. Let the joint cool for a few seconds before you touch the wires.

Inspect the joint. The joint should be covered with a smooth coat of
solder. You shouldn't see any untinned copper wires or dark buildup
of excess resin. The solder must clearly have been a liquid that flowed
and then cooled. Also look for fine strands of wire or bridges of solder
between the joint just finished and its neighbors. These can usually be
removed with dikes, solder wick, and soldering iron.
There are two types of bad joints: those that got too hot during
soldering and those that never got hot enough. The hot joint is
characterized by insulation that pulls back from the wire, copper lanes
that lift off the board, a discolored printed circuit board, and
sometimes even damaged components.
A cold joint may have lumps of solder that didn't flow, dark
patches of resin, or places where copper wires show through the solder.
A cold joint can be caused by an iron that is too small for the job, an
170 The Computer Controller Cookbook

improperly cleaned and tinned tip, poor thermal contact between the
tip and the joint, or simply because you didn't leave the iron on the
joint long enough.

Take safety precautions. A poorly handled soldering iron can burn


your fingers and your desk or worktable. It could even start a fire. It is
important that you buy or make a weighted stand for your iron and
then use it to hold the iron. Always unplug the iron when you leave the
room, even if you plan to be gone for only a short time. Make this a
habit so when you leave your house you won't have to wonder, "Did I
unplug the soldering iron?"

Craftsmanship. Soldering is an important skill. Every time you start a


new job try to do it better than the last one. This is a key attitude for
developing good skills in any field.

AC CODES AND WIRING


PRACTICES
It is surprising how many otherwise competent electronic technicians
don't know or don't understand the importance of following National
Electrical Code guidelines when working on AC devices. We will
summarize the parts of the code that are necessary for constructing
these projects (see The National Electrical Code Handbook, produced
by the National Fire Protection Association, Quincy, Massachusetts).
This information is critical not just for working on controllers but for
all household electronics work, from rewiring a lamp to installing an
outlet in a room.

Color Codes
The key to wiring AC devices correctly is to follow the color code for
wires and terminals. Green wires and wires without insulation are the
safety ground and are connected to all metal boxes, conduits, and
frames. Their screw terminals are green; sometimes they have green
clips instead of screw terminals. Proper installation of green wires
minimizes the hazards of electrical shock and fire while reducing
electrical noise. The safety ground wires should be the same size as the
The Electronics Tutorial 171

other colored wires in a circuit. The green line must never be switched,
fused, or run through a' circuit breaker. It carries current only in the
case of a fault in the circuit. In Europe the safety ground wire is yellow
with green stripes.
The white wire is the power return. It carries current back from
the load, but is close to ground voltage except when a faul t occurs. The
screw color for the white wire is silver. If all the wires in a cable are the
same color (as is the case in plastic lamp cord), the correct wire to use
for the power return will always be marked. The mark is usually a
series of ridges along the outside of the wire or, more rarely, a colored
thread wrapped around the copper conductor. On AC outlets and
plugs the white wire goes to the wider prong (the indication that it is
the marked prong). Like the green wire, the white wire is never
switched, fused, or run through a circuit breaker.
The power wire can be any color except white or green; it cannot
be a bare wire. The most common colors for the power wire are black,
red, and blue. The screw terminals are brass colored. Since these wires
carry power to the electrical device, they are the only wires you can
switch, fuse, or run through a circuit breaker.
When you are running a wire to a switch that is separated from the
main device, you will sometimes need a cable with two power wires
but you won't need the white or green wires. In chapter II (the Desk
Switched Outlet Box), cable 2 from the outlet box to the switch box
(figure 11-2) requires two power wires and a white wire. The AC code
lets you paint both exposed ends of a wire the color you need, so you
don't have to buy special cable, e.g., one with a green and two black
wires. Yon will find that felt tip marking pens work well for painting
wires a dark color. White electrical tape is wrapped around dark wires
to color them white. If you paint a wire you must be careful to mark it
in every place where you remove the covering, even in intermediate
boxes. Painting a wire is an important safety step since it clearly
indicates the arrangement of the circuit, particularly to those who
might have to repair it at a later date.

Wire Size
The larger the number, the smaller the size of the wire. Even numbers
indicate that the wire is copper. Most electronic devices are wired with
#12, #14, or #16 wires for AC power. Solid #12 wire is now standard for
long runs and for house wiring and is also used for high-current loads
172 The Computer Controller Cookbook

like heaters, hot plates, and air conditioners. If you plan to plug
several medium-power electronic devices into the Desk Switched
Outlet and run the cord more than 15 feet, you might go to the extra
expense of using #12 wire. For most medium-power microcomputer
and home electric systems, #14 wire is adequate, and #16 wire will
suffice for systems with loads of 100 watts or less.
Placing wires in screw terminals looks easy, but it is often done
incorrectly. To attach a wire to a screw terminal, twist the stranded
wire tightly together and form it into a hook. Place the hook around
the screw in a clockwise direction. This is important: you will twist the
wire more tightly as you tighten the screw if the wire is wound
clockwise. If you put the hook on backwards, you will loosen it as you
tighten the screw. Close the hook with long-nose pliers and then
tighten the screw. When you have finished the wiring, go back over all
the screw terminals to be sure they are tight.

Wire Nuts
Wire nuts are small plastic and metal devices for connecting several
wires together. To properly install them, group all the wires together
in a bundle between your thumb and index finger. Cut them off evenly
and strip their insulation back l/2-inch from the end for solid wires
and 3/4-inch for stranded wires. If any of the wires are stranded, you
will need to twist all the stripped wires together into a bundle using
long-nose pliers. If all the wires are solid, as is usual for house wiring,
leave them straight.
Now twist the wire nut on with your fingers as tightly as you can.
Rock the nut back and forth with one finger looped around the bundle
of wires. If the nut has grabbed all the wires, they will move back and
forth as a group. If you can feel any wire moving independently of the
group, take off the nut, even out the bundle, and try again. If you
stripped the wires properly, all the bare copper should be hidden from
view inside the nut.

SAFETY PRECAUTIONS
Please be careful when building the projects in this book. You can
learn from minor mistakes, but serious ones have no redeeming
virtues. Avoid the big mistakes that can cause injuries or damage
valuable equipment.
The Electronics Tutorial 173
Don't burn down your house. Use your soldering stand and unplug
your iron every time you leave the room. Use only outlets that have
proper fuses or circuit breakers and don't plug too many devices into
one outlet.

Keep stray electrical power out of your computer. Carefully check


devices that use alternating current (like the monitor and the
controlled AC outlet) to insure that stray AC cannot find its way into
the computer. If you are working on a controller with an AC cord, give
this device an extra check with the multimeter before connecting it to
your computer.

Avoid electrical shocks. Follow all codes for AC devices. Unplug the
cords before opening the case of an electrical or electronic device.
Don't work on power equipement while you are alone. Always have
another person nearby who can cut off the power or go for help in an
emergency.

Don't plug any device into live equipment. This rule refers to both
connectors and printed circuit boards. In most instances, nothing
untoward will happen if you plug a paddle into your computer when
it is already on, but you could create a spark that in turn could destroy
an electronic component. It is bad practice, so don't take the chance.

Don't short the computer power supply to ground. Depending on the


computer, a short to ground may blowout a fuse, and could
conceivably damage the power supply. Check and recheck the +5 wires
on all newly-built devices with a multimeter before plugging them in.
On the Apple, the +5 supply (pin I) must read at least 50 ohms to
ground (pin 8), and usually measures much more. The Apple's power
supply can provide only 100 milliamps at +5 volts to the game control
socket. By Ohm's law a resistance of 50 ohms will draw the entire 100
milliamps, so this value is the lowest resistance allowed. Other
computers will have similar limiting current values which must be
observed. This information is usually given in the reference manual
for a computer, in the section on the game controller connector.
If you turn on your computer with a new controller plugged in
and it doesn't start up in its normal fashion, the +5 may be shorted.
Turn the computer off immediately and recheck all your work. A chip
plugged in backwards is often the cause of this kind of short.

Use common sense. Proceed carefully and check your work. Don't
work on equipment when you are ill or overtired or taking drugs of
any kind. The whole point is to do the job right the first time.
174 The Computer Controller Cookbook

REFERENCES
The references below will be useful for understanding the electronics
in the controller projects as well as for a general study of the subject:

Engineer's Notebook II: Integrated Circuit Applications, Forrest M.


Mims III, Radio Shack Cat. No. 276-5002, $2.49. This softbound
volume is perfect for beginners and of great value for professionals. It
gives you schematics for hundreds of circuits that you can actually get
the parts for. We have a $50 reference book that isn't as good as this
one. An essential tool and an incredible buy for the price.

Semiconductor Reference Guide, Radio Shack Cat. No. 276-4006,


$3.49. This softbound guide isn't as helpful as Engineer's Notebook II,
but it does contain good information on available components. Since
much of the material is in the form of measured parameters (voltages,
timings, etc.), a beginner may find this guide difficult to use at first.
You will soon learn to pick out the specific information you need.

Radio Shack/Texas Instruments Learning Center books on various


topics in electronics. These books, sold at Radio Shack, are generally
well written and reasonably priced. Several of the volumes cover
microprocessors and digital equipment. They tend, however, to stress
the achievements of Texas Instruments and overlook everyone else's.

The National Electrical Code Handbook, edited by Joseph A. Ross,


published by the National Fire Protection Association, Quincy,
Massach usetts, provides excellent guidelines for electricians or
electronic technicians working with AC devices. This book is a
critical reference tool for using your computer to control AC power,
as well as for any household electrical work.

Computers & Electronics (formerly Popular Electronics) and other


amateur electronics magazines. These magazines often feature lots of
articles on how to build items of dubious utility from parts that aren't
available. They do contain excellent learning projects, however, and
the ads in the back are helpful in ordering parts from electronics
suppliers.
The Electronics Tutorial 175
Creative Computing and other computer magazines. These magazines
focus on home computers, but stress software and reviews of
commercial hardware. The articles on how to build hardware for the
computer are usually too advanced for the beginner. After completing
several of the projects in this book, however, you will be able to move
up and take on these more complex and challenging circuits.
00
s

®
e


15 Software
These six programs in Applesoft Basic will help you construct, test,
and use your homebuilt controllers. The six listings are:

Controller Checkout
Correction Cap Calculation
Linearity Test
Drawing Program
Digitizer
Annunciator Checkout
178 The Computer Controller Cookbook

All but the Drawing and Digitizer programs can easily be converted
into any other version of Basic with only a few changes. The Drawing
Program contains many graphics handling functions for the Apple,
and the Digitizer has several disk handling instructions. These listings
will require a little more work to adapt them to other computers.
The use of each of the programs is detailed in the project chapter
in which it is first required. The materials in this chapter are therefore
limited to the organization of the program, any unusual features, and
the major variables. This information should help you understand the
listings and make modifications in them to suit your needs.
Software 179

CONTROLLER CHECKOUT
With this program you can check out all the pushbuttons and game
control pots on the controllers you build. You will also need it to make
mechanical adjustments. The listing is introduced in chapter 1 and
referred to in almost all subsequent chapters.

Step by Step Through the


Listing
The program sets constants (line 280), clears the screen (line 300), and
displays a screen format giving the pushbutton and game control
numbers (lines 40 to 190). The pushbuttons are read (lines 210 to 230)
and the values are displayed in a cleared space on the screen (lines 237
to 239).
The game control pots are then read (lines 250 to 265). Note the
delays between readings (lines 252, 257, 262). The space to display this
information is cleared and the values are entered (lines 270 to 280).
Next the pushbuttons are checked to see if any have been pressed and
the appropriate word, OPEN or CLOSED, is displayed (lines 290 to
325). The process is repeated in an endless loop (line 330).

U sing the Program


When you are confident you have wired your new controller correctly,
plug it in, turn on the computer, and run this program. If the
computer doesn't start up in the normal way, turn it off immediately
and recheck all your work on the controller.
When everything is in order, run the checkout program. Try
moving the pots and pressing the pushbuttons to see if they function
properly. If the new device requires mechanical adjustment, you can
do this while reading the game control values from the screen.

Variables
Variable Line Description
OP$ 25 A string saying OPEN
CL$ 25 A string saying CLOSED
BL$ 25 Blank spaces to remove words
180 The Computer Controller Cookbook
Variable Line Description
PO 210 The reading of pushbutton 0
PI 220 The reading of pushbutton I
P2 230 The reading of pushbutton 2
GO 250 The reading of game control 0
GI 255 The reading of game control I
G2 260 The reading of game control 2
G3 265 The reading of game control 3

10 REM ********************** 237 VTAB 10: HTAB 25: PRINT BL$;


12 REM * : HTAB 25: PRINT P0
14 REM * CONTROLLER CHECKOUT 238 VTAB 12: HTAB 25: PRINT BL$;
16 REM * : HTAB 25: PRINT PI
18 REM * TOM RILEY COPYRIGHT 83 239 VTAB 14: HTAB 25: PRINT BL$;
: HTAB 25: PRINT P2
2111 REM * 240 REM
22 REM ********************** 245 REM ** READ CONTROLLER POTS
24 REM
25 OP$ = "OPEN ":CL$ = "CLOSED": 250 G0 = PDL (0)
BL$ 252 FOR I = 1 TO 10: NEXT I: REM
3121 TEXT: HOME DELAY REQUIRED
34 REM 255 Gl = PDL (1)
35 REM ** DISPLAY FORMAT 257 FOR I = 1 TO 10: NEXT I
40 VTAB 2: HTAB 6 260 G2 = PDL (2)
PR I NT "CONTROLLER CHECKOUT - 262 FOR I = 1 TO 10: NEXT
APPLE II" 265 83 = PDL (3)
6!21 VTAB 6 270 FOR I = 17 TO 20: VTAB I: HTAB
7121 PR I NT" THI S PROGRAM TESTS 23: PRINT BL$: NEXT I
CONTROLLER" 280 VTAB 17: HTAB 23: PRINT G0: VTAB
80 PRINT "PUSHBUTTONS AND POTS." 18: HTAB 23: PRINT Gl: VTAB
19: HTAB 23: PRINT G2: VTAB
9111 PRINT 20: HTAB 23: PRINT G3
100 VTAB 10: HTAB 8: PRINT "PB0 285 REM * PUSHBUTTON OPEN OR CL
IS " OSED
110 VTAB 12: HTAB 8: PRINT "PBl 290 IF P0 ) 127 OR PI ) 127 OR P
IS " 2 >- 127 THEN GOTO 300
120 VTAB 14: HTAB 8: PRINT "PB2 294 FOR I = 10 TO 14 STEP 2: VTAB
IS " I: HTAB 15: PRINT OP$: NEXT
14111 VTAB 17: HTAB 14: PRINT "PDL
(0) = " 296 GOTO 210
15121 VTAB 18: HTAB 14: PRINT "PDL 30121 IF P0 > 127 THEN VTAB 1Ill: HTAB
(1) = " 15: PRINT CL$
160 VTAB 19: HTAB 14: PRINT "PDL IF P121 < 128 THEN VTAB 10: HTAB
(2) = 15: PRINT OP$
170 VTAB 2121: HTAB 14: PRINT "PDL 31fZl IF PI >- 127 THEN VTAB 12: HTAB
(3)= " 15: PRINT CL$
190 FOR I = 10 TO 14 STEP 2: VTAB 315 IF PI < 128 THEN VTAB 12: HTAB
I: HTAB 15: PRINT OP$: NEXT 15: PRINT OP$
32121 IF P2 >- 127 THEN VTAB 14: HTAB
198 REM 15: PRINT CL$
20121 REM ** READ PUSHBUTTONS IF P2 -, 128 THEN VTAB 14: HTAB
21!21 P0 PEEI< - 16287) 15: PRINT OP$
220 PI PEEK 16286) 33121 GO TO 21121
23121 P2 PEEK 16285) 999 END
Software 181

CORRECTION CAP
CALCULATION
This program calculates the value of the correction caps needed when
you choose a potentiometer with a lower maximum value than the
standard paddle pots for the computer. This approach works only for
computers that have timer game control circuits, like Apple, Atari,
and the Commodore VIC-20.
The use of this program is described in detail in chapter 1. The
program will be needed whenever you build a controller requiring
correction caps.

Step by Step Through the


Listing
The internal capacitor value and the maximum paddle value for a
computer are set (line 18). This is the only line that will have to be
changed to use this program for computers other than the Apple. The
constant for the system is then calculated (line 19).
Information about the program is displayed (lines 35 to 160), and
you are given the choice of automatic or manual operation (line 164).
For automatic mode, you must plug the completed controller without
correction caps into the game I/O connection and set the pots to their
maximum values before you run the program.
If you choose manual operation, execution continues with a
request for the maximum pot value of the new device in K-ohms (lines
170 to 175). A check is then made for too large or too small a pot value
(lines 180 to 190). The correction cap is calculated (lines 200, 205) and
displayed (line 210). Execution is then returned to the
automatic/manual question (line 164).
If the pot value you provide is too high, correction caps don't
work. The use of an alternative correction resistor is suggested (lines
320 to 340). The resistor is then calculated (lines 350, 357) and
displayed (line 360). Execution is' again returned to the
automatic/manual question (line 164).
If you choose automatic mode, instructions are given (lines 1000
to 1095). The controller pots are each read, the correction cap values
calculated, and the values displayed in turn (lines III 0 to ll48). The
182 The Computer Controller Cookbook

keyboard is then checked to see if any key has been pressed (line 1160).
If so, the program is ended (line 1170).

Variables
Variable Line Description
RMX 18 Maximum value of pot for this computer
CI 18 Value of cap inside the computer in
microfarads
NM$ 18 Name of computer
K 19 Constant for the computer system
MA$ 164 Choice between manual or automatic modes
R 175 Maximum value of pot in new controller
C 200 Value of correction cap in microfarads
RC 350 Value of correction resistor in K-ohms
PO 1110 Reading for game control 0
CO 1115 Correction cap for game control 0
PI 1120 Reading for game control 1
Cl 1125 Correction cap for game control 1
P2 1130 Reading for game control 2
C2 1135 Correction cap for game control 2
P3 1140 Reading for game control 3
C3 1145 Correction cap for game control 3
Q 1170 Check for keyboard key being pressed

1 REM ************************ 45 VTAB 4: PRINT " FOR


2 REM ";NM$
3 REM
** CORECTION CAP 51Z1 VTAB 6
4 REM * CALCULA TI ON 60 PRINT "FOR A CONTROLLER TO BE
5 REM CORRECTLY READ,"
6 REM ** TOM RILEY COPYRIGHT 83 70 PRINT "A TIMER IT CONTROLS MU
7 REM ST WORI< PROPERLY."
8 REM
* 81Z1 PR I NT "THE TI MER IS CONTROLLE
*************************
o BY A CAPAC ITOR"
9 REM 90 PRINT "AND THE POT IN THE CON
17 REM POT & CAP VALUE FOR APP TROLLER WIRED AS"
LE- I I llZllZ! PRINT "A VARIABLE RESISTOR."
18 RMX = 150:CI = .022:NM$ = "APP
LE II" 1 HI PRINT
19 I< = RMX * CI 1212l PR I NT" THE PRODUCT OF TH
20 TEXT: HOME E CAPACITOR AND"
30 VTAB 2: HTAB 5 1311l PRINT "THE MAXIMUM RESISTANC
34 REM E MUST REMAIN THE"
35 REM *** INFORMATION 140 PRINT "SAME. CORRECTION CAP
4i!1 PRINT "CAPACITOR ADJUSTMENT C S MAY BE ADDED"
ALCULATION" 150 PRINT "INSIDE THE CONTROLLER
Software 183

IF POT VALUE" 112145 PRINT "VALUES."


155 PRINT "IS TOO LOW." 11215121 PRINT
16121 PRINT 112j6121 PRINT" THE CAP VALUE SHO
161 REM WN WILL MAKE THESE"
162 REM ** CHOOSE MANUAL OR AUT 11217121 PRINT "SETTINGS READ 255."
OMATIC 11218121 PRINT
164 INPUT "MANUAL OR AUTOMATIC ? 1090 PRINT "PRESS ANY KEY TO QUI
(M OR A) ";MA$ T. II

166 IF MA$ = "A" THEN GOTO 111101(.1 1095 PRINT. : PRINT


167 PRINT 112j99 REM
168 REM 11121121 REM ** READ POTS AND CAL
169 REM *** MANUAL CALCUL.ATION CULATE COR. CAP.
17121 HTAB 6: PRINT "MAX. POT. RES 111115 VTAB 14
• :> K-OHMS"; 111121 pal = PDL (al)
175 HTAB 22: INPUT" ";R 1112 IF P0 = 0 THEN P0 = 1
177 L = PEEK (37): VTAB L: HTAB 1115 C0 = (CI * 255) / P0 - CI
29: PRINT "K-OHMS" 1117 C0 = INT (C0 * 1000 + .5) /
180 IF R > RMX THEN GOTO 300 1ala!!11
190 IF R = 0 OR R < 0 THEN PRINT 1118 PRINT "GCal READING ";P12I;"
"POT VALUE MUST BE GREATER T CDR.CAP "; cal; "
HAN 0": GOTO 160 1119 PRINT
200 C = K / R - CI 112111 P1 = PDL (1)
21215 C = INT (C * 10000 + .5) / 1 1122 IF P1 = 0 THEN P1 =
0000 1125 C1 = (CI * 255) / P1 - CI
207 PRINT 1127 C1 = INT (C1 * 1000 + .5) /
210 PRINT "CORRECTION CAP IS ";C 1alf2I121
;" MICROFARADS" 1128 PRINT "GCl READING "P1;" C
220 GOTO 160 OR.CAP ";C1;"
300 REM ** HIGH POT VALUE CALCU 1129 PRINT
LATION 113121 P2 = PDL (2)
310 PRINT 11:32 IF P2 = 0 THEN P2 = 1
320 PRINT "CAP CORRECTION DOES N 1135 C2 = (CI * 255) / P2 - CI
OT WORK ABOVE "; RMX;" ".,,, 1137 C2 = INT (C2 * 1000 + .5) /
330 PRINT "A CORRECTION RESISTOR 10121121
FROM +5 TO WIPER" 11:38 PRINT "GC2 READING ";P2;"
340 PRINT "MAY HELP BUT THE RESU COR.CAP ";C2;"
LT IS NOT LINEAR." 1139 PRINT
35121 RC = (R * RMX) / (R - RMX) 114121 P3 = POL (3)
355 RC = INT (RC * 10) / 10 1142 IF P3 = 0 THEN P3 = 1
357 PRINT 1145 C3 = (CI * 255) / P3 - CI
36121 PRINT " CORRECTION RESIS 1147 C3 = INT (C3 * 1000 + .5) /
TOR IS ";RC;" K-OHM" 1111121121
370 GOTO 16121 1148 PRINT "GC3 READING ";P3;"
999 END COR.CAP ";C3;"
11210121 REM *** AUTOMATIC MODE 1160 Q = PEEK ( - 16384): POKE
101121 HOME 16368,111
102121 PRINT" AUTOMATIC MODE" 117121 IF Q :> 127 THEN GOTO 9999
11113121 PRINT PRINT 1175 REM ** ENDLESS LOOP
1l!140 PRINT" TURN ALL PADDLE P 1180 GOTO 110l2J
OTS TO THEIR HIGHEST" 9999 END
184 The Computer Controller Cookbook

LINEARITY TEST
The Linearity Test checks the linearity of graphic input devices that
use the game control inputs. Linearity is the ability of an input device
to transform a mechanical input (the turning of a paddle) into an
electronic input accurately. The use of this program is described in
detail in chapter 5 on the Sketch Pad. Linearity is essential to sketch
pad performance as well as to many other forms of data entry.

Step by Step Through the


Listing
Initial values for constants are set (lines 30 to 70). The display format is
produced (lines 100 to 298). The subroutine (lines 1000 to 1090) for the
game control input reading is then called up (in line 310). The value of
the 0 game control input is read and displayed (lines 1010,1020). TheO
pushbutton is read and checked to see if RETURN is needed (lines
1027, 1028). Game control #1 input is read and displayed (lines 1030,
1040). Pushbutton #1 is read and checked to see if RETURN is needed
(lines 1070, 1080). The subroutine is then repeated (line 1090).
The errors and precentage error of full scale are calculated and
rounded off to two decimal places (lines 312,314). A check is then made
to determine which pushbutton was pressed, and the values are
displayed (lines 330, 340). The axes are checked to see if they are
complete (lines 342, 344) and the flashing cursors are moved (lines 355,
365). There is a slight pause (line 370) and execution is sent either to a
new test question (line 380) or returned (line 390) to the subroutine.

Variables
Variable Line Description
X(5) 30 A vector of the correct values in the
X axis
Y(5) 30 A vector of the correct values in the
Yaxis
NX 70 Number of the X point being read (0 to 5)
NY 70 Number of the Y point being read (0 to 5)
Software 185
Variable Line Description

XE 312 Error in X axis reading


PX 312 Percentage error in X axis reading
YE 314 Error in Y axis reading
PY 314 Percentage error in Y axis reading
PT$ 330 String telling if point is on X or Y
aXIS
YN$ 420 String answering YES/NO questions
X 1010 Reading of game control 0
POB 1027 Reading of pushbutton 0
Y 1030 Reading of game control I

10 REM *********************** 29111 PRINT" X = Y


12 REM * =11

14 REM * LINEARITY TEST 295 FLASH VTAB 6: HTAB 18: PRINT


16 REM * II "

18 REM * TOM RILEY COPYRIGHT 83 298 VTAB 14: HTAB 18: PRINT" ".
NORMAL
2J!1 REM * 300 REM READ PADDLES
22 REM *********************** 31111 GOSUB 1111111121
24 REM 312 XE = INT CCX - X(NX» * 100)
3121 DIM X(5), Y(5) / 100:PX = INT CXE / .255)
5111 FOR N = 111 TO 4 / HI
55 XIN) = 255 * N / 4:Y(N) X(N) 314 YE =
INT CCY - YCNY» * 100)
6111 NEXT N / 100:PY = INT (YE / .255)
7121 NX = 0:NY = 0 / 10
9111 HOME 320 REM ** NOTE TEST POINTS
100 REM ** HEADINGS 3:::::121 IF PT$ = "X" THEN VTAB (6 +
11111 PRINT " LINEARITY TES NX): HTAB 18: PRINT X;: HTAB
T" 25: PRINT XE;: HTAB 33: PRINT
12121 PRINT PX:NX = NX + 1
1"",.
L...J PRINT " CORRECT REA 340 IF PT$ = "Y" THEN VTAB (14 +
D ERROR '/.,11 NY): HTAB 18: PRINT V;: HTAB
13111 PRINT " X - AXIS" 25: PRINT YEo: HTAB 33: PRINT
1-;1""",
'_".4, PRINT PY:NY NY + 1
135 PRINT "POINT 121 "; XC0) 342 IF NX > 5 THEN NX = 5
14111 PRINT "POINT 1 "; X(1) 344 IF NY > 5 THEN NX - 5
150 PRINT "POINT 2 II; X (2) "';l,;JW FLASH: VTAB (6 + NX):
16121 PRINT "POINT 3 "; X(3) 18: PRINT" ": NORMAL
17121 PRINT "POINT 4 "; X(4) 365 FLASH: VTAB (14 + NY): HTAB
18111 PRINT 18: PRINT" ": NORMAL
19121 PRINT " Y - AXIS" 37121 FOR N = 1 TO 500: NEXT N
195 PRINT 38121 IF NY = 5 AND NX = 5 THEN GOTO
2121121 PRINT "POINT 0:;:
;;;J "; Y (121) 41!1l21
21111 PRINT "POINT 6 "; Y (1) 39121 GOTO 3121121
22121 PRINT "POINT 7 II; Y (2) 4111111 REM ** TEST AGAIN ?
2:::::111 PRINT "POINT 8 II; Y (3) 41111 VTAB 2121
24121 PRINT "POINT 9 "; Y(4) 42121 INPUT "NEW TEST ? ( Y OR .N
26121 PRINT ";YN$
27i!1 PRINT "PRESENT POSITION" 43111 IF YN$ = "Y" THEN GOTO 70
28111 PRINT 999 END
continued . . .
186 The Computer Controller Cookbook
REM ** READ PADDLES SUBROU 1030 Y = PDL (1)
TINE
101111 X = PDL (!2l) ...•
11114111 VTAB 22: HTAB 25: PRINT "

11112111 VTAB 22: HTAB 1.: PRINT" 111145 HTAB 25: PRINT Y
" .• 1I117l1s P1B = PEEK ( - 16286)
111125 HTAB 1111: PRINT X 108111 IF P1B > 127 AND NY < 5 THEN
111127 P0B PEEK ( - 16287) PT$ = nyu: RETURN
111128 IF P0B > 127 AND NX ( 5 THEN 1!219!21 GOTO 1!21 1111
PT$ = "X": RETURN 9999 END
Software 187

DRAWING PROGRAM
Using this program you can draw directly into the hi-res screen with
any paddle, joystick, or controller. It was written for the Sketch Pad
controller and is described in detail in chapter 4.

Sections
This program uses a Main Menu to direct execution to any of six
subroutines:

1 Clears High Res Screen (lines 130 to 135)


2 Gets Drawing From Disk (lines 2000 to 2130)
3 Puts Drawing on Disk (lines 3000 to 3190)
4 Draws Continuous Points (lines 4000 to 4155)
5 Draws Continuous Lines (lines 5000 to 5210)
6 Draws Reference Point Lines (lines 6000 to 6410)

There is also a Main Menu subroutine (lines 8000 to 8130) and an


Introduction (lines 9000 to 9195). The program enters the graphics
mode by poke commands (lines 5210, 6280) so that the screen is not
erased when you are switching from one drawing to another. The
many REM statements should help you follow the flow of the
program.
In each of the three drawing programs, information is displayed
(lines 4000 to 4150) and then graphics are set (line 4210). The game
control inputs 0 and 1 are read (lines 4320, 4330) and plotted (line
4340). The keyboard is checked to see if a return to the main menu is
called for (line 4350). Pushbutton 0 is then checked to see if HCOLOR
needs changing (line 4400) and the subroutine is repeated. The other
two drawing routines are almost identical.

Variables
Variable Line Description
Cl 70 Picture elements in the Y axis
C2 70 Maximum game control reading
C3 70 Picture elements in the X axis
188 The Computer Controller Cookbook

Variable Line Description


C 80 Current value of HCOLOR
YN$ 90 Answer to YES/NO questions
D$ 90 Control D
A 130 Main Menu selection number
DN$ 2110 File name of drawing
X 4320 Current value of game control 0
Y 4330 Current value of game control I
BO 4350 Reading of pushbutton 0
K 4350 Reading of key that has been pressed
BI 6320 Reading of pushbutton I
XI 6360 Last reference value of X
YI 6360 Last reference value of Y

10 REM *********************** A DRAWING WILL DESTROY"


11 REM * 21114111 INPUT "THE DRAWING NOW IN M
12 REM * DRAWING PROGRAM EMORY. OK? (YIN) ";YN$
14 REM * FOR 21216111 IF LEFT$ (YN$, 1) = "N" THEN
16 REM * THE HOME-BUILT RETURN
18 REM * SKETCH PAD 21117 v) PRI NT
2121 REM * 211180 INPUT" CATALOG? (YIN)
22 REM * TOM RILEY COPYRIGHT 83 "; YN$
2090 IF LEFT$ (YN$,1) = "Y" THEN
24 REM * PRINT D$;"CATALOG"
26 REM ************************ 210/Z1 PRINT
2110 INPUT "DRAWING NAME? ";DN$
3121 REM
50 TEXT: HOME 2120 PRINT D$;"BLOAD ";DN$
70 C1 = 191:C2 = 255:C3 = 279 2130 RETURN
80 C = 3: HCOLOR= C 2999 END
9111 YN$ = "": D$ = CHR$ (4)
100 REM *** MAIN MENU REM *** SAVE DRAWING ON DI
110 GOSUS 9000: REM INTRODUCTIO SK
N 3/Z1 1111 HOME
120 GOSUS 8000: REM MAIN MENU 31112111 HTAB 7: PRINT "SAVE A DRAWl
125 YN$ = "" NG ON
130 .IF A = 1 THEN VTAS 22: INPUT 312140 VTAB 4: . INPUT" CATALOG
" ARE YOU SURE '? (YIN) "; YN$ ? (YIN) ";YN$
31115/Z1 IF YN$ = "Y" THEN PRINT D$
135 IF YN$ "Y" THEN HGR: TEXT ; "CATALOG"
31116/Z1 PRINT
14121 IF A 2 THEN GOSUB 21210121 31117111 INPUT "DRAWING NAME? ";DN$
150 IF A 3 THEN GOSUB 30121121
16121 IF A 4 THEN GOSUB 4121121111 31118111 PRINT
170 IF A 5 THEN GOSUB 500111 31119111 INPUT" I S THERE A DRAW I
18121 IF A 6 THEN GOSUS 6000 NG OF THAT NAME ON THIS DIS
19121 IF A 7 THEN HOME : END K ? (YIN) ";YN$
2121111 GOTO 12121 31121111 IF YN$ = "Y" THEN PRINT D$
21210121 REM ** GET A DRAWING FROM ; "DELETE ";DN$
DISI< 311111 PRINT D$;"BSAVE ";DN$;",A$2
212110 HOME :D$ = CHR$ (4) 0111121, L$201210 "
21212121 HTAS 7: PRINT "GETTING A DR 319111 RETURN
AWING FROM DISK" 39q9 END
21213121 VTAS 7: PRINT" GETTING 4121111111 REM *** CONTINUOUS POINT D
Software 189
RAWING 4520 IF /<" 178 THEN C 2: HCOLOR=
4010 TEXT : HOME C
411S2121
HTAB 5: PRINT "DRAWING BY C 4530 IF K 179 THEN C = 3: HCOLOR=
ONTINUOUS POINTS" C
4030 VTAB 5: PRINT" THE POINT 454121 IF K 180 THEN C 4: HCOLOR=
THE STYLUS IS ON WILL" C
PRINT "BE DRAWN REPEATEDLY. 455111 IF K 181 THEN C 5: HCOLOR-
C
4l!145 PRINT 456111 IF K 182 THEN C 6: HCOLOR=
412150 PRINT" THE ZERO (0) BUT C
TON WILL SHOW THE " 457121 IF /<" 183 THEN C 7: HCOLOR-
4060 PR I NT ", X' AND ' Y' C0121RD I NA C
TES AND HCOLOR." 458121 IF /<" 176 THEN C 121: HCOLOR=
4075 PRINT C
4080 PRINT" THE NUMBERS 0 TO 4999 RETURN
7 WILL SELECT" 5121121121 REM *** CONTINUOUS LINE D
4 1219 l!l PRINT "HCOLOR." RAWING
411195 PRINT 51111121 TEXT : HOME
410121 PRINT" THE ORIGIN IS THE 511115 PRINT
UPPER LEFT CORNER." 51112111 HTAB 7: PRINT "DRAWING BY C
4110 PRINT "FROM LEFT TO RIGHT I ONTINUOUS POINTS"
S X = 0 TO 279." VTAB 5: PRINT " THE POIN
412l!1 PRINT "FROM TOP TO BOTTOM 1" THE STYLUS IS ON WILL"
S Y = 121 TO 191." 5040 PRINT "BE USED AS THE END P
4125 PRINT OINT OF A LINE"
4140 PRINT" PRESS 'ESC' TO RE PRINT "DRAWN FROM THE LAST
TURN TO MAIN MENU." LINE'S END POINT."
4150 VTAB 23: INPUT" (PRESS R 51116121 PRINT
ETURN) " ; YN$ 51117l2l PRINT" THE ZERO (0) BUT
4155 HOME TON WILL DISPLAY"
4200 REM *** SETTING GRAPHICS 51218111 PRINT ", X,. AND ' Y' COORDINA
TES AND THE HCDLOR."
4210 POKE - 16297,0: POKE - 16 5 1119 12S PRINT
31210, 0: POKE - 16302, 0: POKE PRINT" PRESSING A NUMBE
- 16304,0 R l2l THROUGH 7 WILL"
4300 REM *** WATCHING PADDLE 511l2l PRINT "CHANGE HCOLOR TO THA
432tlJ X INT ( PDL (0) * C3 I C2 1" NUMBER."
) 51 PRINT
4330 Y INT PDL (1) * Cl I C2 513l2l PRINT" PRESSING THE 'ES
) C' KEY WILL RETURN"
4340 HPLOT X,Y 5140 PRINT "YOU TO THE MAIN MENU
4350 B0 = PEEK ( - 16287):K = PEEK
( - 16384): POKE - 16368,0 5190 VTAB 23: INPUT" (PRESS R
4361!l IF B0 > 127 OR K > 127 THEN ETURN TO CONTINUE) ";YN$
439lij 5195 HOME
4370 GOTO 4320 521210 REM *** SETTING GRAPHICS
4390 HOME 521111 POKE - 16297,0: POKE - 16
4400 IF B0 > 127 THEN POKE - 1 300,0: POKE - 16302,0: POKE
6301,121: VTAB 22: PRINT" X - 1631114,0
= ";X;" Y = ";Y;" HCOLOR = 530121 REM *** WATCHING PADDLE
";C: FOR I - 0 TO 1000: NEXT
I: POKE - 16302,0: GOTO 432 531121 REM *** X POT 0 , Y POT 1
o
4410 IF K - 155 THEN RETURN 5320 X INT PDL (0) * C3 I C2
442121 GOSUB 4500 )
4431') GOTO 432121 Y = INT PDL (1) * Cl I C2
45121121 REM *** CHECK HCOLOR )
4510 IF /<" - 177 THEN C = 1: HCOLOR= 5340 Xl = X:Yl = Y
C 53SQJ X = INT ( PDL (0) * C3 I C2
190 The Computer Controller Cookbook
) 6261il HOME
5360 Y INT ( PDl (1) * Cl / C2 6270 REM *** SETTING GRAPHICS
) 628fZl POKE - 16297,0: POKE - 16
5370 HPlOT X,Y TO Xl,Yl 300,0: POKE - 16302,0: POKE
Xl = X:Yl = Y - 163lZ14, lZl
5390 B0 = PEEK ( - 16287):K PEEK 6290 HOME
( - 16384): POKE - 16368,0 63v.llZl REM ** WATCHING PADDLES
54f!10 IF B0 > 127 OR K > 127 THEN 6:3;liI5. DD = IiI
542111 6311..ij X INT ( PDL (0) * C3 / C2
541i<:1 GOTO 5350 )
542.111 IF B0 > 127 THEN POKE - 1 6315 Y = INT PDl (1) * Cl / C2
63lill, IZI: VTAB 22: PRINT" X )
= ";X;" Y ";Y;" HCOlOR = 6320 BlZ! = PEEK ( 16287) : B1 PEEI<
"; C; " ". FOR I = 0 TO ( - 16286):K PEEK ( - 163
1000: NEXT I: POKE - 16302, 84): POKE - 16368,0
0: GOTO 5350 IF B0 > 127 OR Bl > 127 OR
543!Z1 IF K = 155 THEN RETURN K > 127 THEN 6350
5440 GOSUB 4500 634lil GOTO 6310
551!Z1 601'0 5351il 635lil IF B0 > 127 THEN POKE - 1
5999 END 6301,0: VTAB 22: PRINT X II

6Qll!.llZl REM *** REFERENCE POINT II = ";X;" Y = ";Y;" HCOlOR =


NES " ; C; " ". FOR I = lZl TO 1
Mll1Z1 TEXT : HOME 000: NEXT I: POKE - 16302,0
6lZ13 lZl HTAB 7: PRINT "DRAWING BY R : GOTO 6310
EFERENCE POINTS" 6360 IF Bl > 127 AND DD = o THEN
VTAB 3: PRINT" THE STYl Xl = X:Yl = Y:DD = 1: HPlOT
US AND PADDLE BUTTONS" X,Y: VTAB 23: PRINT" REF P
PRINT "ARE USED TO FIND REF OINT 1 SELECTED": FOR I = 121 TO
ERENCE POINTS AND" 500: NEXT I: GOTO 6380
PRINT "THEN DRAW lINES BETW 6370 IF 81 > 127 AND DO = 1 THEN
EEN THEM." HPlOT Xl,Yl TO X,Y:DD = 0: FOR
6l117fZl PRINT I = 0 TO 500: NEXT I: HOME
6 1118fZl PRINT" THE ZERO (0) BUT 6380 IF K = 155 THEN RETURN
TON DISPLAYS " 639lZ1 GOSUB 451110
6 lZl9111 PRINT "THE' X' AND ,. Y' COOR 64lil0 IF K = 195 THEN DD = 0: HOME
DINATES AND HCOlOR." : HCOlOR= 0: HPlOT Xl,Yl: HCOLOR=
61Q@ PRINT C
611111 PRINT" THE ONE (1) BUTT 6411il GOTO 631121
ON WIll FIX THE" 6999 END
612111 PRINT "STYLUS L.OCATION AS A 80fZl0 REM *** MAIN MENU
REFERENCE POINT." Ellillli! TEXT : HOME
61:511' PRINT "WHEN A SECOND REFERE 8020 HTAB 14: PRINT "MAIN MENU"
NeE POINT IS CHOSEN" EHil3lZ1 VTAB 5
6140 PRINT "A lINE IS DRAWN BETW 8l!!4Iil HTAB 8: PRINT "(1) HI
EEN THEM." -RES SCREEN"
6151!! PRINT 8045 PRINT
6161!! PRINT" PRESSING KEY 'c' HTAB 8: PRINT "(2) GET DRAW
CLEARS THE" ING FROM DISK"
617lZ1 PRINT "REFERENCE POINTS." 8lZl55 PRINT
6181i' PRINT 806l!.1 HTAB 8: PRINT "(3) PUT DRAW
6190 PRINT" PRESSING·A NUMBE ING ON DISK"
R BETWEEN 0 AND 7" 8lZl65 PRINT
621?llZl PRINT "SELECTS HCOlOR." 807lil HTAB 8: PRINT "(4) DRAW CON
6211il PRINT TINUOUS POINTS"
623lZ1 PRINT" PRESSING 'ESC' R 8075 PRINT
ETURNS YOU TO" 8081') HTAB 8: PRINT "(5) DRAW CON
624i<:1 PRINT "THE MAIN MENU." TINUOUS lINES"
625fZJ VTAB 23: INPUT " PRE 8085 PRINT
SS RETURN) ";YN$ 809111 HTAB 8: PRINT "(6) DRAW REF
Software 191

ERENCE POINT LINES" EITHER THE SKETCH"


8QS95 PRINT 9070 PRINT "PAD OR ANY DOUBLE PO
811i!!11HTAB 8: PRINT " (7) QUIT " l' PADDLE."
81Hl
,..,,..,. INPUT " CHOOSE A
VTAB .,;.,..:... 9Ql80 PRINT
NUMBER : II; A 9090 PRINT " THE MAIN MENU WI
81211S IF A < Ql OR A :::- 7 THEN 601'0 LL LET YOU CHOOSE"
8110 9100 PRINT "TO DRAW IN SEVERAL D
813QI RETURN IFFERENT WAYS OR"
8999 END 9110 PRINT "MOVE DRAWINGS ON OR
9Ql0Ql REM INTRODUCTION OFF THE DISK. "
Ql
***
VTAB 1 : HTAB 1 J1l: PRINT "SKE 912Ql PRINT
TCHING PROGRAM" 9130 PRINT " WITH A LITTLE PR
91112Ql HTAB 16: PRINT "FOR" ACTICE YOU WILL"
9QI30 HTAB 8: PRINT "HOME-BUILT S 9140 PRINT "SOON CHOOSE WHICH WA
KETCH PAD" Y YOU LIKE BEST."
904111 VTAB 5: PRINT " THIS PRO 919J1l VTAB 23: INPUT " ( PRESS TH
GRAM WAS PREPARED FOR USE" E RETURN TO CONTINUE ) "
9 Q15J1l PRINT "WITH THE HOME-BUILT ;YN$
SKETCH PAD." 9195 RETURN
90Ml PRINT "IT MAY BE USED WITH 9999 END
192 The Computer Controller Cookbook

DIGITIZING
With this program you can enter data from charts and graphs directly
into your computer with the Sketch Pad. The use of the program is
explained in detail in chapter 4, along with the information on
building the Sketch Pad.

Step by Step Through the


Listing
An array is first dimensioned to hold the data in memory (line 30). The
input is limited to 41 pages with 16 data points per page, but these
limits may be changed depending on available memory. The disk file
name is requested (lines 100 to 150): if the file is old the disk is read
(lines 200 to 285) and an End of File marker is sought (line 285).
An adjustment procedure is run (lines 300 to 400) for moving the
height of the upright and locating the correct position for the charts on
the drawing board. The game control inputs are read and displayed
(lines 400 to 490) to aid in these adjustments.
The units and limits for each axis are entered (lines 500 to 690) and
scaling constants calculated (lines 660 to 690). Data taking is then
begun (lines 800 to 1260), information is given (lines 810 to 830), and
the format is displayed (lines 870 to 930). The game control inputs are
again read and displayed (lines 1000 to 1058). If pushbutton 0 has been
pressed, the data point is recorded and the index increased by 1 (line
1060). There is a short delay (line 1065). If pushbutton 1 has been
pressed, execution is directed to the new sheet section (lines 1200 to
1260). If not, execution is directed back to read a new point (line 1100).
The new sheet section zeros all unused points on the current sheet
(lines 1205 to 1208) and adjusts the indexes (lines 1210, 1220). If
another sheet is requested (line 1250), execution returns to data taking
(line 1260). If no new sheet is requested, the file-to-disk storage function
is entered automatically (lines 1300 to 1520). If you want to know the
structure of the disk file, it can most readily be seen from the disk
storage routine (lines 1420 to 1510). The disk file structure can be
adjusted to suit your needs.
Software 193

Variables
Variable Line Description
PT% 30 An integer array of the data point
readings
D$ 50 Control D
PTN 60 The number of the point
SN 60 The number of the sheet
F$ 140 The name of the disk file for the data
YN$ 160 The answer to YES/NO questions
Q$ 180 A second YES/NO answer
UX$ 232 Units of the X axis
UY$ 232 U ni ts of the Y axis
XOV 234 Value of the 0 point on the X axis
XMV 234 Value of the 255 point on the X axis
YOV 234 Value of the 0 point on the Y axis
YMV 234 Value of the 255 point on the Y axis
EOF$ 270 End of File marker
X 410 Reading of game control 0
POB 440 Reading of pushbutton 0
Y 460 Reading of game control 1
AX 660 Conversion ratio for X axis
AY 680 Conversion ratio for Y axis
XV 1020 Current value of X
YV 1055 Current value of Y

1111 REM *********************** 14121 INPUT "NAME OF FILE? "; F$


12 REM 15121 PRINT
14 REM
** DIGITI ZER 16li.l INPUT" IS THIS A NEW FILE?
16 REM (Y OR N) ";YN$
18 REM •
* TOM RILEY CoPYRRIGHT 8 In) PRINT
3 IF YN$ = "Y" THEN GoTO 300
2121 REM * 18121 INPUT" IS DISK WITH THIS FIL
REM *********************** E IN THE DRIVE? ";Q$
REM 185 PRINT
DIM PT% (4121, 2,15) 190 IF Q$ = "N" THEN PRINT "PUT
REM ** LIMITS: 41 PAGES WITH THE CORRECT DISK INTO THE D
16 DATA POINTS PER PAGE RIVE. ": GoTO 170
5121 D$ = CHR$ (4) 200 REM ** READING FILE FROM DI
60 PTN = 1 :SN = 121 SK
llMl REM *** NAME OF FILE 210 PRINT D$;"oPEN ";F$
110 HOME 22121 PRINT D$; "READ ";F$
120 PRINT " DIGITIZING WITH SK 230 INPUT SI\!
ETCH PAD" 232 INPUT UX$: INPUT UY$
139.1 PRINT : PRINT 234 INPUT X0V,XMV,Y0V,YMV
194 The Computer Controller Cookbook
2 -r .,· FOR R 121 TO SN 65!!1 PRINT
24Ql FOR S 0 TO 1 66!!1 AX (XMV - X0V) / 255
245 FOR T 121 TO 15 670 AX =: INT (AX 1V.l!!llZI) / 10!!lal
25121 INPUT PTt. (R. S. T> 68121 AY (VMV - vr;.!V* ) / 255
26121 NEXT: NEXT' :'NEXT 69lZI AV INT (AY 1v.llZllZl) / l1ZIIZ10
270 INPUT EOF$ 8all21 REM
*** TAKE * DATA
28121 PRINT D$;"CLOSE ";F$ 81121 HOME
285 IF EOF$ < > "EOF" THEN PRINT 82121 PRINT "PRESS PB!!1 TO TAKE DAT
"FILE READING ERROR ": END A"
30121 REM *** ADJUST SKETCH PAD 83QI PRINT "PRESS PBl T8 START NE
31121 HOME W SHEET"
320 PRINT" ADJUST SKETCH PAD" 87Ql PRINT
PRINT "SHEET NUMBER ";SN
330 PRINT PRINT 877 PRINT
340 PRINT " USE THE X AND Y 88Ql PRINT" X V";
READINGS BELOW" 885 HTAB 2121: PRINT "X-";UX$;: HTAB
35121 PRINT "TO ADJUST THE LOCATIO 3121: PRINT "V-"; UY$
N OF THE SHEET" 89!!1 PRINT
36121 PRINT "AND THE HEIGHT OF THE 90QI FOR N = 1 TO 15
UPRIGHT." 91121 PRI NT " PT "; N; " 121"
37121 PRINT 92!Z' NEXT N
38!21 PRINT " PRESS PB0 TO CON 93QI VTAB 24: PRINT " X
TINUE." Y = II;
39!ZI VTAB 16: PRINT " X = 10!210 REM * READ PADDLES
Y =" 11211111 X = PDL (121)
400 REM * READ PADDLES l1Z12!ZI XV AX * X + X0V
41121 X = PDL (v.l) 112125 XV = INT (XV * 1000) / 1000
420 VTAB 16: HTAB 10: PRINT "
" .• 1030 P0B = PEEK ( - 16287)
43i!1 HTAB 10: PRINT X 1040 PIB = PEEK ( - 16286)
44!!1 P0B PEEK ( - 16287) H14::j VTAB 24: HTAB 1121: PRINT "
451Z1
46!11
IF P0B :> 127 THEN GOTo 500 " .•
Y = PDL (1) 112147 HTAB 10: PRINT X;
47v.l VTAB 16: HTAB 2!!1: PRINT " 11215!ZI V = PDL (1)
" .• 1!!155 VV AY * V + V0V
48121 HTAB 2!!1: PRINT Y 112156 YV = INT (VV * 1000)
49!!1 GOTo 41121
50Ql
51!!1
REM
HOME **
SCALE INFORMATION 112157
111158
HTAB 21!l: PRINT " "• .
HTAB 20: PRINT V;
PRINT "SCALING INFORMATION " 11216121 IF P0B :> 127 THEN PTX(SN,0,
PTN) = X:PTt.(SN.l.PTN) = V: VTAB
53121 PRINT (7 + PTN): HTAB 10: PRINT X;
540 INPUT "UNITS OF X AXIS ? II; U : HTAB 14: PRINT V;: HTAB 20
X$ : PRINT XV;: HTAB 30: PRINT
55w.1 PRINT VV:PTN = PTN + 1
56Ql INPUT "VALUE FOR X=0 ? ";X0V 112165 FOR N = 1 TO 200: NEXT
HI7lZI IF P1S :> 127 OR PTN > 15 THEN
57!!1 INPUT "VALUE FOR X MAX. ? ".• GOTO 121210
XMV 11!!112' GOTO 1121!!10
58121 IF X121V = XMV THEN GoTo 55121 12121121 REM ** NEW SHEET
59!!1 PRINT 121213 IF PTN:> 15 THEN GOTo 1
6!110 INPUT "UNITS FOR Y AXIS ? ".• 2Hl
UY$ 121215 FOR N = PTN TO 15
610 PRINT 121217 PTt.(SN,0.N) = 0:PTt.(SN,1.N)
62121 INPUT "VALUE FOR Y=0 ? ";Y0V o
121218 NEXT
63121 INPUT "VALUE FOR V MAX. ? "; 1210 SN = SN + 1
YMV 122121 PTN = 1
640 IF Y0V = YMV THEN GoTO 610 124121 PRINT" ". VTAB 23
Software 195

125121 INPUT "ANOTHER SHEET ? (Y 0 141210 IF YN$ = liN THEN PRINT D$


II

R N) ";YN$ ; "DELETE "; F$


126121 IF YN$ = "VII GOTO 81110 141111 PRINT
131Z1l11 REM SAVE FILE TO DISK 142121 PRINT D$;"OPEN ";F$
131121 HOME ** 143121 PRINT D$; "WRITE ";F$
132121 PRINT " SAVE FILE TO DIS 144121 PRINT SN
1444 PRINT UX$: PRINT UY$
133121 PRINT 1446 PRINT XQIV: PRINT XMV: PRINT
1340 INPUT "IS STORAGE DISK IN l' Yl1IV: PRINT YMV
HE DRIVE ? ";YN$ 145111 FOR R 121 TO SN
135121 PRINT 146111 FOR S = l11 TO 1
136111 IF YN$ = IIN THEN PRINT "P
II
147121 FOR l' = 111 TO 15
LACE THE STORAGE DISI< IN THE 14BQl PRINT PTI. (R, S, 1')
DRIVE. ". GOTO 1330 149121 NEXT : NEXT : NEXT
137121 PRINT 15QIQI PRINT "EOF"
138121 INPUT " IS THIS A NEW FILE 0 151121 PRINT D$;"CLOSE "; F$
N THIS DISI< ? "; YN$ 152121 GOTO 60
139111 PRINT 9999 END
196 The Computer Controller Cookbook

ANNUNCIATOR TEST
With the Annunciator Test program you can test new controllers that
use the Apple's four annunciator outputs (pins 13, 14, 15, 16) or the
strobe (pin 5). One such device is the Computer Controlled AC Outlet,
described in chapter 12. The test program turns these outputs on and
off at a slow, steady pace and shows their status on the screen. You can
then compare the output of your new controller with the status of the
computer's output.

Step by Step Through the


Listing
Execution is first directed (line 15) to the start up subroutine (lines 500
to 590), which displays the format on the screen. Each annunciator in
turn is switched off, with a pause between each step (lines 20 to 85).
They are turned on again in sequence, and the keyboard bell is
sounded (lines 100 to 170) to indicate that a sequence is complete.
The strobe is pulsed and a count kept of the total number of pulses
(lines 180 to 190). The en tire process is then repeated in an endless loop
(line 200).

Variables
Variable Line Description
z 180 Dummy variable for pulsing strobe
SC 185 Count of total strobe pulses
BEL$ 515 Control G, which rings bell
Software 197

REM ************************ 145 VTAB 12: HTAB 18: PRINT "ON


2 REM * ";BEL$
.,. BOSUB l1Zl01Z1
._' REM * ANNUNCIATOR 15QI
4 REM * 16111 POKE - 16289, 111
5 REl"l * TOM RILEY COPYRIGHT 83 165 VTAB 14: HTAB 18: PRINT "ON
6 REl"l * ";BEL$
7 REM ************************ 17lil GOSUB llZllZllZl
8 REM 18121 Z = PEEK ( - 16320)
15 GOSUB 5lZHil
_. 16296,1 185 se = se + 1
2111 POKE 19121 VTAB 16: HTAB 21: PRINT SC
25 VTAB 8: HTAB 18: PRINT "OFF" 212HZI GOTO 2 IiI
3!!1 BOSUB lliHZl!!1 5lill2l REM *** START UP
4 IiI POKE - 16294,1 51111 TEXT : HOME
45 VTAB HI: HTAB 18: PRINT "OFF" 515 SC = IZl:BEL$ = CHR$ (7): REM
CONTROL G - BELL
5lil GOSUB llillZllZl VTAB 4: HTAB 8: PRINT "ANNUN
6QI POKE - 16292,1 CIATIOR TEST"
65 VTAB 1". HTAB 18: PRINT "OFF"
.<.0. 53Ql VTAB 8: HTAB llZl: PRINT "ANIZI
IS "
7111 BOSUB 1IiI QI IZI 54QI VTAB 10: HTAB 10: PRINT "ANl
8lil POKE - 1629121,1 IS "
85 VTAB 14: HTAB 18: PRINT "OFF" 550 VTAB 12: HTAB 10: PRINT "AN2
IS "
9121 BOSUB 11il01Zl 56121 VTAB 14: HTAB lQl: PRINT "AN3
101Zl POKE - 16295,0 IS "
11215 VTAB 8: HTAB 18: PRINT "ON " 57lil VTAB 16: HTAB 5: PRINT "STRO
;BEL$ BE COUNT IS "
11 fi'l BOSUB 1121121121 591il RETURN
121Zl POKE - 16293,1Zl llillillZl REM ·Mo** DELAY
125 VTAB 10: HTAB 18: PRINT "ON HJHI FOR I = 1 TO 41Zl0
";BEL$ 11212121 NEXT I
13lij BOSUB 11Z1lZHZl llil:':;!!l RETURN
141Zl POKE - 16291,1Zl 9999 END
L_ __ _ _

You might also like