Go Down

Topic: using arduino as a joystick (Read 2 times) previous topic - next topic


I'm Looking for a way to have Arduino recognized as a joystick on my computer. I am running windowsXP and an Arduino mini v4 with analogue input from a three axis accelerometer. I want the x and y axes of the accelerometer to map to joystick axes to be used in a program that only recognizes a joystick. Any help? Bits of code would be greatly appreciated, as I am new to this. Thanks.


Computer joysticks come in qiute a few different flawors.

Old ATARI style joysticks are basically just 4 switches triggered by the joystick handle.

Then there are the potentiometer joysticks, X and Y axis are each connected to a potentiometer.

Then again there are digital joysticks. And USB joysticks acting like HID devices.

Some require a driver installed on the computer some does not. So you need to find out which type of joystick your computer is looking for, or even better, figure out what kind of signals a joystick already working with your program is sending to the computer.

This is not much af an answer, but i hope i will get you looking in the right direction.



Have fun. :)

Thats for a standard joystick port. Go buy some digital potentiometer to drive it.
You probably wont be able to make it act like a USB joystick easily.


Youre on the right track with the above information.  To get USB connectivity you can get a Game Port to USB converter.  something like this may work:

Note that that is just the first one that showed up in google.  There are probably many others out there that are cheaper or may work better.



I need to use my arduino as a USB joypad (I really only need the buttons, no levers) so that some events from sensors could be sent to a GTK/SDL app on my PC.

Please note that I _do not_ need to connect a joypad to my arduino.

I was wondering if some progress was made from 2007 (last message from this thread).

I could also try other approaches (e.g. have my arduino detected as an extra keyboard).


If you hook up your Arduino via the USB-port, due to the USB converter on the Ardiuno it'll appear as a serial device. For keypads, mice and joysticks, the Device should identify itself as class HID (Human Interface Device). There are some solutions to do that in software, but it's not as good as those processors which offer a USB-stack in hardware.

If you look for "Arduino USB HID" you'll find plenty of information on the matter.



If you can live the keyboard way of doing it, hacking a USB keyboard is not too difficult.

Inside many USB keyboards there is a smal circuit board with a key matrix wih X coloumns and Y rows. Shorting a row to a coloumn is what happens when a key is pressed.

This could easily be done with an arduino and some 4066 switch IC's or if you need many of the keyboard keys a couple of 4051 mux IC's could be used to make a 8 by 8 "matrix", but with only one key on at a time.


Thank you for the info. BTW it's an Arduino Uno, I'll have to experiment a bit


I need to use my arduino as a USB joypad (I really only need the buttons, no levers) so that some events from sensors could be sent to a GTK/SDL app on my PC.
Please note that I _do not_ need to connect a joypad to my arduino.

You are probably going to have your work cut out for you making an arduino appear as a game pad. Not sure really what you are looking for. I suggest you connect your sensors to the arduino, then have the arduino operate the buttons on a slightly hacked gamepad like below, which is attached to the computer.

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview