Adafruit: 2-Axis Thumb Joystick
Overview: 2 Wiring: 2 Code: 2 git/Compiles with make: 2 gcc works Demo: 2 Total: 10 Comments: Looks good.
The Adafruit: 2-Axis Thumb Joystick uses 2 10 kΩ pots which are adjusted by moving the joystick. The joystick and development board can be purchased from the Adafruit Website. The joystick is simplistic enough that Adafruit does not provide a datasheet.
From the Manufactorer: This mini-kit makes it easy to mount a PSP/Xbox-like thumb joystick to your project. The thumbstick is an analog joystick - more accurate and sensitive than just 'directional' joysticks - with a 'press in to select' button. Since it's analog, you'll need to analog reading pins on your microcontroller to determine X and Y. Having an extra digital input will let you read the switch.
Inputs and Outputs
The Adafruit joystick takes a supply voltage (Vs) of up to 5V. The analog outputs have a direct correlation to the resistance observed by the analog joystick. At the resting position, the resistance in both axis is at its middle resistance or 5k. At either extreme of the range of motion, there is either enough resistance for the analog inputs to register a 0 or so little resistance that the supply line to the analog input looks open.
The BeagleBone can support up to 8 analog inputs and has the ability to supply an analog 1.8 V voltage and an analog ground. I have connected my beagle as shown after soldering the joystick and some wires to the dev board:
The pinout is as shown:
Pins 36 and 38 I have wired to the 0-1.8V analog inputs. I have wired VCC to the Beagle's 1.8V analog VCC output(pin 32). The ground wire from the joystick is wired to the analog ground on the beagle(pin 34). The select GPIO signal I have routed to the GPIO_7 pin(pin 42).
I have written a small program which displays the x-Axis and y-Axis positions in the terminal. It can be found in a git repository here.
Using this configuration one can take the analog inputs with the GPIO selector and do about anything that requires two axises of movement and a selection knob. If you need some help interfacing with the analog ports or the GPIO ports, check out Dr. Yoder's succinct exercise at Analog and GPIO Info
Control a 8x8 LED Matrix With The Joystick
Now we have the joystick as an input, and we can do something interesting if there's an output part. This is a mini project about using the joysick to control a 8x8 LED matrix.
The details about the LED matrix can be found here: Mini 8x8 LED Matrix w/I2C - Yellow The LED matrix has an i2c port. Wire up the LED maxtrix to the Beagle Bone by attaching the Vdd to the 3.3V + bus, the GND to the - bus, SDA to SDA (pin 20), and SCLK to SCL (pin 19). The joystick can be wired up as decribed above. Here is a picture of the hardware configuration.