[Firestorm_x1] put together a tutorial about interfacing an analog joystick with a microcontroller. These analog sticks are easy to find; he got his from Goodwill but we’ve got a couple in our junk box right now. The stick uses variable resistors to report its position so it’s just a matter of reading and interpreting that data. After explaining the concepts he demonstrates how to use the joystick to control a Basic Stamp 2 based robot, the Boe-Bot. This could easily be adapted for use with other robot platforms.
12 thoughts on “Interfacing With An Analog Joystick”
Leave a Reply
Please be kind and respectful to help make the comments section excellent. (Comment Policy)
Nice Writeup, but common/old and not really a Hack…
I did something that is somewhat similar to this. I hooked up an Atari 2600 controller to a Basic Stamp 2, and hooked that up to a computer so I could use it as a computer controller.
yea its common, but I haven’t seen this good of a write up ever, usually your lucky to get a text file with some pin-outs and kinda have to kludge the conversion together in your brain
I made a dick out of this with a vibrator from a PS2 Controller…. mine was purple. I am being honest.
http://img53.imageshack.us/img53/3633/cam0244fg9.jpg
LOL
This won’t work for most microsoft sidewinder products though, as they used a digital-over-analog protocol. A very nice chap over on the descent forums has a mostly open black-box that decodes the data from the joysticks and has a USB interface. It’s an OLD project, but the last update seems to have been in November. (Search for the words “project archive”, the text’s tiny)
http://grendel.koolbear.com/3dpro.htm
A slightly wasteful newer version using the Teensy microcontroller is here:
http://www.descentbb.net/viewtopic.php?t=15526
Should I submit something like this?
@CJ How very random.
I’ve seriously considered making a Dr. Evil like chair with the joystick and everything for rotation… this could be a gold-mine ;P
Nice documentation and tutorial. The Stamp lives on!
When I use old analog joysticks I always pop them open and solder the 5V line (it’s already present) to the other side of the potentiometers. That converts the rheostat-type output to voltage-divider output. Then just use ADC inputs, no need to mess around with external capacitors, calibration, or low-functionality threshold based detection (or topheavy exponential calculations).
A shortcoming-Most joysticks today employ USB, rather than the gameport.Most laptops and newer motherboards have completely removed support for the game port.
A USB version of this same would be way cooler.
@Rupin
I don’t think a Basic Stamp can handle USB comms…
Rupin, check out leo bodnar card BU0836X
http://www.leobodnar.com/
It’s like, totally better than sliced bread…