Skip to content

4.2.26. Joystick Dynamic Dot Matrix Pointer

| Description In Project 116, learners will construct an expert interactive system titled 'Joystick Dynamic Dot Matrix Pointer'. This manual details the complete synthesis of XY Joystick + MAX7219 8x8 Dot Matrix + RGB LED Module into an intuitive, high-performance automated control platform.|------------------|----------------------------------------------------------------| | Use case |This project connects to real-world industrial and IoT applications such as: Project 116 equips students with professional skills in embedded human-machine interface (HMI) design and automated motion control.|

Components (Things You will need)

Arduino Uno Arduino USB Cable Bread Board Jumper Wires RGB Module Resistor LED Joystick 8x8 Dot Matrix

Building the circuit

Things Needed:

  • Arduino Uno Core Board
  • XY Joystick
  • MAX7219 8x8 Dot Matrix
  • RGB LED Module
  • USB Cable & Jumper Wires
  • Bread Board
  • Resistor

Mounting the component on the breadboard and wiring the circuit

Step 1: Connect the Arduino 5V pin to the breadboard's positive (+) power rail and the Arduino GND pin to the negative (-) power rail.

Step 2: Place the XY Joystick on the breadboard. - Connect the VCC pin to the 5V power rail on the breadboard - Connect the GND pin to the ground rail on the breadboard - Connect the VRx pin to Analog Pin A0 - Connect the VRy pin to Analog Pin A1 - Connect the SW pin to Digital Pin 2

Step 3: Place the MAX7219 8x8 Dot Matrix on the breadboard. - Connect the VCC pin to the 5V power rail on the breadboard - Connect the GND pin to the ground rail on the breadboard - Connect the DIN pin to Digital Pin 11 - Connect the CS pin to Digital Pin 10 - Connect the CLK pin to Digital Pin 13

Step 4: Place the RGB LED Module on the breadboard. - Connect the Red, Green, and Blue pins to Digital Pins 3, 5, and 6 respectively through 220Ω resistors - Connect the common pin to the ground rail on the breadboard (Common Cathode) or the 5V power rail on the breadboard (Common Anode)

Step 5: Ensure all components share a common GND connection, then verify all wiring before connecting the Arduino Uno to your computer using the USB cable.

Components on breadboard

Step 6: After confirming that all connections are correct, connect the USB cable to the Arduino Uno board and the computer to power the circuit.

Make sure to connect the Arduino USB cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.

// Project 116: Joystick Dynamic Dot Matrix Pointer
// Target Setup: XY Joystick + MAX7219 8x8 Dot Matrix + RGB LED Module

#include <LedControl.h> // Ensure LedControl library is installed

// MAX7219 pins: DIN, CLK, CS
LedControl lc = LedControl(11, 13, 10, 1);

const int joyX = A0;
const int joyY = A1;
const int joySW = 2;
const int redPin = 3;
const int greenPin = 5;
const int bluePin = 6;

void setup() {
  pinMode(joySW, INPUT_PULLUP);
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);

  lc.shutdown(0, false);
  lc.setIntensity(0, 8);
  lc.clearDisplay(0);
  Serial.begin(9600);
}

void loop() {
  int xVal = map(analogRead(joyX), 0, 1023, 0, 7);
  int yVal = map(analogRead(joyY), 0, 1023, 0, 7);

  lc.clearDisplay(0);
  lc.setLed(0, yVal, xVal, true);

  // Basic RGB feedback based on joystick position
  analogWrite(redPin, map(analogRead(joyX), 0, 1023, 0, 255));
  analogWrite(greenPin, map(analogRead(joyY), 0, 1023, 0, 255));

  delay(50);
}


Step 7: Save your code. See the Getting Started section

Step 8: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.

Step 9: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code

CONCLUSION

Operating physical input devices instantly modifies actuator behavior and updates visual indicators in real time.