Using a Thumb Slide Joystick

Here are some notes on using the Sparkfun Thumb Slide Joystick on an Ardunio. This is a small two way X-Y variable resistor based controller that uses two analogue pins on the Arduino and works with both the 5 volt logic of the Uno as well as the 3.3 volts of the Teensy.

Thumb Sliding Joystick
Thumb Sliding Joystick

I found that this joystick works well for giving the eight positions found at the stick limits crosswise and diagonally but it doesn’t seem sensitive enough for reporting accurate positions.

Connecting

On the underside of the joystick there are four solder pads, looking from above with the screw holes pointing towards you, the connections are:

  1. X-Axis
  2. +5 volts
  3. Y-Axis
  4. GND
Connections, looking from above and circuit diagram

Should you take one to bits, you will find two sliders with small metal contacts and a circuit board with carbon tracks acting as a variable resistor. The sliders move in a parallel configuration, and the joystick control has a spring to return it to centre when released.

Inside the Joystick showing the contacts
Inside the Joystick showing the contacts
6N2A5558
Carbon tracks on the circuit board, solder pads top left

These can be tricky to put back together afterwards.

Underside of the joystick, with some wires soldered to the connections
Underside of the joystick, with some wires soldered to the connections

The pads on the base are spaced at 2mm but with some bending it is possible to attach standard 2.54mm (0.1inch) header pins, solder the inside two first before attaching the outers.

Thumb Joystick test setup with a Teensy
Thumb Joystick test setup with a Teensy,

When mounting in a case or panel you will need to drill a 18mm hole for the controller and the thumb pad is raised about 3mm above the surface of the body. I would secure the controller in place with a couple of blobs of hot glue  rather than use the small screw holes.

Programming

For my setup I am using the Teensy’s 3.3 volt output to power the joystick and the X-Axis connected to Analog pin 0, and Y-Axis to Analog pin 1,

This test program shows the position of the joystick through the serial port, it attempts to calibrate itself and set the values for the chosen direction, if this is not always successful when returning to the centre position try experimenting with the tolerance and maxRange values.

Links

Leave a Reply

Your email address will not be published. Required fields are marked *