DIY MD/SMS/Atari/C= to USB adapter
Re: DIY MD/SMS/Atari/C= to USB adapter
You can't delete field. Just make it empty (several space symbols) - it's enough.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
I made progress with the two controller adapter today but still having problems. I managed to create two separate usb interfaces on the same Arduino for the two adapter ports. The serial number is four spaces.Sorgelig wrote:You can't delete field. Just make it empty (several space symbols) - it's enough.
EDIT: It works now, solution in the next post.
In Windows it just works and it also works in Ubuntu 16.04 without the need of any usbhid quirks. I tested with jstest-gdk and the two adapter ports are seen as two separate controllers and the inputs are not combined.
On MiSTer, two input devices (with js0 and js1) are created when I plug in the adapter without any usbhid quirks applied, but still, the inputs are combined. Controllers in both adapter ports controls the same player. The console output for the two controllers are a little different, there is a number after the vid:pid, so the inputs are to some extent separated, but jnum is the same for both:
Code: Select all
// First controller:
Input event: type=EV_ABS, Axis=1, Offset=1, jnum=1, ID:2341:8036:00, abs_min = -1, abs_max = 1
// Second controller:
Input event: type=EV_ABS, Axis=1, Offset=0, jnum=1, ID:2341:8036:01, abs_min = -1, abs_max = 1
Code: Select all
Open up to 30 input devices.
opened 0( 0): /dev/input/event0 (046d:4024) 0 "4024-68-5b-8d-7a" "Logitech K400"
opened 1( 0): /dev/input/mouse0 (046d:4024) 0 "4024-68-5b-8d-7a" "Logitech K400"
[ 378.831721] usb 1-1.2: new full-speed USB device number 5 using dwc2
[ 378.936742] usb 1-1.2: New USB device found, idVendor=2341, idProduct=8036, bcdDevice= 1.00
[ 378.945112] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 378.952441] usb 1-1.2: Product: Arduino Leonardo
[ 378.957079] usb 1-1.2: Manufacturer: Arduino LLC
[ 378.961720] usb 1-1.2: SerialNumber:
[ 378.975755] HID usage: 0x00010004, original interval: 1
[ 378.981028] JS: endpoint->bInterval=1, interval=1
[ 378.985751] HID usage: 0x00010004, applied interval: 1
[ 378.991133] input: Arduino LLC Arduino Leonardo as /devices/platform/soc/ffb40000.usb/usb1/1-1/1-1.2/1-1.2:1.2/0003:2341:8036.0007/input/input6
The file js0 was created.
[ 379.005543] hid-generic 0003:2341:8036.0007: input,hidraw2: USB HID v1.01 Joystick [Arduino LLC Arduino Leonardo] on usb-ffb40000.usb-1.2/input2
Close all devices.
[ 379.026758] HID usage: 0x00010004, original interval: 1
[ 379.032023] JS: endpoint->bInterval=1, interval=1
[ 379.036747] HID usage: 0x00010004, applied interval: 1
[ 379.042161] input: Arduino LLC Arduino Leonardo as /devices/platform/soc/ffb40000.usb/usb1/1-1/1-1.2/1-1.2:1.3/0003:2341:8036.0008/input/input7
[ 379.055946] hid-generic 0003:2341:8036.0008: input,hidraw3: USB HID v1.01 Joystick [Arduino LLC Arduino Leonardo] on usb-ffb40000.usb-1.2/input3
Open up to 30 input devices.
opened 0( 0): /dev/input/event3 (2341:8036) 0 " " "Arduino LLC Arduino Leonardo"
opened 1( 0): /dev/input/event2 (2341:8036) 0 " " "Arduino LLC Arduino Leonardo"
opened 2( 2): /dev/input/event0 (046d:4024) 0 "4024-68-5b-8d-7a" "Logitech K400"
opened 3( 2): /dev/input/mouse0 (046d:4024) 0 "4024-68-5b-8d-7a" "Logitech K400"
The file event2 was created.
The file js1 was created.
The file event3 was created.
Close all devices.
Open up to 30 input devices.
opened 0( 0): /dev/input/event3 (2341:8036) 0 " " "Arduino LLC Arduino Leonardo"
opened 1( 0): /dev/input/event2 (2341:8036) 0 " " "Arduino LLC Arduino Leonardo"
opened 2( 2): /dev/input/event0 (046d:4024) 0 "4024-68-5b-8d-7a" "Logitech K400"
opened 3( 2): /dev/input/mouse0 (046d:4024) 0 "4024-68-5b-8d-7a" "Logitech K400"
Last edited by witchmaster on Mon Feb 03, 2020 10:22 pm, edited 1 time in total.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
I now have it working (thanks to bootsector on Discord)! The serial number field is now totally empty and then it works. At least from my initial testing in the Minimig core.
Re: DIY MD/SMS/Atari/C= to USB adapter
Will you publish dual joystick project?
I have Atari paddles, so i want to make a converter.
I have Atari paddles, so i want to make a converter.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
Yes, I will publish it later today!Sorgelig wrote:Will you publish dual joystick project?
I have Atari paddles, so i want to make a converter.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
Ok, I published it (same repository as the single controller adapter)!Sorgelig wrote:Will you publish dual joystick project?
I have Atari paddles, so i want to make a converter.
Re: DIY MD/SMS/Atari/C= to USB adapter
thanks!witchmaster wrote:Ok, I published it (same repository as the single controller adapter)!Sorgelig wrote:Will you publish dual joystick project?
I have Atari paddles, so i want to make a converter.
Re: DIY MD/SMS/Atari/C= to USB adapter
Is there any changes in system libraries required?
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
Shouldn't be, as before I'm only using the HID library that comes with the Arduino IDE. But to clear the serial number I did the small change in USBDesc.h:Sorgelig wrote:Is there any changes in system libraries required?
Code: Select all
#define ISERIAL 3
// to
#define ISERIAL 0
Re: DIY MD/SMS/Atari/C= to USB adapter
it's better to add it in Readme so this info won't get lost.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
Yes, I will add some more details to the Readme.Sorgelig wrote:it's better to add it in Readme so this info won't get lost.
Re: DIY MD/SMS/Atari/C= to USB adapter
Would be good if you would move/fork this repo to MiSTer-devel. I plan to add more converters for other controllers based on your code to the same repo. So we will have official DIY converters for MiSTer.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
Yes, I will do some cleanup and then we can fork the repo. I can manage the project on MiSTer-devel right? I have a few other adapter basically ready and NES and SNES in the making.Sorgelig wrote:Would be good if you would move/fork this repo to MiSTer-devel. I plan to add more converters for other controllers based on your code to the same repo. So we will have official DIY converters for MiSTer.
Re: DIY MD/SMS/Atari/C= to USB adapter
I've sent invitation on github to MiSTer-devel. After accepting it, you will be able to create the repositories in MiSTer-devel
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
Thanks! As you probably already noticed, I forked the repository. I don't know if you already started working on the Atari paddle controller adapter but here is the "pinout" I have used for Atari/C= controllers in another project and I used the same for the CD32/C=/Amiga adapter. I guess it's best if we use the same pinout for all the adapters using the Atari standard. A0-A4 are used for pins 5 and 9 of both ports so they can support paddles. I might change to this pinout for the Mega Drive adapter also, I'm not sure though.Sorgelig wrote:I've sent invitation on github to MiSTer-devel. After accepting it, you will be able to create the repositories in MiSTer-devel
Code: Select all
// Joystick Port 1
// DB9 Arduino Pro Micro
// --------------------------------------
// 1 TXO PD3
// 2 RXI PD2
// 3 3 PD0
// 4 4 PD4
// 5 A0 PF7
// 6 6 PD7
// 7 VCC
// 8 GND
// 9 A1 PF6
// Joystick Port 2
// DB9 Arduino Pro Micro
// --------------------------------------
// 1 15 PB1
// 2 14 PB3
// 3 16 PB2
// 4 10 PB6
// 5 A2 PF5
// 6 7 PE6
// 7 VCC
// 8 GND
// 9 A3 PF4
Re: DIY MD/SMS/Atari/C= to USB adapter
I was busy by cores, so didn't start yet.
From your post i see only one Analog input per port which is not enough. Need 2 analog pins per port
Actually i wanted to make a single port adapter with option to emulate a single joystick with paddles on X/Y and 2 joysticks - one per paddle for better compatibility. So basically one port should be enough for paddles.
I'm not really interesting in adapters for generic controllers as i think modern native USB/BT gamepads can do the job better. So i'm more interested in non-standard controllers like paddles, spinners - they aren't popular in modern gamepads.
So it's more up to you what converter for standard retro gamepad to develop.
From your post i see only one Analog input per port which is not enough. Need 2 analog pins per port
Actually i wanted to make a single port adapter with option to emulate a single joystick with paddles on X/Y and 2 joysticks - one per paddle for better compatibility. So basically one port should be enough for paddles.
I'm not really interesting in adapters for generic controllers as i think modern native USB/BT gamepads can do the job better. So i'm more interested in non-standard controllers like paddles, spinners - they aren't popular in modern gamepads.
So it's more up to you what converter for standard retro gamepad to develop.
Re: DIY MD/SMS/Atari/C= to USB adapter
I think Wiki page would be good, so users will know about this converter project.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
Two analog pins per port are setup in the pinout above, pins 5 and 9 of both ports (used by paddles) are connected to analog pins. I will at least implement the "common" retro gamepads, like nes and snes still. I can create a wiki page, no problem!Sorgelig wrote:I was busy by cores, so didn't start yet.
From your post i see only one Analog input per port which is not enough. Need 2 analog pins per port
Actually i wanted to make a single port adapter with option to emulate a single joystick with paddles on X/Y and 2 joysticks - one per paddle for better compatibility. So basically one port should be enough for paddles.
I'm not really interesting in adapters for generic controllers as i think modern native USB/BT gamepads can do the job better. So i'm more interested in non-standard controllers like paddles, spinners - they aren't popular in modern gamepads.
So it's more up to you what converter for standard retro gamepad to develop.

Re: DIY MD/SMS/Atari/C= to USB adapter
Ah, sorry.. overlooked it. I will use your pinout.
Re: DIY MD/SMS/Atari/C= to USB adapter
Do we really need VCC on pin 7? I would use GND there. pins 5 and 9 would pulled up by resistor to VCC. This also will minimize risk of shortening VCC to GND using gamepad of other pinout. It also would be better from ADC point of view.witchmaster wrote:// Joystick Port 1
// DB9 Arduino Pro Micro
// --------------------------------------
// 1 TXO PD3
// 2 RXI PD2
// 3 3 PD0
// 4 4 PD4
// 5 A0 PF7
// 6 6 PD7
// 7 VCC
// 8 GND
// 9 A1 PF6
I don't know if VCC is really used by other interested accessories.
- witchmaster
- Captain Atari
- Posts: 150
- Joined: Wed Jun 15, 2011 10:50 am
Re: DIY MD/SMS/Atari/C= to USB adapter
VCC on pin 7 is not needed for passive joysticks, but for Atari paddles, the CD32 gamepad and joysticks with turbo fire it's needed. Most joysticks using this connector follow the Atari standard, with the exception being the Mega Drive/Genesis gamepad. Connecting that one shouldn't hurt since pin 7 for the Mega Drive is the "select" input pin, not an output.Sorgelig wrote:Do we really need VCC on pin 7? I would use GND there. pins 5 and 9 would pulled up by resistor to VCC. This also will minimize risk of shortening VCC to GND using gamepad of other pinout. It also would be better from ADC point of view.witchmaster wrote:// Joystick Port 1
// DB9 Arduino Pro Micro
// --------------------------------------
// 1 TXO PD3
// 2 RXI PD2
// 3 3 PD0
// 4 4 PD4
// 5 A0 PF7
// 6 6 PD7
// 7 VCC
// 8 GND
// 9 A1 PF6
I don't know if VCC is really used by other interested accessories.
The Atari paddles has a 1MΩ potentiometer connected between pin 7 (5V) and pin 5 for one paddle and pin 9 for the other. So as I understand it, 1MΩ resistors are needed between pins 5/9 and 8 (GND) to make a voltage divider.
Re: DIY MD/SMS/Atari/C= to USB adapter
Ok, no problem.
Pull down resistor is fine too. But the problem is another side of pot is not connected to GND. So it gives non-linear division..
Higher pull-down resistor - more linear values but lower range. And vice versa.
Pull down resistor is fine too. But the problem is another side of pot is not connected to GND. So it gives non-linear division..
Higher pull-down resistor - more linear values but lower range. And vice versa.
Re: DIY MD/SMS/Atari/C= to USB adapter
windows somehow sees 3 joysticks from arduino instead of 2
Re: DIY MD/SMS/Atari/C= to USB adapter
after many experiments with different pull down resistors i couldn't make it reliable. The only way to fix it is to connect 3rd (unused) pin of pot to ground (black wire on button). This is simple mod. The one who solder the connector to arduino micro can solder a single jump wire in the paddle.
Pot sliding from GND to VCC gives a nice linear range.
using pull down resistor has 2 major disadvantages:
1) non-linear range
2) non-fixed minimal value as resistivity of pot and pull-down resistor vary from piece to piece.
probably (1) can be minimized using ~4MOhm pull down resistor (i have no such resistor currently), but (2) is hard to fix.
Pot sliding from GND to VCC gives a nice linear range.
using pull down resistor has 2 major disadvantages:
1) non-linear range
2) non-fixed minimal value as resistivity of pot and pull-down resistor vary from piece to piece.
probably (1) can be minimized using ~4MOhm pull down resistor (i have no such resistor currently), but (2) is hard to fix.