You just want to play an old game in an emulator. Or has just built a MiSTer FPGA. Surely you have various joysticks for the good old home computers, such as Atari or Commodore, at home, but all of them have in common that a 9pin plug is used for the connection to the computer. PCs have never had such a connector. Today USB is used as interface almost continuously. In this article I would like to describe how you can easily build such an adapter on a paper tape board.
The company Retronics Design offers such an adapter for almost 30 Canadian dollars. The special thing about this adapter is that there are different firmware versions for different types of joysticks. So you can not only connect the previously mentioned Atari or Commodore joysticks, but there are a lot of other brands available, like Sega, Texas Instruments, Coleco, etc.. You only have to change the firmware via USB, and the joystick can be used on a PC, or even on a MiSTer.
The really great thing about it is that Retronics has both the layout and of course the various firmware versions publicly available for download. So you can rebuild this adapter yourself. And the construction is really also suitable for beginners. There are no SMD components used and the whole can be wonderfully built on a strip grid board.
The schematic and the firmware can be downloaded HERE. But I had taken over the schematic in KiCad as well. Why I did this, I'll come to that later. The schematic itself is not so important for this project, which is especially interesting for less experienced users, who want to build it 1:1 on a strip grid board.
And of course I made an extra drawing for it. To create such drawings, I can use the open source project DIY Layout Creator, which is available for download on every platform. With it you can quickly create small structures on hole or strip grid boards.
The parts list looks like this:
|Component||Quantity||Reichelt Order no.||Description|
|R1,R2||2||RND 0W2J0182A10||Metal oxide film resistor 0,5W, 5%, 1,8 K-Ohm|
|R3,R4||2||1/4W 68||Carbon film resistor 1/4 W, 5%, 68 Ohms|
|R5||1||1/4W 2,2K||Carbon film resistor 1/4 W, 5%, 2.2 kOhm|
|R6||1||1/4W 10K||Carbon film resistor 1/4W, 5%, 10 kilo-ohms|
|C1,C2||2||KERKO 100N||Ceramic capacitor 100 N|
|C3,C4||2||KERKO 22P||Ceramic capacitor 22 P|
|C5,C6||2||X7R-5 68N||Multi-layer ceramic capacitor 68N, 10%|
|C7||1||T356 10U 35||
Tantalum, wired, 10µF, 35V, 85°C
|Z-D1,Z-D2||2||ZF 3,6||Zener diode, 0.5 W, 3.6 V|
|Y1||1||12,0000-HC49U-S||Standard quartz, fundamental, 12.0 MHz|
|U1||1||ATMEGA 328P-PU||ATMega AVR RISC controller, DIL 28|
|1||H25SR100||Strip matrix PCB, laminated paper, 100x100 mm|
|1||USB-A 10080109||USB 2.0 A connector - free ends, 1.8 m, sw|
|1||D-SUB ST 09||D-SUB plug, 9-pin, solder bucket|
|1||KAPPE 09M||D-sub cap for 9-pin D-sub, metallised|
|1||LIYY 1014-5||Control line, 10 x 0.14 mm², unshielded, 5 m coil|
Additionally I recommend a few pin and socket connectors, if you don't want to solder the cables to the PCB. In any case you should solder in a double row pin header to flash the ATMega chip. For the wiring on the strip raster board you can either use a part of the control cable or simply use stranded wire. What you have at home, there are no special requirements. Also a socket for the ATMega would not be wrong.
Otherwise, most of the components are probably at home. If you have to order the parts completely new, you pay Reichelt 13,- Euro (as of April 16, 2019) for the parts. In my opinion a very good price for this versatile adapter.
First of all a picture of the finished adapter.
And the whole then as a drawing, which can be recognized a little bit better:
The easiest way is to mark the board accordingly beforehand. Both horizontally and vertically, you start counting from the upper left corner. The alphabet is used. So the upper left corner is A-A. When you reach the end of the alphabet, you start counting again from the beginning. A hole in the 4 row and the 10 column would therefore be D-J. On the above drawing these letters can be found again.
So you can easily find the corresponding points by simply counting or spelling them.
First of all the stripes have to be interrupted at some places on the board. These are the following places:
- A - P/Q
- B - P/Q
- C - P/Q
- L - I/J
- M - I/J
- N - I/J
- O - I/J
- P - I/J
- Q - I/J
- R - I/J
- S - I/J
- T - I/J
- U - I/J
- V - I/J
- W - I/J
- X - I/J & M/N
- Y - I/J
- Z - D/E
At the example of the first intersection "A - P/Q" this means, in the horizontal row A, as the first row, between the letter P and Q the strip track is separated. This can best be done with a sharp cutter knife. If necessary, the cut must be repeated several times until the trace is completely cut.
I recommend using a multimeter to do a continuity test to see if the trace has really been completely cut. It easily happens that a hair-thin connection is left that is almost invisible to the eye and that will later suffice completely as a short circuit.
When all the relevant points have been disconnected and checked, the wires or strands should be soldered in next. These are the red wires in the picture and the green, black, blue and red connections in the drawing. Then the components can be soldered in. As usual the order should go from small to big. So start with the capacitors or diodes and solder the AtMega at the end.
Now solder in the pin headers or the single wires for the USB cable and the joystick connector. The colors are shown in the overview above. Since the USB plug is already connected to the cable, only the open end has to be soldered in according to the colors.
For the joystick connection the D-SUB 9 socket has to be connected additionally. The assignment is as follows:
With that the adapter is ready and should look like this.
By the way, in the download area I have prepared an appropriate package, which contains all files necessary for the construction. Also the drawing is attached in a higher resolution.
Programming adapter for ATMega
In order for the joystick adapter to work at all, the appropriate firmware is of course required. I will go into the firmware for Atari and Commodore joysticks in this article. If you want to flash another firmware, you can of course download it from the Retronics homepage,
Now you can flash the firmware directly, the adapter works fine with it. However, you will always need a programming adapter for the ISP connection, such as the popular USBasp or the EPROM burner MiniPro TL866A, which also has such a connection.
But it is more convenient to flash a bootloader first. You can easily change or update the firmware via the PC and its USB port and a small tool at any time. The procedure is the same in both cases, only the file is just another. Therefore I describe the installation of the bootloader, because I consider this way as the preferred one.
As already mentioned, a so-called ISP programming adapter is needed. Of these there are different types under different names. One of the best known and cheapest is the USBasp.
Here is a small selection of different programming adapters that can be used for the ATMega series:
Which one you ultimately take is up to you. In any case, an inexpensive model is sufficient. You can get it from China for only 2,- Euro.
In order to flash the microprocessor, one needs, beside the actual firmware, of course still an appropriate software. Personally I use the tool AVRDUDE, which can download it for Windows, Linux and MacOS for free. It is a command line tool that runs under Linux and MacOS in a shell and under Windows in a command prompt (CMD). The tool supports almost all ISP programming adapters. So you need the LIBUSB drivers, which have to be installed before.
If there should be any questions or problems during the installation, I can also write a small tutorial.
When everything is ready, the bootloader can be flashed onto the ATMega. To do this, connect the programming adapter to the strip raster board. The 6pin connector is provided for this purpose. The polarity must be observed. At the small ribbon cable at the programming devices one cable is always marked red. This cable represents pin 1. On our board PIN 1 would then be in the top row, on the left.
In this example, the programming adapter already has the appropriate 6-pin connector, which can then simply be plugged onto the circuit board. However, many programming adapters have a 10-pin socket. For this it has to be sent in advance that this ISP interface is available in both versions. Some programming adapters come with suitable adapters. Then you can simply use the appropriate adapter. If the programming adapter does not have such an adapter, you can also use the Dupont connectors, also called "Jumper Wire", which are also used for the breadboards.
On the picture you can see the colored Dupont connectors. With these you can easily adapt from the 10pin version to the 6pin connector. This is so easy because only 6 lines are needed for the ISP interface. The 10pin version has only 4 additional GND lines.
From the picture you can clearly see how the individual connections have to be made. The programming adapter can then be connected to the USB interface of the computer.
The command to flash generally looks like this:
avrdude -p <CHIP-TYP> -c <PROGRAMMIERADAPTER> -U flash:w:<FLASHDATEI>:i
If you execute the command without parameters, you get a list with the possible parameters. If you want to know more about a single parameter, you can either consult the documentation or write a question mark after the parameter.
For example, if you want to know which value we want to use for our ATMega, just enter the following:
avrdude -p ?
After that, a pretty long list comes back. For this project an ATMega328P-PU is used. We find this in the list also with the EIntrag "m328p = ATmega328P" again. At the front is the value that is important for AVRDUDE: m328p
Now it's getting a little harder. The next parameter depends on the programming device used. Also here you can retrieve the list with a question mark after the parameter "-c" If you use the quite popular USBasp, the entry would look like this: "usbasp = USBasp, http://www.fischl.de/usbasp/" And here is the value to enter: usbasp
Unfortunately I don't know which adapter you have. Most cheap adapters from eBay are variants of the USBasp. Sometimes the value "usbasp-clone" helps. But you can simply test it to see if the programming adapter is recognized. Otherwise simply test another one.
The actual firmware, or in our case the bootloader, is flashed with the parameter "-U". Also the fuses are set in this way. The value after "-U" indicates whether the firmware (or the bootloader) or for example a fuse should be set.
At this point we use the values FLASH, EFUSE, LHUSE and HFUSE. The other values are always separated by a colon ":". Next comes a "w" for write. Finally followed by the file name of the file to be flashed. Finally the specification of the file type. In most cases you can leave this out, but it doesn't hurt to set it. Since this is an Intel HEX file, the correct parameter in this case would be an "i".
The parameter would then look like this: -U flash:w:bootloader_retronics_v3.hex:i
The file can also be found in the package, which I put in the download area.
If you now want to flash the firmware and have a USBasp programming adapter, the complete command would look like this:
avrdude -p m328p -c usbasp -U flash:w:bootloader_retronics_v3.hex:i
Now the fuses have to be set. This is done in a similar way with the following call:
avrdude -p m328p -c usbasp -U lfuse:w:0xdf:m -U hfuse:w:0xd2:m -U efuse:w:0xfd:m
If there are no error messages, the bootloader would be installed and the fuses set so that the actual firmware can be installed.
The firmware can now be executed at any time using a small tool directly without a programming adapter. All you need is a joystick. Connect it to the 9pin D-SUB beech, press the fire button and hold it during the whole procedure. Only now, when the fire button is pressed, the joystick adapter is plugged into the USB port of the computer. By holding the fire button, the bootloader is activated, which allows the firmware to flash.
The tool is available in a Linux ("bootloadHID") and Windows ("HIDBootFlash.exe") version. The Windows version comes with its own interface, which is quite self-explanatory. First click on "Find Device" until the joystick adapter is found, then click on "Open .hex File" and select the firmware file "Atari_C64_Amiga_Joystick_v3.1.hex". Now click on the checkbox "Reboot AVR" and then on "Flash Device".
Now the actual Flash process begins, which should be acknowledged with a corresponding message. If something went wrong, e.g. if you accidentally released the fire button, you can repeat the whole procedure at any time.
If the firmware has been installed correctly, the fire button can now be released. Now disconnect the USB connection.
The USB joystick adapter is now ready for use. It can be used under Windows, Linux and MacOS. But also the MiSTer FPGA works very well.
On the Retronics website you can find more firmware versions for other joysticks. From time to time there are also new versions and bug fixes. Thanks to the bootloader the firmware can always be reloaded quickly and easily. All you need, besides the joystick adapter of course, is a joystick, a PC with Windows or Linux and the flash tool.
I wish you a lot of fun with the replica and would also be happy about some pictures of your replicas. But also questions, suggestions or criticism are always welcome.
But wait, wait a minute... The attentive reader will certainly ask himself the question, what is with the schematic from the beginning. And it's true, I haven't mentioned it any more. The schematic is used to convert our joystick adapter to a strip grid board...
...to do this:
And I haven't just left out the circuit board and connected the cables. I just made a small board with SMD components out of the strip grid board. And I made it so small that it fits into the small housing of the D-SUB 9 socket. If you are interested, you should check back often. Because I will write a separate article about it soon.
Translated with www.DeepL.com/Translator