Joystick Module
Joystick Module
DESCRIPTION:
Lots of robotic projects need a joystick. This module offers an affordable solution to
that. The Joystick module is similar to analog joysticks found in gamepads. It is made
by mounting two potentiometers at a 90 degrees angle. The potentiometers are
connected to a short stick centered by springs.
This module produces an output of around 2.5V from X and Y when it is in resting
position. Moving the joystick will cause the output to vary from 0v to 5V depending on
its direction. If you connect this module to a microcontroller, you can expect to read a
value of around 512 in its resting position (expect small variations due to tiny
imprecisions of the springs and mechanism) When you move the joystick you should
see the values change from 0 to 1023 depending on its position.
1/4
SPECIFICATIONS:
●Directional movements are simply two potentiometers - one for each axis
●Compatible with Arduino interface
●The biaxial XY Joystick Module KY-023 applies ARDUINO
● Dimensions: 1.57 in x 1.02 in x 1.26 in (4.0 cm x 2.6 cm x 3.2 cm)
● 5 Pin
●Color: Black
PIN CONFIGURATION:
1. GND: ground
2. +5V: 5V DC
3. VRx: voltage proportional to x position
4. VRy: voltage proportional to y position
5. SW: switch pushbutton
2/4
Example:
Here is an example, connect the circuit as below and run the code, you will see
the analog value from X, Y axis and button through the Serial Monitor.
Code:
int sensorPin = 5;
int value = 0;
void setup() {
pinMode(3, OUTPUT);
[Link](9600);
}
void loop() {
value = analogRead(0);
[Link]("X:");
[Link](value, DEC);
value = analogRead(1);
[Link](" | Y:");
[Link](value, DEC);
value = digitalRead(7);
[Link](" | Z: ");
3/4
[Link](value, DEC);
delay(100);
}
Result:
4/4