CoreMidiControl

PS2/HW controller interface for iOS

Introduction

CoreMidiControl is a simple AVR microprocessor based project for hooking up a PS2 controller to an iOS device that supports CoreMidi. Apple iOS doesn't provide support for attaching game controllers directly into iDevices. This project overcomes the limitation by implementing a hardware device that pretends to be a class compliant MIDI device. Controller movements and button presses are then transferred via MIDI messages and converted back to controller events on the receiving end.

Included library also supports sending custom data packets from iOS application to the microcontroller. This can be used to implement any custom HW interfaces, such as controlling a coffee machine with iOS application.

Included in the project is a sample application for iPad that displays controller thumbstick movements and button states. I've also included a patch for DOSpad v1.96 that lets you play DOS games with PS2 controller via joystick or arrow pad emulation. Also included is a patch for iMame4All that lets you play old arcade games with PS2 controller.

Although the iOS API supports multiple players (controllers) the hardware part doesn't. However, adding support for additional controllers, mouse etc should be trivial.

Also included is an Arduino project for emulating iCade controller with the same hardware setup (works out of the box with many iOS games).

Version history

Demo time

Disclaimer

Don't connect anything to your precious iDevice unless you're 100% sure that it's not going to fry your device!

Licence

Feel free to do whatever you want with my CoreMidiControl iOS library but notice that it's using CoreMidi library by Pete Goodliffe. Also, the hardware part utilises code from V-USB, AVR-MIDI and PS2 controller projects. So if you're planning to do anything commercial, consult the other projects for licensing terms.

Credits

Notice that I haven't asked for distribution rights for these software components so please use this project only for study purposes or see the individual projects to learn about their licences.

Prerequisites

You are familiar with:

  1. AVR microprocessors
  2. V-USB project
  3. iOS

Build instructions

Arduino

  1. Build circuit for V-USB. I'm using a solution with two Zener diodes.
  2. Copy the PS2 and USB libraries from "Arduino/iPadCoreMidi/libraries" to your Arduino libraries directory.
  3. Open the iPadCoreMidi project.
  4. Set the desired pin configuration for your PS2 controller. I've used (14,15,16,17).
  5. Set the desired pin / device configuration in "libraries/USB/usbconfig.h".
  6. Build and deploy.

If instead you want to emulate iCade controller, do the following steps:

  1. Copy the PS2 and USB libraries from "Arduino/iCadePS2Controller/libraries" to your Arduino libraries directory.
  2. Open the iCadePS2Controller project.
  3. Set the desired pin configuration for your PS2 controller. I've used (14,15,16,17).
  4. Set the desired pin / device configuration in "libraries/USB/usbconfig.h".
  5. Build and deploy.

iOS

  1. Compile and deploy the "iPad/CoreMidiControl/CoreMidiControl.xcodeproj" to verify that your Arduino setup is working.
  2. To patch DOSpad (1.96), download DOSpad from the online repository (http://code.google.com/p/dospad/), add CoreMidiControl to the project and replace/patch "DOSPadBaseViewController.h" and "DOSPadBaseViewController.m" with the files in "iPad/DOSpad" directory.
  3. To patch iMame4All (1.10.0), download iMame4All (http://www.lesbird.com/iMame4All/iMame4All_Xcode.html), add CoreMidiControl to the project, add CoreMidi framework and replace/patch "EmulatorController.h" and "EmulatorController.m" with the files in "iPad/iMame4All" directory. If you flash the iCade project to your microcontroller, you don't need to patch iMame4All as it natively supports iCade controller. However, for proper analog controls you need to use CoreMidiControl.

Usage instructions

After you've launched the application with CoreMidiControl support, connect the microprocessor using Apple Camera Connection Kit. You might need to use a powered USB hub to provide enough power. When CoreMidiControl recognises the device, it will pop up a dialog saying "Controller attached". After that you're ready to go.

In DOSpad, attach the controller to start. pressing the SELECT button will toggle between joystick and keypad emulation modes.

in iMame4All, select "Start CoreMidiControl" from options menu and attach the controller to start.

Download

Download CoreMidiControl v1.2 HERE

Contact information

Mikko Kankainen
mikko.kankainen(at)iki.fi

Web Counter
Web Counter