

The Keyes PS2 Joystick with Button is an input device designed for precise control in video games, robotics, and other interactive applications. It features two analog potentiometers for X and Y directional movement and a tactile push-button for additional functionality. The joystick is compact, easy to use, and compatible with microcontrollers like Arduino, making it a popular choice for hobbyists and developers.








Below are the key technical details of the Keyes PS2 Joystick with Button:
| Parameter | Specification |
|---|---|
| Operating Voltage | 3.3V - 5V |
| Output Type | Analog (X, Y axes) and Digital (Button) |
| X-Axis Range | 0V to Vcc (centered at ~Vcc/2) |
| Y-Axis Range | 0V to Vcc (centered at ~Vcc/2) |
| Button Output | Digital (Active Low) |
| Dimensions | 34mm x 26mm x 32mm |
| Interface Type | 5-pin header |
The PS2 Joystick module has a 5-pin header for interfacing. The table below describes each pin:
| Pin | Name | Description |
|---|---|---|
| 1 | GND | Ground connection |
| 2 | +5V | Power supply (3.3V to 5V) |
| 3 | VRx | Analog output for X-axis movement (0V to Vcc, centered at ~Vcc/2) |
| 4 | VRy | Analog output for Y-axis movement (0V to Vcc, centered at ~Vcc/2) |
| 5 | SW | Digital output for the push-button (Active Low: 0V when pressed, Vcc otherwise) |
+5V pin to the 5V output of your microcontroller and the GND pin to ground.VRx and VRy pins to the analog input pins of your microcontroller to read the X and Y axis values.SW pin to a digital input pin to detect button presses.SW pin.Below is an example Arduino sketch to read the joystick's X, Y, and button states:
// 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; // Button connected to digital pin 2
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Configure the button pin as input with an 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);
}
Joystick Outputs Not Centered
Button Not Responding
SW pin is connected to a pull-up resistor (internal or external).No Analog Output
Erratic Readings
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 to an ADC (Analog-to-Digital Converter) module, as the Raspberry Pi lacks built-in analog input pins.
Q: What is the lifespan of the joystick?
A: The joystick is designed for long-term use, but its lifespan depends on the frequency and intensity of use. Avoid excessive force to prolong its life.
Q: Can I use the joystick with 3.3V systems?
A: Yes, the joystick is compatible with 3.3V systems. Ensure all connections and microcontroller pins are configured accordingly.
Q: How do I debounce the button in software?
A: Implement a delay (e.g., 50ms) after detecting a button press to filter out noise or false triggers.