Pages: [1]   Go Down
Author Topic: Using Microsoft SideWinder 3D Pro as a joystick for our robot  (Read 1980 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

First of all, I don't know whether I put the topic in the correct forum or not. If it is not, I am sorry.

I have a Microsoft SideWinder 3D Pro Joystick, and I would like to use it for my robot without a computer. Could you please help me?


It has DA-15 Male connector. This is the website for the pin outs.

http://en.wikipedia.org/wiki/Game_port


On the connector, it has only Pin number 1,2,3,4,6,7,10,11,13,14.

According to the link above, I used those pins to get some readings with Multimeter. I got about 50 kohm while it is in its normal position. I moved the joystick, but it didn't change its resistance value.

Pin 1 - 5V
Pin 3 - X axis for joystick 1 (0-100kohm)
Pin 4 - GND
Pin 6 - Y axis for joyistic 1 (0-100kohm)

I also wrote this program to get readings in mVolts. However, the result is the same.
Code:
int X = 4;  
int Y = 3;                    
int valX = 0;          
int valY = 0;
int vX, vY; //voltage in mV

void setup()
{
  Serial.begin(9600);        
}

void loop()
{
  valX = analogRead(X);  
  valY = analogRead(Y);
//  Serial.print("valX = ");            
//  Serial.print(valX);
//  Serial.print("  -  valY = ");
//  Serial.println(valY);
  vX = map(constrain(valX, 0, 1023), 0, 1023, 0, 5000);
  vY = map(constrain(valY, 0, 1023), 0, 1023, 0, 5000);
  Serial.print("Voltage X = ");            
  Serial.print(vX);
  Serial.print("  -  Voltage Y = ");
  Serial.println(vY);
  delay(500);
}

Also this is the information about this joystick.
http://en.wikipedia.org/wiki/Microsoft_SideWinder#3D_Pro

Thanks
ARAS
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 5557
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://en.wikipedia.org/wiki/Game_port

According to the link above, I used those pins to get some readings with Multimeter.

You didn't read that article very carefully, did you? From the article (emphasis mine):

Quote
High-end game port joysticks such as the Microsoft SideWinder rely on multiplexing a proprietary data stream through the 4 standard button inputs and sometimes through the "unused" pins, achieving full support for a rather high number of buttons (e.g. 16 or 20) while special features such as daisy-chaining multiple joysticks, force feedback or joystick programming become possible in some cases.

In other words, it is highly doubtful that this joystick is operating as a simple PC-style joystick using the standard analog interface of the game port, which is what you seem to be attempting to interface with. Hopefully, you haven't damaged the joystick (test with a PC that has a gameport, first).

How or whether you could interface this joystick via the standard pins is kinda "up-in-the-air"; likely, the joystick is sending some kind of stream of data via some hardware (connections on the game port) and software (how it is communicating the data from the joystick axes and buttons) protocol. You will either need to find a description of this protocol or figure it out yourself; regardless of that, though, you need to find out what the "hardware" protocol of this joystick is; that is - what pins are connected for what purpose for -this- joystick (as other "digital" and "expanded" joysticks and peripherals that connected to the game port might have and most likely did use a completely different set of protocols).

Whether or not this information is easily available for this joystick, I don't know - but I suspect it very well might be. I would suggest a ton more research before attempting to use it (you might also consider in your first experiments, once you know the proper hardware protocol, to use the Arduino as a form of "logic analyzer" to record data coming from the joystick pins, so as to have a sample of the data to compare to any software protocol description you may find).
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

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

Thanks cr0sh,

I had read all the article. Probably I didn't understand as you did. English is not my first language. Also, I don't have a computer to test it.

I was also thinking to use Logic Analyzer. I will do it soon.

Thanks for the advice.
ARAS
Logged

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

Hi cr0sh,

I have found this links, and I read them even though I have a poor vocabulary(it was good practice though smiley)

ftp://ftp.heanet.ie/mirrors/ftp.slackware.com/pub/slackware/slackware-7.0/docs/linux-2.2.13/joystick.txt


http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/specs.txt

On the second link, I found this information
Digital mode of MS SideWinder joysticks
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  SideWinders send data through buttons. The transmission starts on a normal
  measure trigger (out to port 0x201).  Button 0 is used as clock (100 kHz),
  other three buttons carry data. Data is valid at clock 0->1 transition,
  LSB is transmitted first.

  SideWinder 3D Pro packet
  ~~~~~~~~~~~~~~~~~~~~~~~~
  The SW 3DP sends three packets, each 22 triplets long (64 + 2 bits). The
  packets have all the same contents. The packet layout seems to originate
  from the Mac version of SW3DP. Transmit speed is 300 kbit/sec, first packet
  takes 320 us to transmit, all three take 760 us.

  Byte 0:
   7....... - Always 1
   .6...... - Hat bit 3
   ..543... - Axis 0 (X) bits 7-9
   .....210 - Axis 1 (Y) bits 7-9

  Byte 1:
   7....... - Always 0
   .6543210 - Buttons bits 0-6

  Byte 2:
   7....... - Always 0
   .6543210 - Axis 0 (X) bits 0-6

  Byte 3:
   7....... - Always 0
   .6543210 - Axis 1 (Y) bits 0-6

  Byte 4:
   7....... - Always 0
   .6...... - Buttons bit 7
   ..5..... - CHF (0) / TM (1) switch
   ...43... - Axis 2 (Twist) bits 7-8
   .....210 - Axis 3 (Throttle) bits 7-9

  Byte 5:
   7....... - Always 0
   .6543210 - Axis 2 (Twist) bits 0-6

  Byte 6:
   7....... - Always 0
   .6543210 - Axis 3 (Throttle) bits 0-6

  Byte 7:
   7....... - Always 0
   .654.... - Hat bits 0-2
   ....3210 - Checksum bits 0-3

  The last two bits are zeroes.



Am I in the right way?

Thanks
ARAS
Logged

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

I have also found the linux driver. I couldn't copy the C codes. The forum didn't allow me because of over character numbers.

ftp://atrey.karlin.mff.cuni.cz/pub/linux/joystick/joystick-1.2.15.tar.gz


In the ftp link above, there is a C file called "joy-sidewinder.c" It is a module for the Linux joystick driver, supporting Microsoft SideWinder digital joystick family.

Also, there is C file called "joy-analog.c" and "joystick.c"(main driver)

Looks like I will have a problem with libraries.

How can I use those modules?

I am not an expert. That's why I am asking here. I will appreciate if someone can help me.

Thanks
ARAS
« Last Edit: May 31, 2012, 02:04:17 am by ARAS » Logged

Finland
Offline Offline
Sr. Member
****
Karma: 1
Posts: 270
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You cannot use these modules as they are. They depend on the Linux kernel header files and APIs and the way they access the hardware is different. It may be feasible to port some parts of joy-sidewinder.c to the Arduino. Or at least you can use is as a template or reference for your own implementation.
Logged

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

Thanks pekkaa.
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 5557
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you have everything you need to get started; what you'll want to do figure out which pins of the game port correspond to the "button pins", and there is probably power and ground needed. One of those pins is for the clock, as the info you found suggested, and the other three for data. You'll want to look thru the source code you found to see if you can find the "triplet decoder" functionality - or, you can try writing your own up, based on the information you already have. You'll probably want to use direct port access along with a pin-change interrupt on the arduino to detect the falling edge of the clock pin, then read the other three pins at the same time, then stuffing all of this into a small 66 bit buffer...
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you gotten the arduino code to decode it yet? I'm in the exact same situation as you. I'm 100% clueless. If you have the code could you please post it?
Logged

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

I notice much of the talk and referenced links centers around the joystick "buttons". Is the stick itself attached to the usual type pots, or to some analog multiplexing setup?
Logged

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Its all optical. I found it out when I opened mine up...
Logged

Pages: [1]   Go Up
Jump to: