TENSTAR ROBOT KY-023

Contents

KY-023 Dual-Axis XY Joystick Module User Manual

Model: KY-023 | Brand: TENSTAR ROBOT

1. Introduction

The KY-023 Dual-Axis XY Joystick Module is a versatile input device designed for microcontroller projects, commonly used with Arduino sensor expansion boards. It functions as a PS2-style rocker potentiometer, providing two-axis (X and Y) analog output and a single digital button (Z-axis) output. This module is ideal for creating remote control interfaces, game controllers, and other interactive systems.

2. Product Overview

The KY-023 module consists of a joystick lever that can be moved in two dimensions (X and Y) and pressed down for a third input (Z). It features standard pin headers for easy connection to development boards.

2.1 Components

  • Joystick Lever: Provides X and Y axis movement.
  • Push Button (SW): Activated by pressing the joystick down.
  • Potentiometers: Two 10K potentiometers for X and Y axis analog readings.
  • Pin Headers: For power, ground, and signal outputs.

2.2 Pinout Diagram

The module has five pins:

  • GND: Ground connection.
  • +5V: Power supply (3.3V to 5V DC).
  • VRX: Analog output for the X-axis.
  • VRY: Analog output for the Y-axis.
  • SW: Digital output for the Z-axis (button press).
KY-023 Joystick Module Pinout Diagram
Figure 1: KY-023 Joystick Module Pinout
KY-023 Joystick Module with cap and pins
Figure 2: KY-023 Joystick Module

3. Specifications

Feature Description
Input Voltage DC 3.3V to 5V
Output Signal 2-axis analog (X, Y), 1-axis digital (Z button)
Potentiometer Type Bi-directional 10K resistor
Dimensions (approx.) 34mm x 26mm
Weight 11g
Application Microcontroller projects (e.g., Arduino, Raspberry Pi)
KY-023 Joystick Module Dimensions
Figure 3: KY-023 Joystick Module Approximate Dimensions

4. Setup

4.1 Wiring Instructions (Example with Arduino)

  1. Connect the GND pin of the KY-023 module to the GND pin on your Arduino board.
  2. Connect the +5V pin of the KY-023 module to the 5V (or 3.3V) pin on your Arduino board.
  3. Connect the VRX pin of the KY-023 module to an analog input pin on your Arduino (e.g., A0).
  4. Connect the VRY pin of the KY-023 module to another analog input pin on your Arduino (e.g., A1).
  5. Connect the SW pin of the KY-023 module to a digital input pin on your Arduino (e.g., D2).

4.2 Example Arduino Code

This example code reads the joystick's X and Y analog values and the Z button state, then prints them to the Serial Monitor.


// Define joystick pins
const int JoyStick_X = A0; // X-axis analog pin
const int JoyStick_Y = A1; // Y-axis analog pin
const int JoyStick_Z = 2;  // Z-axis (button) digital pin

void setup() {
  // Initialize serial communication at 9600 bits per second:
  Serial.begin(9600);

  // Set the button pin as an input with internal pull-up resistor
  // (Joystick button usually connects to GND when pressed)
  pinMode(JoyStick_Z, INPUT_PULLUP);
}

void loop() {
  // Read the analog values for X and Y axes
  int xValue = analogRead(JoyStick_X);
  int yValue = analogRead(JoyStick_Y);

  // Read the digital value for the Z button
  // It will be LOW when pressed, HIGH when not pressed (due to INPUT_PULLUP)
  int zState = digitalRead(JoyStick_Z);

  // Print the values to the Serial Monitor
  Serial.print("X: ");
  Serial.print(xValue);
  Serial.print(" | Y: ");
  Serial.print(yValue);
  Serial.print(" | Z (Button): ");
  Serial.println(zState == LOW ? "PRESSED" : "NOT PRESSED");

  delay(100); // Small delay to make readings readable
}

      

5. Operating Instructions

5.1 Analog Output (X and Y Axes)

The X and Y axes provide analog voltage outputs that vary with the joystick's position. When the joystick is centered, the output voltage for both axes will be approximately half of the supply voltage (e.g., ~2.5V for a 5V supply). Moving the joystick towards one extreme will increase the voltage towards the supply voltage (e.g., 5V), while moving it towards the opposite extreme will decrease the voltage towards 0V.

  • Arduino Analog Read: The analogRead() function on Arduino will convert this voltage into a digital value ranging from 0 to 1023 (for a 10-bit ADC).
  • Center Position: Typically reads around 511-512.
  • Extreme Positions: Reads close to 0 or 1023.

5.2 Digital Output (Z-axis Button)

The SW pin acts as a simple push button. When the joystick lever is pressed down, the SW pin changes its state. If connected with an internal pull-up resistor (INPUT_PULLUP), the pin will read HIGH when not pressed and LOW when pressed.

6. User Tips

  • Smooth Adjustment: The potentiometers provide smooth and continuous analog readings, making them suitable for precise control.
  • 3.3V Operation: The module can operate with a 3.3V supply. Simply connect the +5V pin of the module to a 3.3V source on your microcontroller. Ensure your microcontroller's analog inputs are 3.3V tolerant if using a 5V module with a 3.3V microcontroller, or use a voltage divider.
  • Analog Range: Expect analog readings from 0 to 1023 when using Arduino's analogRead() function, corresponding to the full range of motion.
  • Button Polarity: When using INPUT_PULLUP for the button pin, a LOW reading indicates the button is pressed.

7. Troubleshooting

7.1 No Readings or Incorrect Readings

  • Check Wiring: Ensure all connections (GND, VCC, VRX, VRY, SW) are secure and connected to the correct pins on your microcontroller.
  • Power Supply: Verify that the module is receiving adequate power (3.3V-5V).
  • Analog Pin Assignment: Double-check that VRX and VRY are connected to actual analog input pins on your microcontroller.
  • Digital Pin Assignment: Ensure SW is connected to a digital input pin.
  • Code Errors: Review your code for typos, incorrect pin definitions, or logic errors.

7.2 Button Not Responding

  • Pin Mode: Ensure the button pin is set as INPUT_PULLUP in your setup function.
  • Polarity: Remember that with INPUT_PULLUP, the button reads LOW when pressed.
  • Physical Check: Ensure the joystick physically clicks when pressed down.

8. Maintenance

The KY-023 module is a robust electronic component, but proper care can extend its lifespan:

  • Keep Dry: Avoid exposure to moisture or liquids.
  • Dust-Free: Protect the module from excessive dust, which can interfere with the potentiometers.
  • Handle with Care: Avoid applying excessive force to the joystick lever or bending the pins.
  • Storage: Store in a cool, dry place when not in use.

9. Warranty and Support

For any issues or further assistance, please contact your retailer or the manufacturer. Keep your purchase receipt for warranty claims, if applicable. Detailed technical support and community forums for Arduino and similar microcontrollers can also provide valuable resources for project development.

© 2023 TENSTAR ROBOT. All rights reserved.

Documents and downloads

Ask a question about this manual

Ask about setup, troubleshooting, compatibility, parts, safety, or missing instructions. Manuals+ will review the question and use this page’s manual context to help answer it.

After a successful submission, we securely hash the supplied account or form email before sending it to Microsoft Advertising for conversion attribution. Privacy details.