Tuesday, January 1, 2013

CoCo Rotary Controller

In the early days of video games, there was a lot of variety in game controllers.  While plenty of games just used a joystick and a button or two, a number of games in the arcades had more interesting control mechanisms.  The Lunar Lander thrust controller, the Centipede trackball, the Battlezone dual control sticks, and the Star Wars flight yoke all come to mind as examples of how the controller itself can be a part of the overall gaming experience.  But for my money, few controllers matched their games as well as the rotary controller did for Tempest.


Inspiration

Tempest was a great game -- so much so, that Atari had it remade as Tempest 2000 and released for the Jaguar back in the early 90's.  Tempest 2000 works perfectly well with the D-pad, but it turns-out that Jeff Minter also added support to Tempest 2000 for rotary controllers.  The problem, of course, is that Atari never made such a controller...

I knew about the rotary controller support in Tempest 2000 when I bought it off the shelf 'back in the day'.  I had always intended to build such a controller, but only recently got around to doing that -- more on that in some later post!  Anyway, as part of that journey I ended-up with a few random extra parts.  In particular, I had an extra rotary encoder.

Making Something Beautiful

From an electrical standpoint, joysticks and most other controllers are fairly simple.  The real problem isn't wiring them, it is building something to hold those buttons, sticks, or whatever in a form that makes them usable.  Often the simplest solution is to repurpose something designed to do a similar job into something that works more as one wishes.


The original TRS-80 joysticks that Tandy offered for use with the CoCo were awkward and are generally unloved.  The best I can say about them is that they seem a bit less poorly designed than the ones made for the Dragon or the BBC Micro. :-)  Nevertheless, they do offer a plastic shell with some rudimentary ergonomics, an available button, accommodations for wiring, and a pre-drilled hole ready for mounting the shaft of a rotary encoder.

At some point, an idea became obvious -- take the guts out of an old CoCo joystick and turn it into a rotary controller!

Getting It To Work

The procedure was relatively simple.  First, disconnect the wires from the joystick gimbal and remove it from the housing.  Next, mount the rotary encoder in the now vacant hole in the housing.  Once the wiring is complete (see below), then install a knob that suits your tastes.  That completes the mechanical installation!




For the wiring, solder a 10k resistor to each of the signal outputs from the encoder.  Tie the other ends of those resistors to the +5V line from the CoCo.  The common input on the encoder gets tied to Ground from the CoCo, as does one of the button terminals.  The other button terminal connects to the button line from the CoCo, as expected.  The X and Y lines from the CoCo are each tied directly to one of the signal outputs from the encoder.  The connections are made so that in operation the X and Y lines alternate between +5V and Ground.  Turning the encoder clockwise will cause (X,Y) to follow the sequence of (0,0) -> (0,5) -> (5,5) -> (5,0).  Likewise, turning counter-clockwise will change the sequence to (0,0) -> (5,0) -> (5,5) -> (0,5).


Hopefully that description is clear?  The circuit really is simple.  I'll try to find some time to draw-up a little schematic to post.  If I don't manage to do so and you want to build one, feel free to contact me if you can't figure-out the schematic. :-)



In any case, building the hardware is only the first step.  This controller works a bit differently than the existing joysticks.  Consequently, there is no software to make any sense of it.  So, starting to figure that out will be the next step.  As always, be sure to stay tuned!

5 comments:

  1. If your encoder is a "pushbutton" type (that is, you can push on the shaft to close a switch), you could hook that up to the second button (or even the primary, if you application needed it).

    ReplyDelete
    Replies
    1. Yes, that is definitely true. In fact, the Jaguar controller I built uses that feature.

      The CoCo joystick I'm cannibalizing only had one button, so I would have to replace the cable (or at least add a wire) to use the extra button. Plus, only the CoCo3 supports the 2nd button anyway. So for now, I'm going to stick with one button unless I just have to have a 2nd button for some awesome game idea... :-)

      Delete
  2. John, where did you get your rotary encoder?

    ReplyDelete
    Replies
    1. Sorry for the delay -- I was doing some research!

      I got the one I am using now from eBay. This listing looks like the same thing as far as I remember, but it has been a while...

      http://www.ebay.com/itm/12mm-Rotary-Encoder-Switch-Flat-Top-Knob-NEW-/330769509111

      You may want to look around -- I think that vendor runs multiple listings with different prices/policies/etc.

      One problem with the one I am using now is that it has detents. This gives you a little "clicky" feedback as you rotate it. I actually like the feel of it, but I think the detents may contribute to more mechanical bounce -- YMMV!

      For the Jaguar controller I built, I used a Bourns 652-PEC11-4020F-S024, which you can find at Mouser, Allied, etc. It doesn't fit the hole as well, so it might need a bigger washer or something.

      Delete
    2. Just a follow-up, I was able to cut a little piece of perfboard to use for mounting the Bourns encoder. The holes don't really line-up, but I was able to make new holes or enlarge existing ones to mount the board using the screws that had been used to mount the joystick gimbal.

      If you go this route, you probably want the 25mm shaft length. Also, you don't need the built-in momentary switch (although you might could use that on a CoCo3 for the 2nd joystick button). So, you might use the PEC11-4025F-N024 part number instead...YMMV!

      Delete