Introduction: Control Arduino Functions With a USB Controller, No Soldering Required- I Made It at TechShop

Picture of Control Arduino Functions With a USB Controller, No Soldering Required- I Made It at TechShop
Earlier this year I decided that it would be fun to use my wired Xbox 360 controller to control Arduino projects- in this case, an RGB LED. However, the most commonly used method to do so involves accessing the electronics inside the controller to directly interface it with the Arduino. I decided to take a different approach: using a program called Xpadder I can have the computer interpret controller button presses as keyboard strokes. From there, Processing can read those keystrokes and send them to the Arduino from which any number of actions can be programmed to be controlled.

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

Pros: Easy to do with a low barrier to entry, cheap and there's no risk of damaging your controller.

Con: Because a computer is being used as an intermediary between the controller and the Arduino, as it's interpreting button presses as keystrokes which are fed into Processing, the computer is required; with this method you can't have a standalone Arduino and controller. If that's what you want then you'd likely need to alter the controller to plug directly into the Arduino.

Last note: I'll be specifically talking about the wired Xbox 360 controller and some of the weird little issues that can come up with it, but I don't see why this couldn't apply to any USB controller.

I made this project over at TechShop (

Step 1: Software/hardware

Picture of Software/hardware

Computer and keyboard (USB keyboard and built-in laptop keyboard tested to work)
USB controller
Arduino/breadboard/hookup wires

Xpadder 5.3 (see next step)
Arduino software

Step 2: Mapping Buttons With Xpadder

Picture of 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

Picture of 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. is the Processing file, and is the Arduino file.

Step 4: Put It All Together and Run It!

Picture of 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:



remember_orwell (author)2014-01-06

Hey there! Thanks for this instructable - but i can't find the and files anywhere! whre do i download this?

khietman (author)remember_orwell2014-04-23

Sorry for the late reply, but both files are downloadable as attachments in Step 3. You may need to be browsing in a desktop browser to see them.

vsivakumar (author)khietman2015-04-07

You said that the Xpadder will interpret the xbox controller as keyboard strokes does that mean that you cannot get analog inputs from the sticks and trigger from the xbox controller using this method because I want to control a quadcopter.

EdwinM1 (author)khietman2014-09-24

I see nothing on Step 3. Were exactly is?

jmercadoc (author)2015-02-02

how do you connect the computer to the arduino i've tried this but i still cant manage to light my led. pls help

mmontemor (author)2014-10-25

Could you make the code downloadable somewhere, please?