

An analog joystick is a control device that allows for two-dimensional input through the movement of a stick. It typically consists of a stick that pivots on a base and can detect the angle and direction of the movement. The joystick provides variable resistance and outputs analog signals corresponding to the X and Y axes. Many analog joysticks also include a push-button feature when the stick is pressed down.








Below are the key technical details of a standard analog joystick module:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V - 5V |
| Output Type | Analog (X, Y axes) and Digital (button) |
| X-Axis Resistance Range | 0Ω to 10kΩ |
| Y-Axis Resistance Range | 0Ω to 10kΩ |
| Button Type | Momentary push-button |
| Dimensions | ~34mm x 34mm x 32mm |
The analog joystick module typically has 5 pins. Below is the pinout:
| Pin | Name | Description |
|---|---|---|
| 1 | GND | Ground connection |
| 2 | +VCC | Power supply (3.3V or 5V) |
| 3 | VRx | Analog output for the X-axis (horizontal movement) |
| 4 | VRy | Analog output for the Y-axis (vertical movement) |
| 5 | SW | Digital output for the push-button (active LOW when pressed, HIGH otherwise) |
+VCC pin to a 3.3V or 5V power source and the GND pin to ground.VRx and VRy pins to the analog input pins of a microcontroller (e.g., Arduino). These pins output a voltage proportional to the stick's position.SW pin to a digital input pin of the microcontroller. Use a pull-up resistor if necessary, as the button output is active LOW.Below is an example of how to interface the analog joystick with an Arduino UNO:
// Define pin connections
const int VRxPin = A0; // X-axis connected to analog pin A0
const int VRyPin = A1; // Y-axis connected to analog pin A1
const int SWPin = 2; // Push-button connected to digital pin 2
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Configure the button pin as input with internal pull-up resistor
pinMode(SWPin, INPUT_PULLUP);
}
void loop() {
// Read the X and Y axis values (0 to 1023)
int xValue = analogRead(VRxPin);
int yValue = analogRead(VRyPin);
// Read the button state (LOW when pressed, HIGH otherwise)
int buttonState = digitalRead(SWPin);
// Print the values to the Serial Monitor
Serial.print("X: ");
Serial.print(xValue);
Serial.print(" | Y: ");
Serial.print(yValue);
Serial.print(" | Button: ");
Serial.println(buttonState == LOW ? "Pressed" : "Released");
// Add a small delay for stability
delay(100);
}
No Output from X or Y Axis
VRx and VRy pins are properly connected to the microcontroller's analog input pins.Button Not Responding
INPUT_PULLUP mode in your code or add an external pull-up resistor to the SW pin.Inconsistent or Noisy Readings
+VCC and GND near the joystick module.Joystick Center Position Not Reading 512
Q: Can I use the joystick with a Raspberry Pi?
A: Yes, the joystick can be used with a Raspberry Pi. Connect the analog outputs (VRx and VRy) to an ADC (Analog-to-Digital Converter) module, as the Raspberry Pi does not have built-in analog input pins.
Q: What is the lifespan of an analog joystick?
A: The lifespan depends on the quality of the joystick and usage conditions. Most joysticks are rated for tens of thousands of movements.
Q: Can I use the joystick for 3D input?
A: No, standard analog joysticks only provide 2D input (X and Y axes). For 3D input, specialized joysticks or sensors are required.