USB joystick adapter quickly and inexpensively assembled

Introduction

There is from the company Retronics Design such a ready-made adapter for just under 30 Canadian dollars order. 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 already mentioned Atari, or Commodore joysticks, but a variety of other brands are usable, such as Sega, Texas Instruments, Coleco, etc.. You only have to change the firmware via USB, and the corresponding joystick can be used on the 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 build this adapter yourself. And the construction is really suitable even for beginners. There are no SMD components used and the whole thing can be built on a strip grid board.

Circuit diagram

The schematic and the firmware can be downloaded HERE. But I had taken over the schematic also in KiCad. Why I did this, I will come to that later. The schematic itself is not so important for this project, which is interesting especially for less experienced, the whole thing is to be built 1:1 on a strip grid board.

And of course I made an extra drawing for it. To make such drawings, I can use the open source project DIY Layout Creator, which is available for download for every platform. With it you can quickly create small layouts on breadboards or stripboards.

Parts list

As you can see from the picture above, quite few parts are needed. I have created a shopping cart at Reichelt, which you are welcome to use as a template if needed.

The parts list looks as follows:

Designator Quantity Reichelt Order No.Type
R1,R22 RND 0W2J0182A10 Resistor, metal oxide, 1.8 kOhm, axial, 0.5 W, 5%
R3,R42 1/4W 68resistor, carbon layer, 68 Ohm, 0207, 250 mW, 5%
R51 1/4W 2,2Kresistor, carbon layer, 2.2 kOhm, 0207, 250 mW, 5%
R61 1/4W 10Kresistor, carbon layer, 10 kOhm, 0207, 250 mW, 5%
C1,C22 KERKO 100NCeramic capacitor 100N
C3,C42KERKO 22PCeramic capacitor 22P
C5,C62X7R-5 68Nmultilayer ceramic capacitor 68N, 10%
C71T356 10U 35Tantalum, leaded, 10µF, 35V, 85°C
Z-D1,Z-D22ZF 3,6Zener diode, 3.6 V, 0.5 W, DO-35
Y1112,0000-HC49U-SStandard crystal, fundamental, 12.000000 MHz
U11ATMEGA 328P-PUMCU, ATMega AVR RISC, 32 KB, 20 MHz, PDIP-28
1H25SR100strip grid board, hard paper, 100x100mm
1USB-A 10080109USB 2.0 A male – free ends, 1.8 m, bw
1D-SUB ST 09D-SUB connector, 9-pin, solder cup
1KAPPE 09MD-SUB cap f. 9-pin D-Sub, metallized
1LIYY 1014-5Control cable 10×0,14mm², unshielded, 5m-ring

Additionally I recommend a few male and female connectors, if you don’t want to solder the cables to the board. In any case you should solder a double row header for the connection to flash the ATMega chip. For the wiring on the strip grid board you can either take a part of the control line, or simply use stranded wire. Whatever you have at home, there are no special requirements. Also if necessary a socket for the ATMega would not be wrong.

Otherwise, probably much have most of the components at home, Who must order the parts completely new, which pays at Reichelt just under 13, – euros (as of April 16, 2019) for the parts. In my opinion, a very good price for this versatile adapter.

Structure

First of all, a picture of the finished adapter.

And then the whole thing as a drawing, which may be a little easier to see:

The easiest way is to mark the board beforehand. Both horizontally and vertically, you start counting from the upper left corner. The alphabet is used for this. 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 4th row and the 10th column would be D-J. On the drawing above you can find these letters again.

So you can easily find the corresponding points by simply counting or spelling.

First you have to interrupt the stripes 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

Using the example of the first intersection point “A – P/Q”, this means that in the horizontal row A, as the first row, between the letter P and Q the strip path is separated. This is best done with a sharp cutter knife. If necessary, the cut must be repeated several times until the trace is completely cut.

Afterwards I recommend to do a continuity test with a multimeter to see if the trace was really cut completely. It happens easily that a hair-thin, with the eye almost not recognizable connection remains, which is completely sufficient as a short circuit later.

If all corresponding places were separated and examined, the wires, and/or stranded wire should be soldered in next. These are the red wires on the picture, or the green, black, blue and red connections on the drawing. Then the components can be soldered in. As usual, the order should go from small to large. So start with the capacitors or diodes and solder the AtMega at the very end.

Now the pin headers or the single wires for the USB cable and the joystick connector are soldered in. I have drawn the colors in the overview above. Since the USB connector is already connected to the cable, only the open end has to be soldered according to the colors.

For the joystick connection the D-SUB 9 socket must be connected additionally. The pinout is as follows:

Now the adapter is ready and should look like this.

By the way, I have provided a package in the download area, which contains all the necessary files for the assembly. Also the drawing is attached in a higher resolution.

Programming adapter for ATMega

For the joystick adapter to work at all, the appropriate firmware is needed. In this article I will use the firmware for Atari and Commodore joysticks. If you want to flash another firmware, you can download it from the Retronics homepage,

Now you can flash the firmware yourself directly, the adapter works with it without any problems. But then you always need a programming adapter for the ISP port, like the popular USBasp or the EPROM burner MiniPro TL866A, which also has such a port.

But it is more comfortable to flash a bootloader before. Because with it 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 different. 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. 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, which can be used for the ATMega series:

Which one to use is up to you. In any case an inexpensive model is sufficient. You can get them from China for just 2,- Euro.

To flash the microprocessor, you need, besides the actual firmware, of course a corresponding software. Personally, I use the tool AVRDUDE, which can be downloaded for free for Windows, Linux and MacOS. It is a command line tool that runs in a shell under Linux and MacOS and in a command prompt (CMD) under WIndows. The tool supports almost all ISP programming adapters. As a prerequisite the LIBUSB drivers are needed, which have to be installed before.

If there should be questions or problems with the installation, I can also write a small tutorial.

Flash bootloader

If everything is prepared, the bootloader can be flashed to the ATMega. For this you have to connect the programming adapter to the strip grid board. The 6pin connector is used for this purpose. You have to pay attention to the polarity. On the small ribbon cable on the programmers one line is always marked red. This line 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 board. But many programming adapters have a 10pin connector. In addition it must be sent ahead that this ISP interface exists evenly in both variants. Some programming adapters come with a suitable adapter. Then you can simply take the corresponding adapter. If the programming adapter does not have such an adapter, you can simply use the Dupont connectors or also called “Jumper Wire”, which are also used on the breadboards.

On the picture you can see the colorful Dupont connectors. With these you can simply adapt from the 10pin version to the 6pin connector. This is so easy because only 6 wires are needed for the ISP interface. The 10pin version has only 4 additional GND lines.

Image taken from Wikipedia.com under CC BY 3.0 license

From the picture you can see well how the single connections have to be made. Afterwards the programming adapter can be connected to the USB interface of the computer.

avrdude -p <CHIP-TYP> -c <PROGRAMMINGADAPTER> -U flash:w:<FLASHFILE>: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 behind the parameter.

If you want to know for example which value we want to use here for our ATMega, then simply enter the following:

avrdude -p ?

After that a quite long list comes back. For this project an ATMega328P-PU is used. We find this in the list also with the entry “m328p = ATmega328P“. In front there is the value which is important for AVRDUDE: m328p.

Now it gets a bit more difficult. Because the next parameter depends on the used programming device. Again you can get the list with a question mark behind the parameter “-c”. If the quite popular USBasp is used, then the entry would look like this: “usbasp = USBasp, http://www.fischl.de/usbasp/” And here the value to be entered would be: 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 if the programming adapter is recognized. Otherwise just test another one.

The actual firmware, or in our case the bootloader is flashed with the parameter “-U“. The fuses are also set this way. The value behind “-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 file type is specified. This can be omitted in most cases, 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“.

Assembled the parameter would look like this: -U flash:w:bootloader_retronics_v3.hex:i

The file can also be found in the package I put in the download area.

If you want to flash the firmware and you 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 is now installed and the fuses are set so that the actual firmware can be installed.

Flashing the firmware

The firmware can now be done at any time using a small tool directly without a programming adapter. Only a joystick is needed. Connect it to the 9pin D-SUB connector, 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 flashing the firmware.

The tool is available in a Linux (“bootloadHID”) and Windows (“HIDBootFlash.exe”) version. The Windows version has 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 click on “Flash Device“.

Now the actual flash process begins, which should be acknowledged with an appropriate message. If something went wrong, for example if you accidentally released the fire button, you can repeat the whole procedure at any time.

If the firmware was installed without errors, the fire button can now be released. Now disconnect the USB connection.

Finish

Now the USB joystick adapter is ready for use. It can be used under Windows, Linux and MacOS. But it also works great on the MiSTer FPGA.

On the Retronics website you can find more firmware versions for other joysticks. Also there are from time to time new versions, or bug fixes. Thanks to the bootloader, the firmware can always be reloaded quite quickly and easily. All you need is the joystick adapter, a joystick, a PC with Windows or Linux and the flash tool.

I wish you a lot of fun and I would be happy if you send me some pictures of your builds. But also questions, suggestions or criticism are always welcome.

But wait a minute… The attentive reader will surely ask himself what happened to the circuit diagram from the beginning. And it’s true, I didn’t mention it anymore. The schematic is needed to convert our joystick adapter on a strip grid board into a…

…to make this:

And now I didn’t just leave the board out and connect 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 connector. If you are interested in this, you should visit my website often. Because I will write a separate article about it soon.

Update (2020-03-31) / Download

All necessary files, incl. the pictures in higher resolution together in a ZIP file here for download.

USB Joystickadapter Retronics Design

USB Joystickadapter Retronics Design

All necessary files, including higher resolution images.
Version: 1.0
Size: 199.46 KB
Hits: 16
Date added: 31-03-2021

4.1 32 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x