Jump to content
IGNORED

Next hardware project: snes2joy


ivop

Recommended Posts

Hi all!

 

While I'm waiting on parts for the MIDI Interface, I spent the last couple of days working on a new hardware project (and avoiding working on a huge software project I'm also working on ;)).

 

Prototype:

 

post-20947-0-00876800-1505582974_thumb.png

 

PCB:

 

post-20947-0-84894200-1505582982.pngpost-20947-0-55794200-1505582990.png

 

The SNES connecter's 3D model is a little borked (wild guess: some normals are flipped), but you'll get the idea.

 

Current firmware maps the D-Pad to its four directions, L to up, R to down (handy for diagonal jump games) and all other buttons to fire. This should make any SNES (compatible) controller work like a normal Atari Joystick.

 

There is however an extension. Select/Y/B are connected through 3 resistors to POTA. The same goes for X/A/Start and POTB. The resistors are chosen in such a way that all eight combinations of the three buttons can be clearly determined. Note that this is not a resistor DAC, because that would result in eight different voltages, but Pokey measures current at +5V. The firmware only outputs 5V "into" the resistors if the button is pressed. Otherwise the pin is tri-state (i.e. not connected) and the connected resistor is ignored. That way, eight currents can be measured by Pokey and the values are sufficiently apart. Several factors influence the actual readings, e.g. temperature, resistors used and Pokey itself. Therefore if a game was to be written to utilize these buttons, it has to calibrate itself first.

 

BTW J1 is an Arduino Nano (Clone), which can easily be programmed over USB (connector is already mounted on the Nano's PCB). I have decided to just piggyback it on top of this board, because I can never match its functionality for €2,=, which is what it costs to buy one from China, incl. S&H.

 

All files will be released eventually and will be open source.

 

Regards,

Ivo

  • Like 13
Link to comment
Share on other sites

Could firmware support a mode by which the A8 configures the button line as an output?

When this is low, the 4 joystick lines reflect the Up/Down/Left/Right states as usual.

When it is high, the 4 button states are output on the joystick lines instead.

 

[Edit] Start/Select would then be mapped to the two pots, going low when presses.
This could use a switch to permit the compatible mode to be used also.

 

Existing s/w could be patched for playing with multi-button support.

Edited by Wrathchild
  • Like 2
Link to comment
Share on other sites

Sadly, the trigger inputs are handled by GTIA and cannot be set as outputs. But I see where's your going. It's way easier to read the buttons without the need to calibrate your POT readings.

 

The firmware could easily support different operating modes though. There's a reset button on the Nano, so pressing reset while holding a button combination could be used to select different modes.

 

A variation on your idea could be that snes2joy alternates between sending UDLR and ABXY, the first one without setting the trigger bit and the second one with the trigger bit set. Alternate, say, every 32 microseconds and the Atari should be able to sync to it and read both values within the duration of one scanline.

  • Like 1
Link to comment
Share on other sites

I have always advocated that 2600/A8 games _must_ be played with a joystick but I totally love the SNES controller since it is so wonderful when playing SMW.

 

So I want one :)

 

What would be really cool is the possibility to make one of the buttons act as the space bar as this is the second action "button" in games like Dropzone. Could a OS hack be made to do that so it is "transparant" for the games ? I guess some games probably scan the keyboard at a very low "level" ? not sure about that.

Edited by Level42
  • Like 1
Link to comment
Share on other sites

Yeah, I agree that a joystick has more of the period feeling and reminds me of the eighties where I wrecked them (and my arm) by playing Decathlon :)

 

I also agree that the SNES controller is wonderful and IMHO the best controller up to the 16-bit consoles. They are still easily available. Mostly clones though, with varying level of quality.

 

As for the space bar, it indeed depends on whether the game uses the keyboard handler or not. Well, in the end, everything can be patched ;)

 

Suggestion for other modes of operation (of snes2joy I mean) are welcome!

 

Guess it could be nice to have one with auto-fire, i.e. A = single shot and B, X and Y "press" the fire button repeatedly at various frequencies.

 

 

 

Edit: perhaps should add an RGB LED to indicate which mode it is in? I have four GPIO pins left.

Edited by ivop
  • Like 2
Link to comment
Share on other sites

Hello guys

 

If you want to switch pins to output, why not use "Multijoy-Technology". The multijoy can select up to 16 joysticks. Let's say you only want 8 SNES-controllers max. That would mean you'll have 8 PIA pins per SNES-controller, 4 for Up, Down, Left and Right and 4 for the extra buttons. Plus two fire button signals. That should be enough for 6 buttons.

 

Ofcourse, the hardware doesn't have to support 8 SNES-controllers. It's just the max you could use using this methode. If you'd make the hardware such that it only supports one SNES-controller (but uses two joystick ports), it should even be possible to use multiple "SNES-adaptors" together with the Multijoy-Interface.

 

Sincerely

 

Mathy

  • Like 2
Link to comment
Share on other sites

Ivo, maybe a stupid question: do you use through-hole parts for a reason ? You assemble the PCB yourself ? I assume that saves money in production ?

 

Yes, having it assembled in China would cost more. But the main reason is that it's fun to build it yourself :) Also, it makes for a nice beginners project. SMD would not save much space anyway in this design.

  • Like 3
Link to comment
Share on other sites

If you want to switch pins to output, why not use "Multijoy-Technology". The multijoy can select up to 16 joysticks. Let's say you only want 8 SNES-controllers max. That would mean you'll have 8 PIA pins per SNES-controller, 4 for Up, Down, Left and Right and 4 for the extra buttons. Plus two fire button signals. That should be enough for 6 buttons.

 

Ofcourse, the hardware doesn't have to support 8 SNES-controllers. It's just the max you could use using this methode. If you'd make the hardware such that it only supports one SNES-controller (but uses two joystick ports), it should even be possible to use multiple "SNES-adaptors" together with the Multijoy-Interface.

 

I have considered using two joystick ports, but decided against it because I want the interface to work out-of-the-box as a "normal" joystick. No patching, just plug and play. In this compatibility mode, the other buttons can be read through the POT inputs. This allows for games to be "slightly patched" to make, let's say, the start button work as expected, but this is not necessary.

 

Non-compatible modes, selectable by holding a certain button when powering on, are of course free to do what they want. I think I'll go with the endless stream idea, synced to a clock signal on the trigger line, which I formulated earlier.

 

This interface, in default mode, should work as a normal joystick through a multijoy BTW.

  • Like 1
Link to comment
Share on other sites

Hmmm, I really disliked having to calibrate the POT readings for every combination (would be 8 readings per POTx, so 32 if you had two controllers!).

 

So, I changed the circuit a little. Now the compatibility works without callibration, but at the expense of not being able to read B and Y when Select is pressed and A and X if Start is pressed. That's not a big deal IMHO, because why would a game want those combinations anyway? When start or select are pressed, most of the time game pauses or brings up some kind of options menu. I cannot think of any game on any platform where you would have to hold the start or select button while fiddling with other buttons during gameplay. So now you can read B, Y, B+Y, Select on POTA and A, X, A+X, Start on POTB.

 

In extended mode/endless stream mode (how should I call this?) you can still read every combination you manage to press :)

  • Like 7
Link to comment
Share on other sites

  • 4 weeks later...

10 PCBs have arrived.

 

BOM: (9p pin header not shown)

post-20947-0-93869900-1508677058.png

 

Solder resistors:

post-20947-0-73370000-1508677057.png

 

Use hacksaw to get two rows of 15 pins/holes:

post-20947-0-89978100-1508677056.png

 

Solder pin headers to Arduino Nano. It's easiest to put the headers in a breadboard, so you can be sure they are solder on straight:

post-20947-0-14051600-1508677056.png

 

Forgot to photograph soldering on the SNES socket.

Put finished Arduino in female headers, again, so you can be sure they are solder straight on the PCB:

post-20947-0-02187200-1508677055.png

 

Et voìla:

post-20947-0-79439900-1508677053.png

 

Two small leds (green is compatibility mode, red is alternative mode):

post-20947-0-67466400-1508677052.png

 

9p male pin header:

post-20947-0-81294900-1508677051.png

 

Flash firmware, finished:

post-20947-0-88223200-1508677050.png

 

Instead of a 9p pin header, you can also solder an old cut-off joystick cable directly to the PCB. They need to have ALL 9 pins connected. Some joysticks only pass through GND, trig and the four directions.

 

Now I'm deliberating on what to offer and at what price. I'm considering:

 

1) PCB + parts (kit) for those who want to DIY (firmware flashed already)

2) Fully build, except for the joystick cable (or send me one with all 9 pins passed through and I connect it to the PCB)

3) 1 or 2 of the above, including a clone SNES controller (might get a reduced price if I order a bunch at once)

 

plus shipping and handling...

 

BTW yesterday we tested the device on an Atari 2600 and a Commodore C64 and both worked flawlessly.

Edited by ivop
  • Like 5
Link to comment
Share on other sites

BTW2 I'm also going to draw a PCB with the connector reversed, because all suppliers supply pairs of connectors and one of them is mirrored:

post-20947-0-37970900-1508681216_thumb.png

 

Bending the pins to match the other is possible, but a pain in the neck and breaking a pin is too great a risk IMHO.

 

 

Edit: oh, just took a better look at the connectors and I can easily turn the pins 180 degrees. No need for a second type of PCB :)

Edited by ivop
Link to comment
Share on other sites

10 PCBs have arrived.

 

BOM: (9p pin header not shown)

attachicon.gifstep01.png

 

Solder resistors:

attachicon.gifstep02.png

 

Use hacksaw to get two rows of 15 pins/holes:

attachicon.gifstep03.png

 

Solder pin headers to Arduino Nano. It's easiest to put the headers in a breadboard, so you can be sure they are solder on straight:

attachicon.gifstep04.png

 

Forgot to photograph soldering on the SNES socket.

Put finished Arduino in female headers, again, so you can be sure they are solder straight on the PCB:

attachicon.gifstep05.png

 

Et voìla:

attachicon.gifstep06.png

 

Two small leds (green is compatibility mode, red is alternative mode):

attachicon.gifstep07.png

 

9p male pin header:

attachicon.gifstep08.png

 

Flash firmware, finished:

attachicon.gifstep09.png

 

Instead of a 9p pin header, you can also solder an old cut-off joystick cable directly to the PCB. They need to have ALL 9 pins connected. Some joysticks only pass through GND, trig and the four directions.

 

Now I'm deliberating on what to offer and at what price. I'm considering:

 

1) PCB + parts (kit) for those who want to DIY (firmware flashed already)

2) Fully build, except for the joystick cable (or send me one with all 9 pins passed through and I connect it to the PCB)

3) 1 or 2 of the above, including a clone SNES controller (might get a reduced price if I order a bunch at once)

 

plus shipping and handling...

 

BTW yesterday we tested the device on an Atari 2600 and a Commodore C64 and both worked flawlessly.

 

I'd be interested in options 2 or 3.

Link to comment
Share on other sites

Update: Now that I'm also getting into 3D modelling and printing, I'm thinking about creating an enclosure for this project as well. Also, the idea of people sending me 30 y.o. cut-off joystick cables that might or might not work is putting me off.
I could modify the board for something like this (idea of SenorRossie), but that still doesn't fit our joystick port correctly. So how about 3D printing DB9 connectors without the mounting flaps/wings/whatever they're called? I've googled around, but no models seem to exist. Only shells for modern DB9 connectors. I think it must doable, so I'm looking into this next week.

 

Edit: hmm, where did I store the Atari joystick patent of which I borrowed an image for my avatar. Perhaps it contains a proper dimensions diagram of the connector, too?

Edited by ivop
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...