Recently, I finished a little do-it-yourself project: Inspired by this biorhythm article, I decided to build my own iCade-gameplay adapter. During the planing stage, I soon realized that it would be nice, if I could also use the adapter with other available emulators out there, as well as for two-player games.
I used a not-so-up-to-date Arduino board and a ProtoShield to start with. A little note for everyone who wants to build his/her own adapter: The current Arduino Uno has the capability to implement a USB HID-device with its on-board USB-socket. This might make the assembling easier. I took the USB-Keyboard project from the book “Practical Arduino” as starting point and ordered some components that I would need for soldering. Regarding the sockets for the controllers I first ordered some NES sockets. However, there are only two buttons for playing on the NES-controllers. This would be far too less for many games and I came to buy two SNES extension cables from which I used the sockets so that SNES controllers could be used for playing.
After a bit of soldering, glueing, and programming I made it work. I made use of the V-USB library for Arduino, which is free for private, non-commercial use. Since iCade games expect a key press event followed by a key release event for every single state change of the joystick and buttons, in “iCade-mode” the method from the V-USB library for sending key strokes was used as provided by the library. For “normal mode”, however, I created a modified version of the method such that endlessly repeating keystrokes were allowed. Key presses and releases were then implemented by directly controlling the USB report buffer from within the main loop. For the first player the buttons were mapped to the arrow keys and to the keys “1” to “8”. The buttons for player two were mapped to “A”, “S”, “D”, “W” for steering and to the keys ERTYUIOP. The key codes, which were missing within the V-USB library can be found in the USB HID usage table. For reading the state of (S)NES controllers there exist quite a few sites. This site was a great help for me. A on/off button is used for switching between iCade- and normal-mode. I put a snapshot of the source code into a Github repository. Two LEDs indicate the state in which mode the adapter currently is.
On the one hand, the adapter can be used to emulate a standard USB keyboard for playing games with emulators like, for example, ZSNES or Nestopia (for which also Mac versions exists). On the other hand, the adapter can be switched to an “iCade-mode”, which allows the use of the adapter with iOS games that support the iCade input. All you need is the camera connection kit, the adapter is powered over the USB connection.
Right now, many wires are too long. But the prototyping was lot more easier in this way. Here is a short video demonstration of the adapter:
My next project is to shrink the design and to put the whole thing into a case which is more pleasant to look at.
If you have any questions or comments, feel free to say or ask!
I’d love to get this working but I’m getting errors verifying the code. Maybe it’s the fact I’m using an Arduino UNO? I’ll go through the code one more time make sure I didn’t miss something.
thank you
where can i find your modified version of the usbkeyboard, with this changes: “..For “normal mode”, however, I created a modified version of the method such that endlessly repeating keystrokes were allowed. Key presses and releases were then implemented by directly controlling the USB report buffer from within the main loop…” ?
I have not provided the sources so far, but I would be happy to share them! I will prepare a repository for that on the Github site at https://github.com/petrockblog.
You can find the repository at https://github.com/petrockblog/iCade-SNES-Adapter.
Good luck with your project!
Hi! I downloaded the library and uploaded to the Arduino and whenever I plugged the usb cable widnows detects an unkown hardware and it says that has mal functioned and it does not install anything. Help please?
So i figure out that it was something with my protoboard connection … sigh…. so I fixed that, now it installed succesfully but it still stays as an unkown device and still no results in the notepad I have sued the example in the book Practical Arduino
if you are interested, I could prepare a small example in which an USB keyboard is provided by the Arduino with the V-USB library.. However, I could need two or three days for that.
Thanks that would be so great, I get it to work , I press the push buttons and types but it types a lot of characters and then it stops working. an example with the code would be great. How could I make the push buton to only type one character each time is pressed? I read that delay does not work with that library?
Hi,
I just posted a small demo project that makes use of the V-USB library. I hope this helps!
Hi , this is an awesome project! I’m trying to do something similar myself but I’m running into a lot of problems, as far as I know the library used in the Practical Arduino project is not compatible with the latest versions of Arduino, did you used Arduino Version 0016? . Also another quesiton that I have, do you think that it would be possible that instead of the remote controls we could have some sensors acting like buttons?. I would really much appreciate your help, I’m running out of places to look,
Hi Alejandro,
I am not 100% sure anymore, but I remember that I also encountered problems with the version mentioned in the Practical Arduino book. However, if you download the V-USB-version from http://code.google.com/p/vusb-for-arduino/downloads/list it should work with the Arduino 1.0 IDE. I am not sure about the copyright issues of the used libraries. Because of that I would not like to post the code or file. But if you post the error message(s) here, we could try to give you some assistance or hints.
I would recommend to first build the USB-keyboard part of the project. When everything’s working fine with that, I would go on and handle the interface for the controller(s)/sensor(s). And yes, you CAN use everything you can think of to generate control signals for the USB keyboard. I like the example project in “Making things talk” where a toy monkey is used to generate control signals for a pong game (http://books.google.com/books?id=K0nLbhWrTukC&lpg=PP1&hl=de&pg=PA73#v=onepage&q&f=false)
Thank you , I will try that. Do you know if I have to update the firmware if I’m using an Arduino UNO REV 3?.
Please help, I can not merge the library “usbkeyboard” and “snespad.” noob in programming. Post the code or send me a email, thanks in advance. I repeated, by analogy with “biosrhythm” code works on pc buggy, on ipad does not work.
Hi enderr,
could you give some more details about the problems?
Hi, I’m finished making the controller, everything works. The problem is CCK, it was not the original. wired inside the sd card controller (AU6438) that is stupidly hung in parallel on the same d+ d-. Thank you for your interest. sorry му english
Glad to hear that it’s working now! I don’t know what is meant with “CCK”, but I also had (at least once) the problem of pins being used twice. A possible source of errors that I also had to learn.
kudos! this is really wonderful! and i’m also a fan of the fact that the enclosure is made out of legos
Thanks a lot! The Lego enclosure IS charming and I am wondering, if I will like the laser-cut enclosure (which I am working on right now) more.
This is great! Glad to see the additional features added. Which keymap did you use for the emulators? Is it emulating the arrow keys on the keyboard? Does it handle key press/release differently than iCade? I wish the Arduino could speak Bluetooth HID and do this wirelessly. Also, I like the case but I may be a bit biased. ;-)
Hi Paul,
thanks a lot for your interest! I added some more information above that should answer your questions. If it does not, say so ;-)
Hmmm, I like the idea of a wireless controller!