Stufin
Home Quick Cart Profile

Joystick Module (Pack of 25)

Buy Now on Stufin

Supply Voltage

3.3V to 5V

Operating Current

10mA (typical)

Output Impedance

10k (typical)

X and Y Axis Resolution

10-bit (1024 steps)

Deadband Adjustment Range

0 to 100 (adjustable)

Operating Temperature

-20C to 70C

Dimension

20mm x 20mm x 15mm (L x W x H)

Applications

The Joystick Module is suitable for a wide range of IoT projects and applications, including

Robotics and robotic arms

Gaming controllers and consoles

Industrial control systems

Medical devices and equipment

Home automation and smart home systems

Prototyping and proof-of-concept projects

Ordering Information

Part Number

JOYSTICK-25PK

Pack Quantity

25 pieces

Packaging

Anti-static bag or tray, depending on the quantity

Warranty and Support

The Joystick Module is covered by a 1-year limited warranty. Technical support is available through our website, including datasheets, application notes, and FAQs. For additional support or assistance, please contact our technical support team.

Pin Configuration

  • Joystick Module (Pack of 25) Pinout Explanation
  • The Joystick Module is a popular IoT component used to measure the direction and magnitude of joystick movements. It typically consists of two potentiometers (one for the X-axis and one for the Y-axis) and a tactile switch for the push-button function. Here's a breakdown of the pins on the Joystick Module:
  • Pinout Structure:
  • The Joystick Module usually has 5 pins, and they are arranged in the following structure:
  • VCC: Power supply pin (typically 5V or 3.3V)
  • GND: Ground pin
  • X: X-axis analog output pin
  • Y: Y-axis analog output pin
  • SW: Digital pin for the push-button switch
  • Pin Explanation:
  • 1. VCC (Power Supply Pin)
  • Function: Provides power to the joystick module
  • Typical Voltage: 5V or 3.3V
  • Connection: Connect to the positive terminal of your power source (e.g., Arduino's 5V pin or a 3.3V regulator output)
  • 2. GND (Ground Pin)
  • Function: Provides a ground reference for the joystick module
  • Connection: Connect to the negative terminal of your power source (e.g., Arduino's GND pin or a common ground point)
  • 3. X (X-axis Analog Output Pin)
  • Function: Outputs an analog voltage signal representing the joystick's X-axis movement
  • Signal Range: Typically 0V to VCC (e.g., 0V to 5V or 0V to 3.3V)
  • Connection: Connect to an analog input pin on your microcontroller (e.g., Arduino's A0 or A1 pin)
  • 4. Y (Y-axis Analog Output Pin)
  • Function: Outputs an analog voltage signal representing the joystick's Y-axis movement
  • Signal Range: Typically 0V to VCC (e.g., 0V to 5V or 0V to 3.3V)
  • Connection: Connect to an analog input pin on your microcontroller (e.g., Arduino's A2 or A3 pin)
  • 5. SW (Digital Pin for Push-button Switch)
  • Function: Outputs a digital signal indicating the state of the push-button switch
  • Signal: Typically active-low (i.e., the signal is LOW when the button is pressed and HIGH when the button is released)
  • Connection: Connect to a digital input pin on your microcontroller (e.g., Arduino's D2 or D3 pin)
  • Important Notes:
  • Make sure to check the specific datasheet or documentation for your Joystick Module, as the pinout structure and voltage levels may vary.
  • When connecting the joystick module to a microcontroller, ensure that the voltage levels and signal ranges are compatible.
  • Use a voltage regulator or voltage divider if necessary to step down the voltage to the required level for your microcontroller.
  • By following these pinout explanations and connection guidelines, you can successfully integrate the Joystick Module into your IoT project.

Code Examples

Joystick Module (Pack of 25) Documentation
Overview
The Joystick Module is a compact, high-precision analog joystick module designed for a range of applications, from robotics and gaming to automation and interactive projects. This pack of 25 modules is perfect for prototyping, development, and production.
Technical Specifications
Analog output
 2-axis joystick (x-axis and y-axis)
 5-pin interface (VCC, GND, X, Y, Z)
 Operating voltage: 3.3V to 5V
 Dimensions: 15mm x 15mm x 20mm
Pinout
| Pin | Function |
| --- | --- |
| VCC | Power supply (3.3V to 5V) |
| GND | Ground |
| X | X-axis analog output |
| Y | Y-axis analog output |
| Z |Switch output ( presses the joystick) |
Code Examples
### Example 1: Basic Joystick Reading with Arduino
This example demonstrates how to read the joystick's x-axis and y-axis values using an Arduino board.
```c++
const int xPin = A0;  // x-axis pin
const int yPin = A1;  // y-axis pin
void setup() {
  Serial.begin(9600);
}
void loop() {
  int xValue = analogRead(xPin);
  int yValue = analogRead(yPin);
Serial.print("X-axis: ");
  Serial.print(xValue);
  Serial.print(" | Y-axis: ");
  Serial.println(yValue);
delay(50);
}
```
### Example 2: Joystick-Controlled Robot with Raspberry Pi
This example shows how to use the joystick module to control a robot's movement using a Raspberry Pi.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# Joystick pin connections
xPin = 17
yPin = 23
zPin = 24
GPIO.setup(xPin, GPIO.IN)
GPIO.setup(yPin, GPIO.IN)
GPIO.setup(zPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
    xValue = GPIO.input(xPin)
    yValue = GPIO.input(yPin)
if xValue > 500:
        print("Moving right")
    elif xValue < 200:
        print("Moving left")
    else:
        print("Stationary")
if yValue > 500:
        print("Moving forward")
    elif yValue < 200:
        print("Moving backward")
    else:
        print("Stationary")
time.sleep(0.1)
```
### Example 3: Joystick-Operated LED Matrix with ESP32
This example demonstrates how to use the joystick module to control an LED matrix using an ESP32 board.
```c++
#include <WiFi.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
const int xPin = 32;  // x-axis pin
const int yPin = 33;  // y-axis pin
void setup() {
  Serial.begin(115200);
  matrix.begin(0x70);  // Initialize LED matrix
}
void loop() {
  int xValue = analogRead(xPin);
  int yValue = analogRead(yPin);
if (xValue > 500) {
    matrix.fillScreen(LED_RED);
    matrix.writeDisplay();
  } else if (xValue < 200) {
    matrix.fillScreen(LED_GREEN);
    matrix.writeDisplay();
  } else {
    matrix.fillScreen(LED_OFF);
    matrix.writeDisplay();
  }
if (yValue > 500) {
    matrix.setTextWrap(false);
    matrix.setTextColor(LEDYELLOW);
    matrix.setCursor(0, 0);
    matrix.print("UP");
    matrix.writeDisplay();
  } else if (yValue < 200) {
    matrix.setTextWrap(false);
    matrix.setTextColor(LEDYELLOW);
    matrix.setCursor(0, 0);
    matrix.print("DOWN");
    matrix.writeDisplay();
  } else {
    matrix.fillScreen(LED_OFF);
    matrix.writeDisplay();
  }
delay(50);
}
```
These examples demonstrate the versatility of the Joystick Module and its potential applications in various IoT projects.