It's essentially a USB to Atari joystick-standard converter
On the left hand side of the breadboard there is an Adafruit M4 Arduino, while in the right hand side we have a serial converter. Just in the middle between them you can probably see a transistor. There is only 1 output pin connected (out of the 5 it'll require).
I cracked open my Atari joystick to see how it works (read about it but wanted to take a closer look). Basically, the C64 detects the joystick activity because the circuit closes when you press a button or move the stick. That's the behaviour I wanted to simulate with the Arduino. In order to test it, the multimeter was set to continuity, when I pressed a button I heard a beep meaning I just closed the circuit! Also, it's important to avoid that any form of current goes to the pins on the C64 side, otherwise it will eventually fry the CIA. That's why I put a transistor there, it acts like a switch.
As for the next steps, each of the output pins on the Arduino will be connected to the appropriate pins on the DB9 joystick port. Not sure yet what other components will be required to make this work with all the 5 pins. I have to take a look at timing to see how much time does the C64 need to actually noticed I pressed a button. Refine the code on the Arduino side, I should see how to handle a long press vs a repetitive one.
Still a long way to go but I'm learning a lot in the process! Any comments, ideas etc. are more than welcomed. There is a lot of room for improvement!
Yes, indeed! The idea I have in mind is to program another button for repetitive ("turbo") fire and one more for "up" direction. The former helps to win in certain games , while the latter is quite useful to jump in others
Nevertheless, the next steps I'm thinking of are: - Try with germanium switch diodes to replace the transistors. - Test with the C64. I found a joystick test program so I'll go with that to see if everything works. - Include code for those "special buttons". - Find a way of detecting the gamepad type you have connected. Offering more support that just the PS3 one.
In a single line... Eureka! It works! I'm ecstatic with the alpha version!!! Full disclosure, I'm not an expert on electronics, quite the opposite. I'm just trying to have an excuse to learn more, and if in the meantime I manage to build something, that would be great
Well, this is the prototype (if you keep reading there is a demo video, somewhere...)
Basically, I've cabled the pins of the C64 joystick port to the correspondent output PINs (+ switch circuit) in the Arduino side.
If you take a look, you'll see we have two different implementations on the breadboard. For "up" and "right", I'm using S8050 NPN transistors.
While for the "down" pad direction, I'm using a germanium switch diode.
Both implementations work. I'll probably stick to the diode one as it's less bulky than the transistor option. I'm still reading 0.2 volts in both the transistors' collector and the diode's anode. I know neither of these components are a perfect switch, but I'll research more to see if I can find something better. The Arduino works at 3.3V.
The hardware part works. Now, I have to put a little bit of effort on the Arduino code. Essentially, rewrite the loops that actually send the signal to the pins of the C64 joystick port. As you can see in this video, even though I kept pressing the pad direction, the C64 thought it was a momentary press. I believe I know where is the issue, it should be solved quite easily.
I'm no expert either. I read a lot, make a few mistakes and eventually things start to come together. So is the only benefit to the diode just size or does it offer any other benefits ? Just a curiosity.
Indeed. The diode is more expensive , $1 each, and you need five! Other than that, I believe both are interchangeable.
Long story short... I found a couple of Arduino projects about creating this USB to Atari joystick adapter. However, they were using Arduino hardware that is EOL, and if I'm not mistaken, they didn't take into account they could be back-powering the CIA.
So, my goal was to update the design using current hardware, include code to improve the user experience when playing and the most important thing, avoid frying our precious CIAs.
In regards to the latter, I got the idea reading about a SEGA MegaDrive (a.k.a. Genesis) joystick adaptor, here is the original article. Also, this is the technical explanation about why you shouldn't connect a Genesis gamepad directly to your C64. As you can see, the mentioned adaptor uses diodes. I didn't really know much about diodes (other than LEDs), but it made a lot of sense once I investigated about them. In total honesty, my first thought was to use a transistor. That's why I kept both options open during the design and test of the prototype
Diving more into the hardware aspect... This article (answer #2), explains how the joystick ports work and gives a hint about using a transistor as a switch! yeah, at least I am not the only one who thinks on transistors.
Moving on to the software side... I managed to solve the issue with the constant press of a button. It turns out I was using the wrong function Also I added into the code the Square button as "up", the auto-fire (turbo-fire) on the Circle button and finally, right-left-right-left... on the Triangle one, any ideas why? you'll see... (click on the photo for the video)
Let's play some Bubble Bobble!! (click on the photo for the gameplay video)
And finally, the reason behind that right-left type of thing (you know what to do)