PDA

View Full Version : Dual-Axis analog Joystick Help.



TheComputerCrew
11-07-2009, 07:47 AM
I am having trouble building a stable, high-resolution RC-Time circuit with this setup.



http://forums.parallax.com/attachment.php?attachmentid=64959


The PCB is out of an Xbox 360 wireless controller. The joystick has three solder points for each axis which I am assuming is similar to a dial potentiometer. I want to use this controller to power my robotics experiments. The wireless is proprietary and thus far, un-hackable. My goal here is to put together my own board with the original Xbox components (joysticks, tact switches, triggers, etc.) and have it fit back into the original controller case. Any help on utilizing these joysticks and other on-board components would be greatly appreciated.



http://forums.parallax.com/attachment.php?attachmentid=64957



This is the schematic



http://forums.parallax.com/attachment.php?attachmentid=64958





The joystick is obviously spring auto return to center. When I tilt the joystick all the "left" I get an rc-time of 35000. Back at center is 61000. All the way "right" is just below 35000. How could I possible utilize these readings. WHat am I missing here? Thank in advance to all!

Post Edited (TheComputerCrew) : 11/7/2009 12:07:05 AM GMT

Franklin
11-07-2009, 12:12 PM
Are you sure they are not just switches under there? That's what most game joysticks are.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Mikerocontroller
11-07-2009, 04:36 PM
You should remove the joystick from the original circuit board. All those other components might be affecting your readings. Also be aware that your RCTIME variable could be overflowing. I have a similar joystick that I hacked from a Logitech gamepad controller. It has two 10K ohm potentiometers (X axis and Y axis) and a tactile switch (Z axis). I'm going to test mine this weekend and see what happens.

TheComputerCrew
11-07-2009, 10:29 PM
franklin said...
Are you sure they are not just switches under there? That's what most game joysticks are.


Yes sir, I am certain. It has one pot per axis and a z-axis tact switch. The black "box" on each axis rotates as you move the joystick. Also there are three solder points per pot.


Mikerocontroller said...
You should remove the joystick from the original circuit board. All those other components might be affecting your readings.


Didn't even cross my mind, thank you.


Mikerocontroller said...
Also be aware that your RCTIME variable could be overflowing


Forgive my "newbieness", but what is RCTIME overflow and how can I correct this? http://forums.parallax.com/images/smilies/roll.gif

Mike Green
11-07-2009, 11:57 PM
It takes a certain amount of time for the pot to discharge the capacitor to where the Stamp pin will see its input change from high to low. The Stamp counts clock pulses in a 16 bit counter, once every 2us using a BS2, until this happens and that's what's stored in the variable in the RCTIME statement. If the pot resistance is "too high" or the capacitor value is "too high", the discharge will take too long and the count will pass 65535 pulses (2 to the 16th) and the counter will start over from zero. That's an overflow.

You fix this by not letting it happen by choosing a proper capacitor value. The Stamp Manual chapter on the RCTIME statement gives the formulas involved. You may need a small fixed resistor in series with the pot so that the total resistance has a minimum other than zero.

Post Edited (Mike Green) : 11/7/2009 4:03:02 PM GMT

TheComputerCrew
11-08-2009, 12:51 AM
Mike Green said...
The Stamp Manual chapter on the RCTIME statement gives the formulas involved.


An invaluable resource. Thank you for your time, sir.

Mikerocontroller
11-09-2009, 02:37 PM
Using your basic schematic with a 10k ohm variable resistor and 4.7 uf capacitor I got the following readings: MIN: 1 CENTER: 10200 MAX:23000. This was done on a Basic Stamp HomeWork Board. This board has built-in 220 ohm resistors on each I/O pin so I was able to eliminate the series resistor. Like Mike said, you need some series resistance because the variable resistor can short the Stamp pin to ground.

skylight
11-09-2009, 04:06 PM
The 220 ohm IS in series the pin won't short to GND

Mikerocontroller
11-10-2009, 04:27 AM
What I meant to emphasize is that the 220 ohm resistor is for protection of the Stamp. I thought some newcomers may think it is a trimmer resistor. I was also pointing out that non-HomeWork Boards don't have built-in protection resistors. Sorry for the confusion.

TheComputerCrew
11-11-2009, 11:02 PM
Update.

First, thanks for everyone's responses.


Next, I took Mikerocontroller's advice from post #3 and removed the joystick from the board. This was a success due to the fact that the PCB's circuitry was adulterating my pot readings.

After removing the joystick, a simple RCTIME circuit taken straight from the "What's a Microcontroller" (http://www.parallax.com/Store/Books/EducationalTexts/tabid/181/CategoryID/66/List/0/Level/a/ProductID/139/Default.aspx?SortField=ProductName%2cProductName) text, page 151, did the trick. The only modifications to the circuit from the text were the substitution of the joystick for the rotating pot (obviously), and the substitution of a 100f capacitor. This capacitor was able to give me readings (after scaling and offset) from 506 to 998. The readings before being modified by code were 17 and 632.

Also, I utilized the z-axis tact switch that is built into the lower portion of the xbox360 joystick. It worked very well.

Although very rudimentary and simple, this proves that I can utilize all the input devices off of this circuit board and integrate them onto a custom PCB that will fit back into the xbox360 controller. This will preserve the function of every button and switch as well as provide an implementation of this controller into robotics control. It would be much simpler to use the existing hardware, but, unfortunately, it doesn't look as though Microsoft's wireless encryption will be decoded anytime soon.

Thanks all!!

http://forums.parallax.com/attachment.php?attachmentid=65066

http://forums.parallax.com/attachment.php?attachmentid=65067

Post Edited (TheComputerCrew) : 11/11/2009 3:08:44 PM GMT