Shop OBEX P1 Docs P2 Docs Learn Events
Dual-Axis analog Joystick Help. — Parallax Forums

Dual-Axis analog Joystick Help.

TheComputerCrewTheComputerCrew Posts: 6
edited 2009-11-11 15:02 in BASIC Stamp
I am having trouble building a stable, high-resolution RC-Time circuit with this setup.



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.



attachment.php?attachmentid=64957



This is the schematic



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
800 x 600 - 321K
432 x 432 - 45K
800 x 512 - 373K

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-11-07 04:12
    Are you sure they are not just switches under there? That's what most game joysticks are.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-11-07 08:36
    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.
  • TheComputerCrewTheComputerCrew Posts: 6
    edited 2009-11-07 14:29
    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? roll.gif
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-07 15:57
    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
  • TheComputerCrewTheComputerCrew Posts: 6
    edited 2009-11-07 16:51
    Mike Green said...
    The Stamp Manual chapter on the RCTIME statement gives the formulas involved.

    An invaluable resource. Thank you for your time, sir.
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-11-09 06:37
    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.
  • skylightskylight Posts: 1,915
    edited 2009-11-09 08:06
    The 220 ohm IS in series the pin won't short to GND
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-11-09 20:27
    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.
  • TheComputerCrewTheComputerCrew Posts: 6
    edited 2009-11-11 15:02
    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" 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 100µf 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!!

    attachment.php?attachmentid=65066

    attachment.php?attachmentid=65067

    Post Edited (TheComputerCrew) : 11/11/2009 3:08:44 PM GMT
    800 x 600 - 363K
    800 x 600 - 437K
Sign In or Register to comment.