You know when you’re having that long-overdue clean-out and you find a few things stashed away you’d forgotten about? From when you said “that’ll make a great project one day” then tossed it in your equivalent of the bargain bin? Just happened to me.
A few years ago, I got a great Atari 2600 VCS job lot. Two consoles (a light-sixer and a Vader – now both composite modded) and a stack of games. Out of all the games only one appeared to be beyond repair. That cartridge, Activision’s F-14 Tomcat, was duly placed in the bits and bobs box until a project came to light for it.
Almost simultaneously, I came across the cart and a couple of 9-pin sub-D joystick ports. The brain, it ticked. And tocked. And finally came up with a Raspberry Pi Zero. Of course, an Atari 2600 in a cartridge! Why not? Why? Who cares.
Before I did anything else, I prototyped the build on a Raspberry Pi 2 and a breadboard. My requirements were:
- Inputs for two joysticks
- A power button
- A method for shutting the Pi down cleanly
- The TV colour switch
- The difficulty switches for both players
- Select and reset
- Some method of access to the console
Thankfully, the newer Pis have enough GPIO inputs to handle all this.
The Atari emulation itself is very straightforward. I decided to use the excellent RetroPie operating system as it handles all the game selection menus for you. I would then use Stella for the actual emulation of the Atari 2600.
The trick now was how to couple-up the joysticks and buttons to the emulator. The easiest approach is to trigger keypresses and map the emulator to them. After some research and a few false-starts, I settled on Adafruit’s Retrogame package, which did exactly what I needed. With a simple config file, I could map changes on the GPIO pins to keypresses. It worked perfectly. Soon I had a breadboard mockup where I was controlling the games by shorting the pins to ground.
Another problem with keys was to be able to shutdown the Pi cleanly. I ended up writing a short Python script using the python-uinput package. This does a similar job to Retrogame but I was able to configure things so if the power button was pressed once it would quit the current game (and return to the selection menu) but if held for three seconds, it would trigger a system shutdown. Implementing this script also gave me the chance to add an LED to the front so I could see when the system had finished shutting down (I also really like LEDs).
The last part was adding a barrel connector hooked up to the UART pins so should I ever need to, I can get console access without having to take everything apart. I tend to do this just out of habit with build like this and have a ready-made USB-to-UART lead with a 3.5” stereo jack on the end.
First off, lets get that cartridge cleanup, open and remove all that complex circuitry. Oh.
Next, get rid of all the interior posts and bits with a pair of pilers and some deft craft-knife work to get it as smooth as possible. Didn’t need to be perfect.
I wanted to not only have the joystick ports (which, let’s be honest, are kinda important) but also all the switches that the original Atari VCS has. So, I measured up the front area and made up a template to make sure everything would fit.
With the template in place and looking good, next up was to cut the holes. I only had one shot at this, so time was taken. The holes for the switches were done with a low-speed drill and the larger joystick holes with a rotary tool.
A little scraping later, and the ports fit nicely.
Now to get a bit more artistic. The Atari cart font was easy enough to track down (it’s called MumboSSK) and I made a little mock-up of a cart with labels for all the controls. The graphics were, ahem, borrowed from the cover of ‘Art of Atari’. I suggest you buy it as it’ll make me feel better.
Time to get the soldering iron out. Thankfully the Pi Zero (I’m using the original, not the W) has enough GPIO pins to cover all my requirements. I needed five controls per player (up, down, left, right, fire) and a further six for my control buttons. Luckily the Zero could accommodate this without needing to resort to any kind of space-destroying input extender.
With everything tested, time to fix things in place. Superglue did the trick nicely for the ports, but the Pi is mounted with (non-conductive!) sticky foam pads.
Time to very carefully fold things up.
I’m not quite prepared to get the glue out yet, so an elastic band is helping hold the cart together in the meantime.
I mapped the Emulationstation (RetroPie’s UI) controls to the same as the left joystick so you can select your game. Once in a game, a tap on the power button will drop you back to the main menu.
So there you go. Hours of fun on Combat ahead. Think I’ll skip E.T. though. The Pi Zero has enough grunt to run Stella very well indeed, although it finds Emulationstation a bit of a struggle (but not bad enough to be unusable).
I’ll be bringing this little gizmo to the Milton Keynes Raspberry Jam on the 15th July 2017. Hopefully I’ll see you there!