“I already built a nifty handheld controller, and I should be enjoying my retro gaming experiences, but I couldn’t help building something new, so here is a PS2-to-Atari5200 adapter
This adapter allows you to use a PS2 controller on an Atari 5200 gaming console. The 5200 was notable at the time for its use of analog joysticks, but the controllers that shipped with the console are pretty lousy. They don’t self-center and they have a mushy annoying feel to them. The fire buttons aren’t very tactile in nature. The controller in my opinion just doesn’t feel or work good. Nevertheless, you have to give the Atari 5200 some respect for trying to be a pioneer in the technology.
As such, several solutions have been proposed for using alternate controllers. There are adapters for Atari 2600 digital sticks, adapters for analog PC joysticks, my own handheld controller, etc. I decided to adapt the basic technique of my handheld controller to a PS2 adapter.
The basic idea
The Atari 5200 uses analog controllers. For each axis it expects an analog potentiometer of approximate 500K.
The PS2 dualshock is an analog controller with a digital interface. It communicates with the playstation by use of the SPI protocol. This is a clocked serial protocol with dedicated directional IO pins (MOSI = Master Out Slave In, MISO = Master In Slave Out) and a chip select.
Interfacing an SPI peripheral is dead simple with a microcontroller, you can easily bit-bang the SPI protocol, sending the appropriate bits in and out and toggling the clock. Numerous articles have been written on interfacing a PS2 controller to an AVR microcontroller. For example, CuriousInventor breaks down the protocol packets, and sunil93 has some C code to use that protocol. Reading the PS2 controller is a straightforward matter of repeatedly the controller for thumbstick and button state.
Getting that information back to the Atari 5200 is the interesting part. I use the same technique in this project that I did for my handheld controller, a digital potentiometer. The digital potentiometer used in this case is an MCP42100. It interfaces using SPI (just like the PS2!) and provides a range from 0 to 100K ohms in 256 steps. Unfortunately, finding a 500K digital pot is problematic. Knowing that the Atari 5200 uses capacitor charge rate to measure the position of the potentiometer, it’s possible to stretch out our 100K digital pot to the same charge characteristics as the stock controller by adding some additional capacitance, in our case 0.22uF. The same trick is used to make 100K PC joysticks work on an Atari 5200.”