**Update! I finally got around to doing some more with this, check out Xbee Enabled Joystick, part II**
The Xbee enabled joystick
I had the idea awhile ago, but only recently had a reason to start it. My work on the high current motor controller left me needing a way to control it remotely. I've had an old joystick lying around for years, refusing to retire it to the garbage. I also happened to purchase a couple Xbees a couple years ago, and have never put them to use.
Many people only use Xbee modules as pass through modems, but they can do so much more. The ZigBee protocol requires a fair amount of overhead, requiring a bit of processing power. It turns out that Xbee modules let you harness some of the overflow functionality for your own devious doings. Xbee modules include several ADCs, virtual wires, and more. Why not hook an Xbee up to an old joystick?
There are a couple of modifications that need to be made to the joystick before you can hook an Xbee up to it. First off, gaming ports hail from an era where digital I/O was relatively cheap, and good ADCs were expensive. For a good explanation of how these old joysticks worked, check out this site
The Joystick
Most classic joysticks consist of 2 potentiometers, and several pushbuttons. More axis were added as joysticks progressed. The joystick I happen to be modifying has 3 axis, and 4 pushbuttons.
Boy, what a beauty. How could I throw this away? Every time I pulled it out I was flooded by the nostalgia of staying up late playing Descent with my cheap but sufficient joystick.
The potentiometers in the joystick have one fixed contact connected to the positive rail, and the wiper to the output to the computer's circuitry for reading the position. In order to use this with an ADC, the other fix contact needs to be connected to ground in order to create a proper voltage divider.
First, opening the joystick
Removing the screws and removing the base reveals this
If you then take off the spring/guide assembly, you can clearly see the pots
If you pull out the PCB and flip it over, with a little probing you can find out what you need to connect to complete your voltage dividers. For example, here you can see the contacts that this joystick need to be connected
The next step is obviously to solder some wires to the marked contacts.
Now shove the whole thing back together.
The supporting circuitry
Ideally I want this thing to be battery powered and one complete unit with an Xbee poking out of the joystick somewhere, but for now we're going to breadboard it.
First things first, cut that cord
Next, solder (or crimp if you have the luxury) the spliced wires to a .1" pitch header
To supplement the XBee you need a steady voltage supply, and pullup resistors on all of the pushbuttons. I stole a barrel connector from an old phone to use for power, and then an adjustable voltage regulator to provide the 3.3V the Xbee needs. Fortunately, nothing in the joystick needs +5V, so we will hook it up to +3.3V. Here is the completed circuit
Next up, integrating the Xbee!
Hi, I'm getting lot of knoledge from these blog so.. could you explain me a few things? at first, why do you say you need pullup resistors at the push buttons? shouldn't you need pulldown resistors at there?
ReplyDeletethen, after de xbee configurations you said someting about the frequency, why do you change it? and if I anderstud well, do you change the xbee frequency?
And at last, why did you do the voltage divider? was it to handle the motor and xbee on the reciber? because I don't see any reason to do it on the Joystick one, I mean, everything is working on 3,3V...
And what's the transistor on the image for?
Really thank's for your time, it is being very helpfull, and sorry about my english
Generally, input pins on digital devices can act as input or output. If a pin is configured as an output, and you supply a raw voltage to it, you damage at least the pin, if not the entire circuit. Negative logic is generally safer; meaning, a pullup keeps the voltage high (and limits any current to the input pin) and the button pulls it to ground. General safe practice.
DeleteI think the frequency you are referring to is the sample rate. This is just how many times the XBee reads the ADC pin values in a second. Nothing to do with the RF frequency. If your sample rate is too high, it will try to send too much data across the RF link.
You need to make the joystick circuits into voltage dividers to work with the XBee's ADC. If you didn't ground one of the contacts on the joystick potentiometers, the wiper contact would always be at 3.3V. Game ports that this joystick were meant to work very differently.
Lastly, that is actually a voltage regulator, LM317, I believe. Just a common adjustable linear voltage regulator. The caps are just for voltage smoothing.
And, no need to apologize for your English! Learning anything through a language you may not be comfortable can be very difficult. I know from experience.
Basically I have a button which instead of being connected to 3.3V is connected to ground and there is nothing I can do about it. Now that it is connected to ground im not sure how to go about it. I have tried a few things but in vein. I have two buttons like this connected to pins DIO2 and DIO3 of a series 1 xbee and would like to know if it is possible and if so what to set the pins to and how to connect it physically.
ReplyDelete