Arduino Project: Sega MegaDrive/Genesis controller to Windows/Linux (RetroPie) USB

Posted: 17/07/2016 in Arduino

Improve your retro gaming emulation experience by using the systems original controller.

This post provides instructions so you can bring back to life your old controller with native plug-and-play support for Microsoft Windows 7+ and Linux/RetroPie using an ATmega32u4 based Arduino.
File 10-07-2016, 13 49 04
File 10-07-2016, 13 49 23
Ever since Arduino’s started to appear with the ATmega32u4 chip which allows the creation of USB devices I’ve wanted to create adapters to reuse my old game controllers on modern hardware. Unfortunately the official libraries didn’t support joystick/gamepads only keyboard and mouse. Thankfully Matthew Heironimus started a project to address this exact situation with his Arduino Joystick Library http://mheironimus.blogspot.co.uk/2015/11/arduino-joystick-library.html.

Using Matthew’s library and the following sketch https://github.com/jfrmilner/Arduino-USBRetroGamingControllers/blob/master/SegaMegaDrive_GamePad_USB/SegaMegaDrive_GamePad_USB.ino you can easily create an adapter for your controller following these steps

1. Get a suitable connector. For this project you’ll need to search (eBay/Aliexpress) for a DE9 or DB9 Male Breakout board, this is the one I used
DB9
2. Find the pinout for your controller. PINOUTS.RU is a good source, for example here is the one for the MegaDrive Controller http://pinouts.ru/Game/genesiscontroller_pinout.shtml
3. Wire the connector to the Arduino. I’ve included the pin information in the Arduino sketch, so for example DE9 Pin1 goes to Arduino Pin 1 (Up).
4. Install Matthew’s library from https://github.com/MHeironimus/ArduinoJoystickLibrary. See https://www.arduino.cc/en/Guide/Libraries for more information.
5. Upload the Arduino Sketch and then connect your controller.
6. Test. Windows’s users should be able to see the controller appear as a gamepad which will be named after your Arduino board, for example.
Controller_DeviceAndPrinters
Windows provides a helpful test program on the properties page of the controller
Controller_DeviceAndPrinters_Properties
7. Play. For MegaDrive emulation I recommend the Fusion Emulator for Sega Systems (google fusion364)

Thanks for reading and be sure to check out my other controller conversions.

Kind Regards, jfrmilner

Comments
  1. Jon says:

    Hi!

    I saw the post on Arduino Blog about your project and was happy to see that you’re using my SegaController sketch! If you’re interested, I’ve since updated the code to be a lot more reliable: https://github.com/jonthysell/SegaController

    It also now natively supports SMS controllers!

    /jon

  2. Brandon says:

    Can this be done with a arduino nano?? Also, please add the circuit diagram so that it makes things a bit easier

    • jfrmilner says:

      This will only work on ATmega32u4 based Arduino as mentioned in the post. In my opinion a diagram is not required but if you do make one please let me know and I’ll add it.

  3. Daniel Morales says:

    Does it work with a Nano? uno? Etc?

    • jfrmilner says:

      This will only work on ATmega32u4 based Arduino as mentioned in the post. The most common ATmega32u4 boards are Arduino Micro and Arduino Leonardo but there are others, you will need to check the specification of the board if unsure. The Arduino Uno and most Nano board use an ATmega328P not an ATmega32u4.

Leave a reply to Jon Cancel reply