Analog Joypad for your Retro PC

Part of the fun with old computers is playing some old school games, and while you could play them with a keyboard it is much more fun with a joystick. You can get old joysticks all day long on auction sites, but you have to watch out. Some are digital, which wont work for many games on many systems. Some were cheap to begin with and probably worn out, and many are flight sticks … ever play pac-man with a giant flight stick?

What I really wanted was a game pad like device for my 1986 Apple //c , using one of the modern thumbstick analog controllers. Using a thumbstick out of an old XBOX(1) controller, some generic parts from Radio Shack, and a little bit of effort , I ended up with exactly what I wanted.

Join us after the break and I will show you how to get there!

First some basics, most computers that have analog controllers implement it in a pretty simple method. In a nutshell there is a 555 timer wired up for single shot mode, the computer triggers the 555 and counts how many cycles pass before the 555’s output changes. One of the potentiometers inside the joystick is hooked up to this circuit and controls the rate that a capacitor charges. Once filled the 555 changes output. Swing the joystick one way, resistance increases and the capacitor takes longer to charge. Swing it the other way resistance lowers, cap charges faster. Simple right?

Now just multiply 555’s for how many axis you need and you have a simple analog joystick. Apple //s, and IBMs work like this, and use a 556 dual timer (one, two axis joystick) or a 558 quad timer (two, two axis joysticks). Below is an example circuit from the Apple //c Technical Reference Manual.

Other computers like the 8 bit Commodore’s and Atari’s used this setup for their paddle controllers which were often in joystick or flightstick format. About the only one I know of that does not handle analog joysticks in this manner is the Tandy TRS series, but I am sure there are others. Check with your computers nerd club before proceeding.

Next thing to consider is the values of the potentiometers inside of your joystick. the most standard value for old computers is 100K ohm. Apple used 150K ohm. Why? I don’t know but with Apple stuff, if its hard to source, they will use it. Thumbsticks themselves come in all varieties of resistance, from places like Digikey. If you don’t mind spending a couple bucks + postage, that might be the best way for you.

Since I am using scavenged thumbstick from an XBOX controller I don’t have a choice of what value it is. The thumbsticks that come stock with that controller is 10K ohm. In order to compensate for the difference in resistance,we just need to add more capacitance.

Before I go bothering myself with math, I need to find out exactly where my joystick “tops out” while its in its enclosure. I went out an purchased a 4x2x1 inch enclosure from Radio Shack, and while I was there I also picked up a couple panel mount normally open pushbutton switches.

With these radio shack project boxes, they give 2 choices of a lid, a nice molded plastic lid that sits on top of the box, and an aluminum panel that sits a bit recessed in the box. I just had to have that aluminium panel for looks, but it ended up causing a bunch of problems.

First I had to cut the lip of the box off where the panel would not be recessed anymore. That was accomplished using some 90 degree flush cut wire trimmers and a file. Because I lost about a quarter of an inch in height, the thumbstick would not fit anymore using the screw mounts inside the box. I had to snap off the screw mounts, then flatten the area where they broke off with a chisel. Then I surface mounted everything to a piece of pad-per-hole perfboard flipped upside down, since the only way the thumbstick would fit is if the board was flat against the bottom.

With all of that sorted out, I went to drill holes into the aluminum panel. I drew the outline of the panel on some paper, and I was measuring everything out. I didn’t like how the holes were sitting, so in the end I just simply eyeballed them on paper. Then I taped the paper to the aluminum plate and made divots for the hole centers with a hammer and nail.

The aluminum plate was then screwed to a scrap chunk of 2×4 wood, and drilled. I used a 1 inch hole saw for the joystick (which is a bit too large) and quarter inch holes for the switches. I used a jewelers file to quickly deburr the holes, but the large joystick hole was still a little rough. To give a more finished appearance I decided that it needed a grommet.

I went to the local hardware store, and when I asked for a grommet with about a 1 inch inside diameter, they looked at me like I just stabbed a baby. I ended up at Lowes where I found a grommet in one of the “hard to find” bins in the screw section with a 1&1/8th outside diameter, and a 23/32nds inch (18.25 ish mm) inside diameter, which is good enough. The grommet was much too tall to fit both inside and outside of the box, so I just simply chopped its top off and glued it down with some goop (super strong and thick glue).

Now that the box is in order I can see where my thumbstick tops out at. I bent the leads of the thumbstick out to a 90 degree angle so I could surface mount them to the perfboard. Then I soldered it down and added some test leads, ran the wires out of a hole I drilled in the back of the box for the joysticks cable, and popped on the lid.

Using a multimeter I found out that it the furthest I could push the thumbstick came out to about 8.5K ohm on both axis. My meter is overkill for most of what I do, so I could have used the 5 digits of accuracy, but its not needed. I will add some trimpots later for fine tuning.

Now that I know 8.5K is my max resistance, its time to figure out how much capacitance I need to add so that the circuit internal to the computer will behave the same with this 10K pot as it did with a 150K. The formula to calculate the capacitance is pretty simple:

((original_potentiometer_value * internal_timing_capacitor) / new_potentiometer_value) – internal_timing_capacitor

Most of the time the internal timing capacitor is 0.022 uf, though you might want to check before assuming for your machine. The original potentiometer value of the Apple // is 150K ohm so…

((150,000 * 0.022) / 8500) – 0.022 = 0.366235294

Therefore we need to add about 0.36uf in parallel to the joystick so that a 10K pot works the same as a 150K pot in the timing circuit. My capacitor selection pretty much stinks so I ended up using 3, 0.1uf capacitors in parallel and 2, 0.1uf in series per axis, giving me about 0.35uf. It does not have to be exact because I also added a 10K trimpot in series with the capacitors which will allow me to control how fast the extra caps charge, giving a fine tuning mechanism. Below you will see the schematic I ended up with for my Apple //c.

Now it is just a matter of wiring everything up, connecting buttons and a cable, and then using a test program to calibrate the thumbstick. The Apple //c has a nice diagnostic program which also test’s joysticks, but you could just as easily write one up in basic. For example, in Applesoft:

10 X=PDL(0): FOR I=1 TO 10: NEXT: Y=PDL(1)
20 PRINT X " " Y " " PEEK(49249) , PEEK (49250)
30 GOTO 10

To calibrate I just need to adjust the trimpots until its about center, the program above shows value from 0-255, and we can give ourselves about 5% in error, from there its just a matter of making sure the thumbstick maxes the readouts when in its most extreme up/down/left/right positions. Some error is ok, and a little jitteryness in center is fine as well.

Anyone who has programmed for analog controllers quickly figure out a little dead space for middle and a little room for error on the extremes is needed whether it be a 26+ year old computer, or a brand new Sony PSP, nothing is 100% perfect.

Once the thumbstick is calibrated to the computer its time to button it up and play some retro games. How well does it work? Pretty darn good, I may go back and drill a couple small holes so I can fiddle with the trimpots without having to take it apart, but other than that it plays good and looks nice (IMO) .

Thanks for reading!

(Reference: The Computer Controller Cookbook)

Comments

  1. MarkyB86 says:

    looks good. I am impressed

  2. Skitchin says:

    Looks sweet! I wonder if you could fit an xbox joystick in an nes controller, or use NES buttons in your controller. Great post

    • Gdogg says:

      You can. It’s been done and it’s been on hackaday. The N64, however uses a digital, quadrature encoded signal, so you’ll need a microcontroller to read the POT voltage and convert them to the expected quadrature signal.

  3. praetor says:

    can this be modfied for Pan/tilt motion(with existing components and build)
    for motorized video camera base?

  4. I’ve used those boxes with aluminum tops (bottoms) before and had the same issue. Why didn’t you just add some washers under it to raise it up, instead of filing the sides down?

    • Kevin Dady says:

      the plate is not thick enough to support any pressure (like mashing buttons) so when I added washers it would flex in the middle.

      the box has some ribs on the sides which are meant to hold boards, and as a bonus they support the mid section of the metal plate preventing flex

      • Ah, ok, that makes sense. I didn’t think about the button mashing pressure. And in thinking more about it, you really couldn’t add anything to the underside that would have been as quick and cheap as you did.

      • Smokey Behr says:

        You could have scrounged or (heaven forbid) bought some thicker material that would have been able to stand up to the stresses of button mashing, and would have been more flush with the lip on the box.

        An alternative would have been to use the plate as the bottom and make all your holes in the plastic opposite the plate.

  5. Steven says:

    Wish I still had the one I made for my C64. Back in ’86.

    But then I wish I still had my C64.

  6. derpdeedoo says:

    cool project but those buttons/switches have got to go!

    i like the other posters idea of reusing the NES or SNES controller buttons, or maybe even happs micro switches if theyd fit in that shallow depth. they seem much more suited for the task, and of course give you that familiar feel.

    thanks for the detail of your build.

  7. BLuRry says:

    That is awesome! I guess it wouldn’t be too difficult to make a 4-way joypad with a handful of resistors, eh?

    Disclaimer: I’m a big Apple // enthusiast and an author of an Apple //e emulator.

  8. The Timmy says:

    neat stuff! and a few things I didn’t know about how the older computers read the analog joysticks… gives me an idea for something later.

    I have a question though on the thumbstick– why surface mount it to the board instead of going through-hole?

    all in all, great build. looks ready for some industrial hard core gaming. and bonus points for using panel mount!

    • Kevin Dady says:

      cause of the tight space inside the box once I removed the extra plastic, the tiny bit of junk sticking out of the bottom for a though hole board would have made the stick rub against the top, causing the stick to stick

  9. Hirudinea says:

    Really nice work, you have a bright future ahead of you in the computer industry thirty years ago. By the way what’s the name of that game you were playing, I remember playing it on the 64 when I was a kid. (Better sound on the 64 too.)

    • Beef says:

      well ya know the II had a shift register for a video card, and 1 single cpu register for sound, so yea your PORT of choplifter may have had better sound, it took a real hacker to make it first on the II

  10. WRT the 150K pots used by Apple, they used to be quite common, and were stocked in HP’s lab stock, which provided many of the parts in the Apple I and Apple II, like the 50-pin expansion connectors. ;-)

  11. BLuRry says:

    It would make sense that Woz used parts readily available @ HP. :-D

  12. Nutrino says:

    Can anyone point me to a cheap source for thumbsticks?

    For whatever reason, the joysticks (that I can find) on digikey start at 60 bucks and climb past 100 bucks, despite them looking like $2 parts.

    ebay? (but what are they called…)?

    These guys are selling something I’m going to use as a proof of concept, but on my final project I’d like to use a thumbstick part without their ckt board:

    http://www.trossenrobotics.com/store/p/6340-Electronic-Brick-Playstation2-Analog-Joystick.aspx

  13. Jimmy says:

    Nice. I wonder if this would work on the Sega Master System, since some rare “paddle” controllers were released for that. I may be wrong but I believe the paddle controllers used a potentiometer to control Arkanoid/Woody Pop more precisely (1:1 control over position).

  14. gilles says:

    Very nice hack. I have a similar project with a wii nunchuk for my apple //c ;)

  15. Presence says:

    I want one of these with USB to play retro classics in emulators…

  16. Greenaum says:

    You can get an entire ZX Spectrum keyboard (well, the whole computer, which was in the keyboard, obv), with USB out for plugging into emulators. I dunno if anyone bothered to do it with other 8-bits, but it wouldn’t be difficult.

    Bonus points for connecting the Atari-style joystick ports on the 8-bits up to USB too, so you can have 2 sticks and a keyboard for your emulating needs! Once you have that, I suppose just stick a Raspberry Pi in it, and you can have an entire computer in there, emulating itself!

  17. Robot says:

    Oh WOW blast from the past. I loved that game.

  18. Zenith says:

    Would it be possible to use the Parallax 2-Axis Joystick instead of the Xbox controller?

    http://www.parallax.com/tabid/768/ProductID/581/Default.aspx

    I’ve been experimenting with it on my Arduino, and so far it’s working!

  19. no name says:

    perfect article!!

  20. taiwan apple & mac collector says:

    I create it one. but I use 250-300K trim pot. it is pretty for work in my apple II. thank for this article. it make me learn more. although my english is so terrible. but I find dictionary and finally create it. hope we can interact more.

    • I create it as the same one. but I acquire it from new usb gamepad but it will be a little problem. I play karateka can’t run to enemy. but another stuff that I acquire it from second hand store. this one is no problem. maybe I need to investigate. anyway, I appreciate author can provide this article.

  21. I have done again. this time I used 16 capacitors for x axis. 16 capacitor for y axis. it is no essential to add any trim pots and calibrate. x and y axis can to be center. it will work perfect. karateka can run to enemy. no matter what old style and new style from new gamepad or old one. it is no problem. this is my investigate result. hope can provide everyone consider.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,826 other followers