Jump to content
Sign in to follow this  

Stingray: Nintendo Classic controller adapter with keypad emulation

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:



Controls Mapping, two controller emulation



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



Wii classic controller connector should be builtin in the board





Share this post

Link to post
Share on other sites

Still working on code, I kept the L and R buttons as Top and Bottom to make two joystick gaming easier.

Changed 3.5mm stereo jack to USB A socket to allow control of buttons on the second joystick. Adapter cables can still be easily built.




Share this post

Link to post
Share on other sites
Posted (edited)

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. 



Edited by Danjovic
added info about reset button
  • Like 1

Share this post

Link to post
Share on other sites

I should apply a gamma curve to the analog axes read from Classic controller to make the response of the stick more subtle near the center and more abrupt close to the edges.

The curve below depicts the values from middle scale up to the growing edges (down and right) for two values of gamma.



Share this post

Link to post
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.


  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 


Share this post

Link to post
Share on other sites

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



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.



Share this post

Link to post
Share on other sites
Posted (edited)

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.



Edited by Danjovic
added link to repository on github

Share this post

Link to post
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!





Share this post

Link to post
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! 

Share this post

Link to post
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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...