What Will I Learn?
Today in this instructable we will learn how to control 8x8 LED matrix using Joystick module, its very useful for school project activies a basic tutorial for Dot matrix LED and joystick. how to program arduino on desktop IDE and how to connect the components with a circuit diagram.
Requirements
We need this couple of arduino components required on this tutorial.
- 8X8 RED LED MATRIX with i2c backpack
The main components on this tutorial is the LED matrix this tube contains of 64 mini led base. there are many types of led matrixes available on the market the generic one comes with a 16 pin without i2c backpack but in this tutrorial we were using the led matric with i2c backpack with only 5 pins.
- JoyStick module
this module is more likely the same as the joystick of playstation 2 controller. i bought mine in less than 2 dollars on ebay
The module has 5 pins: Vcc, Ground, X, Y, Key. Note that the labels on yours may be slightly different, depending on where you got the module from. The thumbstick is analog and should provide more accurate readings than simple ‘directional’ joysticks tat use some forms of buttons, or mechanical switches.source
- Arduino Uno R3
In this tutorial i am using the clone arduino r3
It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button.source
It contains everything needed to support the microcontroller components.
- Breadboard
we will use a Single Panel Breadboard it is a solderless device for temporary prototype with electronics and test circuit designs. both side of the breadboard is the power rail it is horizontal lining and the middle is the vertical rail for arduino components.
- Jumper wires
we will use jumpers to connect on a breadboard or female header connector, size and color to distinguish the different working signals. we will use the male to male jumper for 7 segment and the buttons to connect to arduino
Difficulty
Either choose between the following options:
- Basic
Tutorial Contents
SOFTWARE
we are going to use the arduino ide, to set the sketch for this, if you dont have make sure to download the Arduino IDE for your specific operating system. I’ll leave a link to where you can download this software: https://www.arduino.cc/en/Main/SoftwareLibraries
As long as the IDE had been installed next is you need to download the library to control the LED dot matrix
https://github.com/wayoda/LedControl/releases
choose the latest LedControl-1.0.6.zip file library.8x8 LED matrix Circuit Diagram
in this version of 8x8 led it has 5 pins wich will be connected to specified arduino pins, lets start with the GND and VCC pin these power pin is connected to 5V on VCC and GND to any of 3 GND on the arduino uno R3 board, the remaining 3 pins on the i2c baccpack of the matrix is the DIN pin to arduino digital pin 8, the CS to digital pin 9and CLK to pin 10.
- VCC- 5V
- GND- GND
- DIN- pin 8
- SC- pin 9
- CLK- pin 10
Joystick module Circuit Diagram
We have to use analog Arduino pins to read the data from the X/Y pins, and a digital pin to read the button. The Key pin is connected to ground, when the joystick is pressed down, and is floating otherwise. To get stable readings from the Key /Select pin, it needs to be connected to Vcc via a pull-up resistor.source
the joystick module that we were going to use has only 5 pins the GND pin is connected to any GNd on the arduino board VCC to 5V and the VRY axis pin to pin A0 its analog pin on the arduino. the VRX is for analog pin A1.
- VCC - 5V
- GND - GND
- VRX - A0
- VRY - A1
combine all the components together in one single panel breadboard
- Connect the arduino uno board to your computer using the Type B usb cable included in the package. open the arduino Desktop IDE locate the TOOLS verify the type of board you are using PORT should be on the COM# and the board should be on the arduino/genuino uno if youre using the same board as mine.
- We are using the sketch code from the repository Shawnee-Union
SOURCE CODE
int UD = 0;
int LR = 0; //Setting up controller//
#include "LedControl.h" // need the library
LedControl lc=LedControl(8,10,9,1); //10 is to CLOCK, 9 = CS, 8=DIN//
void setup() {
Serial.begin(9600);
lc.shutdown(0,false);// turn off power saving, enables display
lc.setIntensity(0,8);// sets brightness (0~15 possible values)
lc.clearDisplay(0);// clear screen
}
void loop() {
UD = analogRead(A0);
LR = analogRead(A1);
char x_translate = map(LR, 1021, 0, 7, 0); //This maps the values//
char y_translate = map(UD, 1021, 0, 0, 7);
Serial.print("UD = ");
Serial.print(UD, DEC);
Serial.print(", LR = ");
Serial.print(LR, DEC);
Serial.print(", x = ");
Serial.print(x_translate, DEC);
Serial.print(", y = ");
Serial.println(y_translate, DEC);
// not in shutdown mode
lc.clearDisplay(0);
lc.setLed(0,x_translate,y_translate,true);
delay(150); //Mess with this delay to get your joystick correct//
}
I hope you enjoy this actitvity if want to learn how arduino works, and how to make a sketch, then maybe this site https://www.arduino.cc/en/Tutorial might help you, all images on this blog are supposedly mine. thank you for stopping by..
please check my previous tutorials
https://utopian.io/utopian-io/@pakganern/control-2-servo-with-potentiometer-xod
Posted on Utopian.io - Rewarding Open Source Contributors
very good explanation I congratulate you greetings
wow great explanation of the project, very nice electronics and controller explanation great
Your contribution cannot be approved because it does not follow the Utopian Rules.
Violated Rule:
My Opinion:
You can contact us on Discord.
[utopian-moderator]
Cool! I follow you. +upvote