Pages: [1]   Go Down
Author Topic: using arduino as a joystick  (Read 2036 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 6
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

MikMo
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.epanorama.net/documents/joystick/pc_joystick.html
Have fun. smiley

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
http://www.trianglecables.com/usbtojoydbad.html

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bump.

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).
Logged

Central Europe
Offline Offline
Edison Member
*
Karma: 7
Posts: 1220
Use the Source, Luke.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Korman
Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 6
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

http://www.geeks.com/details.asp?invtid=PCJOYPAD-BLU-N&cat=JOY
Logged

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

Pages: [1]   Go Up
Jump to: