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
| Pin | What it is | Where it connects / why |
|---|---|---|
| GND | Ground | → GND. |
| +5V | Supply (do not trust the label!) | → 3V3, so the outputs never exceed 3.3 V. |
| VRx | X axis (analog) | → ADC1 pin (e.g. GPIO 34). |
| VRy | Y axis (analog) | → ADC1 pin (e.g. GPIO 35). |
| SW | Button | → GPIO with INPUT_PULLUP. |
Specifications
Potentiometers2 × 10 kΩ
Output0 – supply (analog)
Buttonactive LOW
Tips and typical mistakes
- The centre is rarely exactly 2048: measure it at start-up and use a ±100 "dead zone".
- Use ADC1 pins if you have WiFi.