Interfacing with an analog joystick

[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.


  1. Fridolin says:

    Nice Writeup, but common/old and not really a Hack…

  2. dooglehead says:

    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.

  3. Osgeld says:

    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

  4. CJ says:

    I made a dick out of this with a vibrator from a PS2 Controller…. mine was purple. I am being honest.


  5. cynic says:

    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)

    A slightly wasteful newer version using the Teensy microcontroller is here:

    Should I submit something like this?

  6. Paul Potter says:

    @CJ How very random.

  7. Brandonman says:

    I’ve seriously considered making a Dr. Evil like chair with the joystick and everything for rotation… this could be a gold-mine ;P

  8. Mike D. says:

    Nice documentation and tutorial. The Stamp lives on!

  9. macegr says:

    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).

  10. Rupin says:

    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.

  11. octel says:

    I don’t think a Basic Stamp can handle USB comms…

  12. Coligny says:

    Rupin, check out leo bodnar card BU0836X

    It’s like, totally better than sliced bread…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,731 other followers