Source: https://mokxi.com/parts/joystick
Updated: 2026-11-10

Part

# Thumb stick

Two axes and a push switch. Drag the cap to move it.

See every part

- 5 pins
- In 15 projects
- In 3 lessons

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Thumb stick in brief

What it is, and where it sits on the bench.

The KY-023 joystick module is two 10k potentiometers and a push switch under one thumb cap. Each pot sits across the supply with its wiper on VRX or VRY, so the axes are voltages read with analogRead: A0 and A1 on an Arduino Uno, giving 0 to 1023, or two ADC1 pins on an ESP32, giving 0 to 4095. Power it from 3.3 volts on an ESP32, or a stick pushed to one end puts 5 volts on an ADC pin. SW shorts to ground when the stick is pressed down and has no pull-up of its own, so it needs INPUT_PULLUP; reading it as a plain input is the usual mistake. Mokxi models each axis as a real divider across whatever VCC and GND hold, with a source impedance of zero at the ends and 2.5k at center. Drag the cap to move it and it springs back to exactly 512 of 1023. Real sticks never return to the same count, so they need a dead band this model does not, and SW never bounces here.

Family

Inputs

Pins

5

A circuit built around it, running and explained: the Joystick simulator.

Pins

## 5 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

GND

The other end of both tracks.

VCC

Supply for both potentiometer tracks.

VRX

The X-axis wiper.

VRY

The Y-axis wiper.

SW

Shorts to ground when pressed; open the rest of the time.

How to use it

## How to use the KY-023 joystick with an Arduino

VCC to 5 V, GND to GND, VRX to A0, VRY to A1 and SW to a digital pin with INPUT_PULLUP, pin 12 here. analogRead() on each axis gives 0 to 1023, with the stick at rest near the middle. The bar graph example maps the X reading onto eight LEDs, and pressing the stick swaps it to the Y axis.

The mokxi_joystick.h driver wraps the three reads: x() and y() give the raw axes, dx() and dy() measure from where the stick rested at begin() with a dead zone, and clicked() reports a press once. The rest point is read rather than assumed because a real stick never springs back to exactly 512, so a sketch that steers from dx() and dy() does not creep.

Part pin

Board pin

VRX

A0

VRY

A1

SW

Pin 12

VCC

5 V

GND

GND

On an ESP32-C3, power the stick from 3.3 V and read the axes on ADC1 pins, 0 to 4095; the ESP32-C3 thumb stick example uses GPIO 0 and 1 with SW on GPIO 3.

Hold the button

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

The stick from the bar graph example

How it is modeled

## What is true about the Thumb stick, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

The wiper's source impedance is the two halves of the track in parallel (zero at
the ends, 2.5 k at center for a 10 k pot), so an ADC input with a real load on it
sees the module's actual impedance, not an idealized voltage. Both the Uno's
ten-bit ADC and the ESP32-C3's twelve-bit ADC1 can read it, and mokxi_joystick.h
in the firmware library hides the difference between 0 to 1023 and 0 to 4095.

### Not modeled

No mechanical detent or spring rate beyond the springback itself, and no wear on the
tracks.

The center is exact and silent. A real KY-023 does not spring back to the same
count twice. It lands somewhere near the middle with a few counts of slop, and its
wiper adds noise on top, which is why every thumb-stick sketch has a dead band in it.
Here the release is exactly 512 of 1023 on both axes, every time, with no noise and no
drift, so a sketch that would need a dead band on the bench works without one. The two
tracks are perfectly linear and perfectly matched, where real ones are neither.

The track is an ideal divider: no wiper contact resistance, no end resistance, no
scratchiness as it moves, and SW does not bounce even though the switch under a real
one is a tactile dome.

From Thumb stick (joystick), in full.

Projects

## See the Thumb stick in a project

15 built-in projects use it. Each opens in the editor, already wired.

Lessons

## Where it turns up in a lesson

3 lessons place it in their own circuits.

### Learn articles

3 lessons

- Arduino Joystick Module: Wiring, Code, Live Demo
- Arduino ILI9341 TFT Display: Wiring and Code
- Arduino Snake Game on an 8x8 LED Matrix (MAX7219)

Boards

## The boards it is shown on

Each of these 3 boards has a built-in project with the Thumb stick in it.

- Arduino Uno R3
- ESP32-C3-DevKitM-1
- SparkFun Pro Micro

Boards

## The Thumb stick on each board

The pins, the voltage and the code change from board to board. Each page has that board’s wiring and a circuit you can run.

- Arduino Uno and Joystick
- ESP32 and Joystick
- Arduino Nano and Joystick

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Thumb stick

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
