

A thumbstick is a control device that allows for directional input, commonly used in gaming controllers and joysticks. It consists of a stick that pivots on a base, enabling the user to manipulate movement in multiple directions. Thumbsticks are typically used in applications requiring precise control, such as gaming, robotics, and remote-controlled devices. They are also popular in DIY electronics projects for creating user interfaces or controlling motors and servos.








| Pin Name | Type | Description |
|---|---|---|
| VCC | Power | Connect to the positive voltage supply (3.3V or 5V). |
| GND | Ground | Connect to the ground of the circuit. |
| VRx | Analog Out | Outputs the X-axis position as an analog voltage (0V to VCC). |
| VRy | Analog Out | Outputs the Y-axis position as an analog voltage (0V to VCC). |
| SW | Digital Out | Outputs a digital signal (LOW when the stick is pressed, HIGH otherwise). |
Connect the Pins:
VCC pin to a 3.3V or 5V power supply.GND pin to the ground of your circuit.VRx and VRy pins to the analog input pins of your microcontroller (e.g., Arduino).SW pin to a digital input pin of your microcontroller.Read the Outputs:
VRx and VRy pins provide analog voltage outputs corresponding to the stick's position along the X and Y axes.SW pin provides a digital signal that indicates whether the stick is pressed.Calibrate the Thumbstick:
The following code demonstrates how to read the thumbstick's X and Y positions and detect button presses using an Arduino UNO:
// Define pin connections for the thumbstick
const int VRxPin = A0; // X-axis analog output connected to A0
const int VRyPin = A1; // Y-axis analog output connected to A1
const int SWPin = 2; // Button digital output 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 analog values
int xValue = analogRead(VRxPin); // Range: 0 to 1023
int yValue = analogRead(VRyPin); // Range: 0 to 1023
// 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 to avoid overwhelming the Serial Monitor
delay(100);
}
No Output from VRx or VRy:
VCC and GND pins are properly connected.Button Not Detected:
SW pin.INPUT_PULLUP in Arduino).Inconsistent Analog Readings:
VCC and GND to filter noise.Stick Does Not Return to Center:
Q: Can I use the thumbstick with a Raspberry Pi?
A: Yes, the thumbstick can be used with a Raspberry Pi. Connect the analog outputs (VRx and VRy) to an external ADC (Analog-to-Digital Converter) since the Raspberry Pi lacks built-in analog input pins.
Q: What is the typical range of analog values for VRx and VRy?
A: The analog values typically range from 0 to 1023 on a 10-bit ADC (e.g., Arduino UNO). The center position is approximately 512.
Q: Can the thumbstick be used for 3D control?
A: No, the thumbstick provides 2D directional control (X and Y axes) and a button press. For 3D control, consider using a joystick with an additional Z-axis.