Input / Touch
Interfacing Joystick Module Input / Touch with Arduino Uno
What is the Joystick Module?
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.
Setting Up Joystick Module with Arduino Uno
Library
None — built-in analogRead/digitalRead by —
No library needed; uses core Arduino functions only.
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| +5V | 5V | |
| GND | GND | |
| VRx | A0 | |
| VRy | A1 | |
| SW | D2 | Press-to-click button, active LOW — use INPUT_PULLUP. |
Swipe sideways to see every column →
- Centre position reads roughly 512 on both axes but varies module to module — calibrate at startup rather than hardcoding 512.
- SW is a separate physical pushbutton triggered by pressing the stick down, unrelated to X/Y position.
Related Components
A3144
Digital Hall-effect switch for contactless magnetic detection
ACS712
Measure AC or DC current with an analog Hall-effect sensor
ADXL345
Low-power 3-axis accelerometer with tap/double-tap and freefall detection for wearables.
AHT10
A tiny I2C sensor that packs temperature and humidity sensing into the smallest footprint possible.
Related Guides & Projects
Arduino Uno R4 Minima Pinout: Every GPIO, ADC, DAC, and Op-Amp Pin Explained
A complete Arduino Uno R4 Minima pinout reference — digital I/O, ADC, DAC, op-amp, CAN, dual UART, and exactly what it leaves out compared to the WiFi variant.
Mastering PWM on Arduino: Dimming LEDs and Controlling Motors
Understand what PWM actually is on Arduino, dim an LED smoothly, and safely control a DC motor's speed with a driver chip -- plus the mistakes (like wiring a motor straight to a pin) that damage boards.
4-Digit 7-Segment Counter with TM1637 & Arduino
Drive a TM1637-based 4-digit 7-segment display with Arduino Uno to show a real-time up/down counter, elapsed timer, and scrolling text. Covers library setup, brightness control, and custom segment mapping.
Arduino Uno R4 Minima vs WiFi: Which One Should You Choose?
Same processor, same memory, different price. Here's what the WiFi variant's extra hardware actually gets you, and when the Minima is the smarter buy.