Jump to content
IGNORED

Stingray: Nintendo Classic controller adapter with keypad emulation


Danjovic

Recommended Posts

Another controller adapter, deeply based on MegaPlay, should support:

  • Analog Controller (using precise timing);
  • Digital Controller on D-PAD just like a Masterplay adapter;
  • Full keypad emulation;
  • Auto detected second controller adapter for games like Robotron
  • Independent Top/Bottom buttons on second controller.

 

Controls Mapping, one controller:

image.thumb.png.4e4e3f2f43cfd207e929d48b2890f98f.png

 

Controls Mapping, two controller emulation

image.thumb.png.dbf808709af47edcf8b6cb18ce83ca46.png

 

Second controller adapter consists of a P2 plug with DB-15 connector

image.png.3821f0c1465894b20424fc388bf2e9b9.png

 

Wii classic controller connector should be builtin in the board

image.png.3dce60df1ef5f2f4a18afb4c3020f8e9.png

 

 

 

  • Like 1
Link to comment
Share on other sites

Updated the board and schematic. Added a Reset button as it might come in handy for a "powerup operation mode" selection without having to turn the console on/off or disconnect/reconnect the interface. 

Stingray-schematic.png

Stingray-board.png

Edited by Danjovic
added info about reset button
  • Like 1
Link to comment
Share on other sites

Easiest way to deal with dual joysticks to control a single pair of axis is to add both values and saturate on lower and higher limits.

  lx=classic.leftJoyX();
  ly=classic.leftJoyY(); 

  rx=(classic.rightJoyX()<<1); 
  ry=(classic.rightJoyY()<<1); 
  
  combinedXaxis = lx+rx-32;
  if (combinedXaxis>63) combinedXaxis = 63;
  if (combinedXaxis<0)  combinedXaxis = 0;

  combinedYaxis = ly+ry-32;
  if (combinedYaxis>63) combinedYaxis = 63;
  if (combinedYaxis<0)  combinedYaxis = 0;

  combinedYaxis = 63-combinedYaxis;

Either axis will now return within the range 0..63 when moving respectively up->down and left->right.

The resulting value in terms of Pokey hline countings will be in the range of 5..220 obtained from a table with values pre-computed in order to get more sensitivity around the central position of the sticks.

uint8_t gammaCurve[64] = { // gamma = 2.0
5  , 12 , 18 , 24 , 30 , 36 , 42 , 47 , 52 , 57 , 62 , 66 , 71 , 75 , 78 , 82 , 
86 , 89 , 92 , 95 , 97 , 100, 102, 104, 106, 107, 109, 110, 111, 112, 112, 112, 
113, 113, 113, 114, 114, 115, 117, 118, 120, 122, 124, 126, 129, 131, 134, 138, 
141, 145, 149, 153, 157, 162, 167, 172, 177, 182, 188, 194, 200, 207, 213, 220 
}

 

Link to comment
Share on other sites

I am working now on code debugging but I can say that I am very close to a functional release.

2020_03_23_120328.jpg.791a01bab18baa01e24de8c572fb60bd.jpg

 

And I have updated the schematics. Freed one I/O pin by using one of the extra analog inputs from the Nano board to perform detection of the adapter for the second joystick port. Now with a couple of pins free I can add support for PS/2 mice and hence I have added a MiniDin connector on the board.

 

image.thumb.png.fcbe778e1e7cd0210feb65fa6af2bd17.png

Link to comment
Share on other sites

Just released an Alpha on github repository. So far I have tested:

  •  Combined Analog control (either right or left stick control the axes)
  •  Dual controller auto detection
  •  Dual controller (left stick control main axes, right stick control secondary axes, buttons X,Y secondary buttons
  •  D-Pad override over left stick to provide full digital control (like Masterplay)

 

Keypad emulation is yet to be tested on this prototype but it was verified to work on Megaplay.

 

alpha-release.thumb.jpg.aeef9d609a654b8e3ec5424d396ed0d3.jpg

Edited by Danjovic
added link to repository on github
Link to comment
Share on other sites

I have just released a beta version of the firmware, fully operational Also shared the PCB on OSHPark.

 

All features planned initially are working:

  • Full keypad emulation
  • Can use either analog stick (left or right) on single controller mode
  • DPAD works as a masterplay adapter (digital mode)
  • Can change automatically to dual controller mode for games like robotron
  • Do not depend upon internal potentiometer calibration

 

Features to improve:

  • Support for PS/2 mouse (connector provisioned at PCB)
  • Support for Wii nunchuck (add gesture control for start / pause)

 

I have invested plenty of time reading, investigating, designing, coding, testing, debugging and documenting this project, as well as Megaplay and even built a 5200 port emulator just for the fun, just for the challenge of solving a problem using a different approach. 

 

But now the deed is done and the time has come for me to move on to other projects, other platforms.  I really hope you folks enjoy the things I did as much as I enjoyed doing 'em.

 

But this is not a goodbye... I'll stick around! Less commited, though!

 

Cheers!

 

 

  • Thanks 1
Link to comment
Share on other sites

Danjovic, I would love to be able to play Robotron with the two sticks of a Wii Classic controller.  I would also enjoy playing Gorf with the left stick for horizontal movement while the right stick is for vertical movement...

 

Definitely let me know when someone builds a few of these to sell.   Thanks! 

Link to comment
Share on other sites

  • 11 months later...

I have just uploaded a new version of the firmware.

  • Some bugs have been corrected, specially the deadlock condition caused by pin change interrupt on pin 9 of 5200 port (Cav control).
  • Using Classic controller library >0.8.1 . From version 0.8.1 the axes values are always returned in the range 0-255, even for knockoff controllers that can only operate in low resolution mode.
  • Added a non-linear curve, that in practice provides a sort of dead band on the center and gets steep at the extremes. The curve saturate close to the edges to compensate some controllers that can not return in full range, even in high resolution mode.

6027971616294089476.png

  • Corrected the code that adds the movement of left and right sticks in single controller mode.

The resistor R1 shall be the value changed to 1K ohm so the LED on pin 13 of some Arduino Nanos does not interfere with Cav control.

Thanks  @Chris Belcher for the feedbacks!

Edited by Danjovic
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...