Multi-USB Controller Encoder

The place for all discussion on gaming hardware
Post Reply
rCadeGaming
Posts: 242
Joined: Mon Dec 05, 2011 12:04 am

Multi-USB Controller Encoder

Post by rCadeGaming »

Multi-USB Controller Encoder

Image

This is a project I created to allow a variety of controllers to connect to a variety of game consoles.

Inputs:
  • Arcade Stick
  • NES Controller
  • SNES Controller
  • Sega Genesis/Mega Drive Controller
  • Playstation 1/2 Controller
Outputs:
  • PC
  • Playstation 3
  • Playstation 4
  • Playstation 5 (need to add a Brook PS5 update kit)
  • XBox 360
  • XBox One
  • Nintendo Switch
When output mode is set to PC, the microcontroller connects directly to the PC as a USB keyboard. When output mode is set to PS/XBox or Switch, the microntroller passes inputs to the external encoder which connects to the console as a controller. In either mode, inputs are debounced and remapped according to a button map by the microcontroller before output.

This may be configured for use with a variety of AVR microcontrollers and button encoders, but is intended for use with a Teensy++ 2.0 development board (Atmel AT90USB1286 AVR microcontroller) and Brook Universal Fighting Board button encoder (not required for PC use).

Features:
  • Output Mode switch (should be selected before plugging in):
    • PC
    • PS/XBox
    • Switch
  • Configurable button maps
  • Button maps may selected at any time by holding...
    • Arcade Stick: button 12 and a joystick direction
    • Controller: start, select/mode and a d-pad direction
  • Player Select switch (1-4, may be selected at any time)
    • PC mode: changes current and available button maps (intended for use with MAME)
    • Console mode: selects d-pad, left stick or right stick for directional inputs
    • (this is default behavior; can be reconfigured in button map)
  • Aux Input
    • Connection to up to 3 additional inputs
    • Intended for use with coin mechs
  • Lag-free debouncing
  • High polling rate:
    • USB Keyboard Polling Rate:
      • Arcade Stick: 21kHz
      • NES Controller: 18kHz
      • SNES Controller: 15kHz
      • Genesis Controller: 1.6kHz
      • PSX Controller: 3.7kHz
    • External Encoder Update Frequency:
      • Arcade Stick 20kHz
      • NES Controller 17kHz
      • SNES Controller 14kHz
      • Genesis Controller 1.6kHz
      • PSX Controller 3.7kHz
    • polling rates are approximated to two digits
    • external encoder update frequency refers to how often new inputs are presented to external encoder
Open source code, documentation, notes, and hi-res pictures can be found in the BitBucket repository linked below:
https://bitbucket.org/puddlez/multiusbcontrollerencoder

---

Hi everyone. Long time, no post. In the past few years, I've been unable to make a lot of time for hobbies due to a hectic personal and work life. When I do manage to fit in an hour or two here or there, I work on things like this. This project has been done for a while, and I figured it was time to properly document it and get back online to share it. I also wanted to make this open source in hopes that others can make use of what I've done. If anyone is interested in replicating this or making your own variation, please document and share your results here.

The idea for this originally came about when I was trying to rewrite the code for some KADE Encoders I had sitting around to make my own keyboard encoders for use with MAME. This led me to start working more with AVR microcontrollers in embedded C, which was kind of the next step after some previous experience with Arduino. Around the same time, I started running into some other use cases I didn't have a solution for - connecting a Genesis Controller to a PC; connecting my arcade sticks to a PS4; connecting a Super Nintendo controller to my Switch; doing all this with proper debouncing and effective button mapping. Eventually, I figured out how to roll all this into one project and this is the result. I upgraded from the KADE encoder's Atmel ATMEGA32U2 to an AT90USB1286 with more pins, and wrote my own code from scratch, with the exception of PJRC's USB Keyboard library (this is credited in code - see UsbKeyboard.c).

Now that this is done, the next step is to make something similar that will work with all my retro consoles. I'd like to start working with FPGA's and make that my first project. It may even include audio/video switching and transcoding from RGB to YPrPb component video and vice versa.

Some more pictures...

These are the controller adapters. They're easy to make with some controller extensions and d-sub connectors.

Image

Some more pictures of the encoder. The button in the back is the reset button for the microcontroller, which used when rewriting it for a code change or button map update.

Image

Image

Some pictures of the hand-soldered PCB, before and after adding the components and putting it in the enclosure. For my next project, I think I need to learn to use PCB fab services.

Image

Image

Image

This is the matching encoder PCB that goes in the arcade stick itself to work with the Multi-USB Controller Encoder. It is a very simple design using a few CMOS logic ICs, but can support extremely high polling rates. More details in another BitBucket repository linked below:

https://bitbucket.org/puddlez/17inputbuttonencoder

Image
PC Engine Fan X!
Posts: 8450
Joined: Wed Jan 26, 2005 10:32 pm

Re: Multi-USB Controller Encoder

Post by PC Engine Fan X! »

Any plans to include PC Engine/TurboGrafx-16 controller support as well?

PC Engine Fan X! ^_~
rCadeGaming
Posts: 242
Joined: Mon Dec 05, 2011 12:04 am

Re: Multi-USB Controller Encoder

Post by rCadeGaming »

It's doable. The pinout and protocol is available. Would just need to wire up an adapter and add a bit of code.
Post Reply