USB Game Pad With Tilt-accelerometer Mouse

 by adafruit
Featured
done.jpg
 
Make a game pad with an accelerometer inside!

This project tutorial will show you how you can convert a console game pad into a USB keyboard mouse for playing games on your PC. The USB game pad can be used with nearly any software, such as a MAME emulator, game, simulation software, or for custom user interfaces.

We'll start by turning the buttons of the game pad into keyboard buttons, so that pressing 'up' is converted into the 'U' key, for example. The firmware is easily adaptable, so you can adjust it for whatever software it will be used with.

Then we'll make the project more interesting by adding an accelerometer. This will allow the game pad to be used as a mouse by tilting it!

Credits

This tutorial including the original code and Portal video is by Devlin Thyne! Rock!



 
Remove these adsRemove these ads by Signing Up

Step 1: What You'll Need...

usbgamepadcontents_LRG.jpg

 
You'll need the following in order to build the project:

  • Game pad - We'll be using an SNES controller
  • Teensy - This is a very small microcontroller board that can act as a keyboard/mouse
  • Triple-axis accellerometer - We'll be using the nice ADXL335 on a breakout board. You can skip this if you're not planning to add in the mouse capability
  • USB cable with mini-b connector - to attach to the Teensy for plugging into a computer!
  • Ribbon cable - for all the soldering connections. Rainbow cable is the easiest to work with as its color coded

If you want to build the entire project, we have a project pack in the shop with all the parts listed above!

You'll also need some basic hand tools such as screwdrivers, wire strippers, soldering iron, solder, diagonal cutters, vise or third hand tool, etc.

All the code is on GitHub, including some extra sketches we've written so be sure to look there!

yolivas says: Mar 13, 2012. 6:47 PM
I want to do this to a GameCube remote, so how do I connect the analog sticks?
shakespeare1212 says: Aug 26, 2011. 11:42 PM
OK. I figured this one out. This menu option is no longer there as pictured, but what you should do is to select your teensy board, usually a teensy 2.0 and the go to another sub-menu, also on the Tools menu called, USB Type ... Select Keyboard + Mouse from this menu, and then you can proceed with the rest of these steps.
shakespeare1212 says: Aug 25, 2011. 12:25 AM
I have tried to follow these instructions carefully, but I don't see an option for the Teensy (USBKeyboard/Mouse) on my board menu. I do see teensy 2.0 and teensy++(2.0). What is the most likely the cause of that?
snehal0909 says: May 3, 2010. 1:47 AM
why do all this when you can buy a really good quality NEW usb gamepad for $20.
jetersaurous in reply to snehal0909Apr 9, 2011. 8:36 AM
you shut your mouth!!!
araemo in reply to snehal0909Feb 14, 2011. 4:28 PM
Can you actually? I haven't seen a single USB gamepad with a decent D-pad. They all have the horrible design (where it's hard to deliver a 'pure' up/down/right/left because they wobble back and forth between two switches at once) because the good designs are still under nintendo or sony patents.
purpulhaze in reply to snehal0909Jun 27, 2010. 6:41 AM
What would you learn from just buying one?
inventordude14 in reply to snehal0909May 12, 2010. 4:20 PM
 Its more fun to build than to buy! :)
LittleWolf in reply to snehal0909May 5, 2010. 4:56 PM
Good easy project for people like me that's learning about electronic modification, too.   :3
jgrove1975 in reply to snehal0909May 4, 2010. 9:26 AM
it is done, because it can be done.  It is recycling something  that some of us have sitting around in a closet without any use anymore because we dont play Super Nintendo anymore.
onlinedevil in reply to jgrove1975May 7, 2010. 4:49 PM
=( why aren't you playing your Super Nintendo anymore? It's lonely and it needs love.
tp1l says: Feb 14, 2011. 9:40 AM
One option if you wanted to do this one the cheap would be to hack the buttons into the inputs of a USB keyboard. Just break open a keyboard and trace out eh leads on the membrane from all of the keys you need, and wire them up directly to the gamepad buttons.

The big downside is that it would likely involve a care mod to fit the keyboard PCB in with the rest, or I suppose you could run all of the switch leads in a thicker cable to the keybaord PCB in a separate housing.

Whether or not this is worthwhile is probably a factor of your budget. It'll add some hassle but save $20 for the Teensy.
Icalasari says: Feb 12, 2011. 5:43 PM
...This will make playing gameboy games a LOT easier
Foaly7 says: Oct 29, 2010. 1:35 PM
I think that this would be even better wireless, maybe bluetooth that plugs into the computer on one end, for people who have XBMC computers attached to their TVs.
mcrjig says: Apr 29, 2010. 10:03 AM
could you do this with a N64 controller?
Undead in reply to mcrjigMay 2, 2010. 2:14 PM
Thats what I wanna know too!
b4andafter5 in reply to UndeadSep 6, 2010. 5:50 PM
Check out http://raphnet.net/electronique/gc_n64_usb/index_en.php
andreq says: May 6, 2010. 7:23 AM
Nice instructable !

I've done the same thing some time ago with a "full" DIY version :

You have 2 possibilities :

1 - raphnet.net/electronique/snes_nes_usb/index_en.php
he use an atmega 8 with a xtal for the pad-usb conversion. It's a nice idea, but the overall size of the project (if you do it without a PCB) is a tad big to fit inside the pad.

2 - translate.google.ca/translate
He use a small Attiny 45 with internal osc for the pad-usb conversion. I've used this method for my own pad. It fit quite easily in a SNES gamepad. I didn't have any Attiny45 on hand, but I had some Attiny25... I've managed to make the code smaller and include the auto usb calibration. It was quite a tight fit in the 2k memory!  I'll try to post my modified files for you to enjoy.

I might even post an instructable if I have some spare time.

andreq in reply to andreqMay 6, 2010. 7:25 AM
Here's the second link :

http://translate.google.ca/translate?hl=fr&langpair=de|en&u=http://hobbyelektronik.org/w/index.php/SNES-Joypad

ai3sixers says: May 3, 2010. 1:30 PM
Hi, cheers for an excellent Instructable. Was wondering, can this be easily applied to a Sega Mega Drive 6 button gamepad?
Ben Harden says: Apr 28, 2010. 3:20 PM
Looks great! I'll have to try this some time.
samirsky says: Apr 28, 2010. 5:04 AM
 Thanks!  Always enjoy your tutorials.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!