PS2-Style Analog Joystick Module
Two-axis analog input for controllers and pan-tilt rigs.
Wiring & code for
Joystick Module practical reference
The PS2-style analog joystick module is a two-axis, spring-centered thumbstick built from two potentiometers — one for the X axis and one for the Y axis — plus a momentary push-button triggered by pressing straight down on the stick. It reports smooth analog positions on each axis rather than simple on/off directions, making it the standard input for robot controllers, pan-tilt camera rigs, and any project that needs proportional, joystick-style control.
Key specifications
- Axes: 2-axis analog (X and Y), each driven by an independent 10kΩ potentiometer
- Operating voltage: 3.3V–5V DC
- Output type: Analog voltage per axis, proportional to stick position (read with analogRead())
- Center position output: ~half of supply voltage (e.g. ~2.5V at 5V supply) when stick is at rest
- Push-button: Momentary switch (SW pin), activated by pressing the stick down, active LOW
- Interface: 2 analog pins (VRx, VRy) + 1 digital pin (SW)
- Mechanical travel: Spring-loaded, self-centering in both axes
Pinout and connection notes
Each axis needs its own analogRead()-capable pin, and the SW button pin should be configured with INPUT_PULLUP since it pulls to GND when pressed. On 3.3V boards like the ESP32, the module still works fine at 3.3V supply, though the analog center-point and range will scale down accordingly.
- GND: Ground
- +5V: Power, 3.3–5V DC
- VRx: X-axis analog output — connect to an analog input pin
- VRy: Y-axis analog output — connect to an analog input pin
- SW: Push-button output, active LOW — connect to a digital input pin with pull-up enabled
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.