Component guide · Beginner · 3 min read
Joystick Modules

Wiring, Dead Zones and Shields
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
A thumb joystick module is two potentiometers at right angles plus a push button under the stick. The VRx and VRy pins give voltages that change as you move the stick, read on two analog pins, and SW goes low when you press down. The centre is about half the supply voltage, but never exactly, so read the rest position at startup and ignore small movements with a dead zone.
Key specs at a glance
- Pins
- GND, +5V, VRx, VRy, SW
- Axes
- Two 10 kΩ potentiometers (typical)
- Output
- 0 V to supply on each axis, centre about half
- Button
- Press-down switch to GND; needs a pull-up
- Supply
- 3.3 V or 5 V (use the board's ADC reference)
- Shields
- Joystick shields add buttons and connectors for wireless modules
Wiring
Connect GND, +5V to your board's supply voltage (3.3 V on an ESP32 or Pico), VRx to A0, VRy to A1 and SW to a digital pin with INPUT_PULLUP. Powering from 3.3 V on a 3.3 V board keeps the outputs inside the ADC range.
Reading it with a dead zone
Read the rest position once, then subtract it.
const int PX = A0, PY = A1, PSW = 2;
const int DEAD = 30; // ignore small wobbles
int cx, cy;
void setup() {
Serial.begin(9600);
pinMode(PSW, INPUT_PULLUP);
cx = analogRead(PX); cy = analogRead(PY); // leave the stick alone at power-up
}
int axis(int raw, int centre) {
int v = raw - centre;
return abs(v) < DEAD ? 0 : v;
}
void loop() {
int x = axis(analogRead(PX), cx);
int y = axis(analogRead(PY), cy);
bool pressed = digitalRead(PSW) == LOW;
Serial.print(x); Serial.print(' '); Serial.print(y);
Serial.println(pressed ? " PRESSED" : "");
delay(50);
}Driving servos, motors and robots
map each axis to 0 to 180 degrees for two servos.
use Y for speed and X for steering; mix them into left and right motor driver PWM values and limit the result to the valid range.
a joystick shield on one Arduino with an nRF24L01 sends the values to the robot. Send a packet several times a second and stop the motors if packets stop arriving.
Cheap joysticks rarely reach full scale in every direction, so clamp the values and scale each side separately if you need full speed.
Try it: ADC resolution calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Assuming the centre reads exactly 512.
- Powering it from 5 V on a 3.3 V board.
- Forgetting the pull-up on the button pin.
- No dead zone, so the robot creeps when the stick is released.
- No failsafe when the wireless link drops.
Frequently asked questions
What are VRx, VRy and SW?
VRx and VRy are the X and Y axis outputs, and SW is the push button.
Why does my joystick not return to 512?
The springs and pots are not exact. Read the centre at startup and use a dead zone.
Can I use it with ESP32?
Yes. Power it from 3.3 V and use ADC1 pins if Wi-Fi is on.
How do I control two motors with one joystick?
Mix the axes: left = Y + X and right = Y - X, then limit each to the motor range.
What is a joystick shield?
An Arduino shield with a joystick, extra buttons and headers for wireless modules, used to build remotes.
Parts for this guide
Search the store for the parts named above, or ask Geeko AI which one fits your project.
Calculators
Terms in this guide
Projects that use it
Put this into practice: 5 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.
