Analogue 2-axis Thumb Joystick with Switch Button

This thumbstick module can be used to provide X and Y positions and bring PSP/Xbox-like thumb joystick control to your projects. It also includes a push switch when the stick is pressed in. You’ll need two analogue reading pins on your microcontroller to determine X and Y and one digital input will let you read the switch.

2 potentiometers for XY axis
1 push switch
5V DC Input
Spring return joystick
Rubberized thumbstick
M3 Mounting holes
Compatible with standard 2.54mm sockets

SW : Switch output
VRY : Analog Y output
VRX : Analog X output
+5V : 5V DC Input
GND : Ground

How it works

The Analogue Joystick works as two potentiometers connected together, one for the vertical movement (Y-axis) and one for the horizontal movement (X-axis). The joystick also comes with a Push switch. It can be used for retro gaming or robot control. The Arduino Uno or any other Arduino board that uses Atmega328 as has ADC resolution of 10 bits and It will map input voltages between 0 and 5 volts into integer values between 0 and 1023. Now connecting the VRx to A0 and VRy to A1 analogue inputs respectively should show values as shown in the image below.


The home position for the stick is at X:511, Y:511. If the stick is moved on X axis from one end to the other, the X values will change from 0 to 1023 and similar thing happens when moved along the Y axis.


Simple sketch that reads the values and prints them to the Serial Monitor

int xValue;
int yValue;
int buttonState;

void setup() {
pinMode(A0, INPUT);
pinMode(A1, INPUT);
//pull-up resistor on the push-button pin
pinMode(2, INPUT_PULLUP);

void loop() {
// put your main code here, to run repeatedly:
xValue = analogRead(A0);
yValue = analogRead(A1);
buttonState = digitalRead(2);

//print the values
Serial.print("X: ");
Serial.print(" Y: ");
Serial.print("Button: ");

delay(500); // add some delay between reads

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

Blog at

Up ↑

Create your website at
Get started
%d bloggers like this: