Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Multi-USB Controller Encoder  (Read 795 times)

0 Members and 1 Guest are viewing this topic.

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:December 20, 2023, 09:16:09 pm
  • Just call me Rob!
Multi-USB Controller Encoder
« on: December 03, 2023, 12:37:19 pm »
Multi-USB Controller Encoder



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.



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.





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.







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


wordsworth

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 97
  • Last login:March 26, 2024, 06:20:13 pm
  • ...was severely wounded, but the soul still burns
Re: Multi-USB Controller Encoder
« Reply #1 on: January 07, 2024, 01:29:02 pm »
Looks very nice!

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7916
  • Last login:June 03, 2024, 11:25:23 am
Re: Multi-USB Controller Encoder
« Reply #2 on: January 07, 2024, 06:23:55 pm »
This is really neat.

jimdeprado

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:April 09, 2024, 11:21:42 am
  • I want to build my own arcade controls!
Re: Multi-USB Controller Encoder
« Reply #3 on: January 09, 2024, 09:05:34 pm »
Very nice!  I'm excited to see if you can get it to control an Atari 2600 joystick or paddles.