Dual-axis joystick module (KY-023)
KY-023 dual-axis joystick: GND, +5V, VRx, VRy, SW pins, wiring to Arduino, ESP32 and Pico ADC pins, centre calibration and the push switch.
Community draft — report a mistake
3.3 V or 5 V? VRx and VRy swing between 0 V and the module’s supply. On ESP32 and Pico, power the joystick from 3.3 V (the pin labelled +5V is just the supply input) so the analog outputs never exceed 3.3 V.
This thumb joystick is two 10 kΩ potentiometers at right angles plus a push switch. Each axis outputs a voltage proportional to stick position, so you read it with two analog pins: about half-scale at rest, near 0 at one end and near full-scale at the other.
It is the easiest way to steer a robot car, aim a pan-tilt servo mount or move a cursor on a small display.
Mind the ADC: an Uno reads 0–1023, an ESP32 0–4095 and a Pico (MicroPython) 0–65535 — map the values to the range your project needs.
Pinout
| Pin | What it does |
|---|---|
GND | Ground |
+5V | Supply for the potentiometers — use 3.3 V on 3.3 V boards |
VRx | X-axis analog output |
VRy | Y-axis analog output |
SW | Push switch to GND when the stick is pressed — needs a pull-up |
Use it with
- Dual-axis joystick module (KY-023) with Arduino Leonardo Arduino C++
- Dual-axis joystick module (KY-023) with Arduino Nano Arduino C++
- Dual-axis joystick module (KY-023) with Arduino Uno R3 Arduino C++
- Dual-axis joystick module (KY-023) with ESP32 DevKit V1 Arduino C++
- Dual-axis joystick module (KY-023) with Raspberry Pi Pico W MicroPython
Common errors
Centre isn’t half-scale
Cheap pots rest anywhere from about 45–55 %. Read the centre at start-up and treat a small band around it as zero (a dead zone).
Values jump around on ESP32
The ESP32 ADC is noisy and non-linear near the ends. Average several readings, and use ADC1 pins (32–39) if Wi-Fi is on.
Button reads random values
SW has no pull-up on the module. Use pinMode(SW, INPUT_PULLUP).