

The Analog Joystick is a two-axis input device that allows for directional control and variable resistance. It is commonly used in gaming controllers, robotics, and other applications requiring precise navigation or movement. The joystick features two potentiometers for the X and Y axes and a push-button for additional input functionality. Its compatibility with platforms like Wokwi and Arduino makes it a versatile and beginner-friendly component for prototyping and development.








The Analog Joystick consists of two potentiometers (for X and Y axes) and a tactile push-button. Below are the key technical details:
| Parameter | Specification |
|---|---|
| Operating Voltage | 3.3V - 5V |
| X-Axis Output Range | 0V - Vcc (Analog Output) |
| Y-Axis Output Range | 0V - Vcc (Analog Output) |
| Button Output | Digital (Active Low) |
| Dimensions | 40mm x 26mm x 32mm |
| Interface | Analog (X, Y), Digital (Button) |
The joystick typically has 5 pins. Below is the pinout description:
| Pin | Name | Description |
|---|---|---|
| 1 | GND | Ground connection |
| 2 | +Vcc | Power supply (3.3V or 5V) |
| 3 | VRx | X-axis analog output (connect to an ADC pin) |
| 4 | VRy | Y-axis analog output (connect to an ADC pin) |
| 5 | SW | Push-button digital output (active low) |
+Vcc pin to a 3.3V or 5V power source and the GND pin to ground.VRx and VRy pins to analog input pins on your microcontroller (e.g., Arduino).SW pin to a digital input pin on your microcontroller. Use a pull-up resistor if necessary.Below is an example of how to connect the joystick to an Arduino UNO:
+Vcc → 5VGND → GNDVRx → A0VRy → A1SW → D2The following code reads the X and Y axis values and detects button presses:
// Define pin connections
const int VRxPin = A0; // X-axis analog pin
const int VRyPin = A1; // Y-axis analog pin
const int SWPin = 2; // Push-button digital pin
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 X and Y axis values (0-1023 for 10-bit ADC)
int xValue = analogRead(VRxPin);
int yValue = analogRead(VRyPin);
// Read the button state (LOW when pressed)
bool buttonPressed = digitalRead(SWPin) == LOW;
// Print the values to the Serial Monitor
Serial.print("X: ");
Serial.print(xValue);
Serial.print(" | Y: ");
Serial.print(yValue);
Serial.print(" | Button: ");
Serial.println(buttonPressed ? "Pressed" : "Released");
// Add a small delay for stability
delay(100);
}
No Output or Incorrect Readings
Analog Values Fluctuate
Button Not Detected
Q: Can I use the joystick with a 3.3V microcontroller?
A: Yes, the joystick is compatible with both 3.3V and 5V systems.
Q: How do I calibrate the joystick?
A: Read the X and Y axis values when the joystick is at rest. Use these values as the center point in your code.
Q: Is the push-button necessary for operation?
A: No, the push-button is optional and can be left unconnected if not needed.
Q: Can I use this joystick with platforms like Wokwi?
A: Yes, the joystick is fully compatible with Wokwi for virtual prototyping and simulation.