PinLab › Components › Joystick module KY-023
GND+5VVRxVRySW two pots (X, Y) + a button

Joystick module KY-023

two axes + a button

The thumb stick from a gamepad: two potentiometers (X and Y) and a button when you press it down. For controlling robots, cursors and servos.

Open the course →

How it works

Each axis is a 10 kΩ potentiometer. In the middle the output is ~half the supply voltage, and towards the edges it goes to 0 or to the supply. The ESP32 reads both with analogRead() (0–4095, middle ~1800–2000). The button is an ordinary push button to GND: INPUT_PULLUP.

Pins and wiring

PinWhat it isWhere it connects / why
GNDGround→ GND.
+5VSupply (do not trust the label!)→ 3V3, so the outputs never exceed 3.3 V.
VRxX axis (analog)→ ADC1 pin (e.g. GPIO 34).
VRyY axis (analog)→ ADC1 pin (e.g. GPIO 35).
SWButton→ GPIO with INPUT_PULLUP.

Specifications

Potentiometers2 × 10 kΩ
Output0 – supply (analog)
Buttonactive LOW

Tips and typical mistakes