

This is what I'll specifically be making in this instructable:





Step 1: Software/hardware

USB controller
Arduino/breadboard/hookup wires

Xpadder 5.3 (see next step)
Arduino software

Step 2: Mapping Buttons With Xpadder

The first step is to download Xpadder, the program that maps controller button presses to keyboard strokes. There are other programs that do the same thing, such as Joy2Key, but this is the one I'm most familiar with. It's Windows only, and I don't know if there are any equivalent programs on Mac.

Xpadder 5.3 and below are freeware; anything later costs $10. This version can be downloaded here.

Plug in your USB controller, install Xpadder to a directory and open it. Xpadder may not work properly on a 64-bit system running Windows 7 or 8, but I've had success right-clicking Xpadder.exe, selecting Properties and running it in Vista compatibility mode. Xpadder should auto-detect your controller. To begin, select the small controller icon in the top left and choose New.

Now begins the mapping. Each area of the controller (sticks, buttons, triggers, etc.) are sectioned off into different tabs. Each needs to be enabled by checking the small box; after doing so Xpadder will prompt you to press a certain direction on the stick or dpad. The Buttons tab is even more straightforward, just press buttons and they'll appear on the screen. You can drag the icons around, which I highly recommend to stay organized. Remember that when mapping buttons, on the Xbox 360 controller clicking the sticks in also counts as separate buttons. Once you're done mapping everything, select Finish.

This will bring you back to the main Xpadder screen. By default Xpadder will have mapped all of the buttons to various keys on the keyboard, which should be fine. Save this as a profile by clicking on the controller icon again and selecting Save As. I've attached my profile file, which is just dropped in the main Xpadder folder.

Step 3: Processing/Arduino Programming

This part's fairly straightforward. In the Processing code you can see that I've assigned each keyboard key a numerical value. When that key is pressed it'll be sent over to the Arduino. On the Arduino side of things, each value has a function that will be performed while it is active; here, I've mapped every value to display a different color on the RGB LED. For your own project you can of course replace that code with anything else you might have in mind.

I won't copy/paste the code here because of how long it is, so I've attached both files. rgbalphabet.zip is the Processing file, and xboxrgb.zip is the Arduino file.

Step 4: Put It All Together and Run It!

Let's finish this up! Hook everything up to the Arduino (I used pins 11, 10, and 6 for red, green and blue respectively) and make sure that everything is hooked up to the computer. Check that Xpadder is running and load the code into the Arduino. Finally, run the Processing script and you should be golden!

One last note about this process and using an Xbox 360 controller. For this to work, the Processing java popup that opens when the script is run has to be the selected window (the one on top). However, when you press the Guide button in the center of the controller it'll open a Windows popup on the screen displaying the controller's status and take over as the featured window. The best fix I found was to simply open Add/Remove Programs and uninstall "Microsoft Xbox 360 Controller Accessories." This only affects the (really quite useless) popup message specifically and won't touch the drivers, so the controller will still function just fine when playing a game.

Here is an example of how this sort of thing can be used. This is a project that I made and was the reason I went through this whole process in the first place:


About This Instructable




Add instructable to: