DOT Matrix (8x8) Using Arduino
by CodeChamp in Workshop > Lighting
41920 Views, 16 Favorites, 0 Comments
DOT Matrix (8x8) Using Arduino
Wassup Guys!!
In this instructable, I'm going to show you How to Interface LED Dot Matrix with Arduino UNO using MAX7219 IC. This project can be used to make low-resolution images using LEDs. This project is very simple to build and it also serves as a basic to getting started with controlling a large number of LEDs using the Arduino Uno.
Tools & Components Required
Here is the list of components required to build this project.
- Arduino UNO
- 8x8 LED Matrix with MAX7219
- Breadboard
- Header Wires
- 5V power supply
- Arduino IDE
Circuit Connections
For this project, we will be using the MAX7219 which is an Driver IC, which works with SPI communication. An 8x8 LED Matrix has 64 Pins in total if all the cathodes are connected together. While an Arduino has only 14 digital pins, and the Arduino is not capable of providing 64 LEDs with enough current so we use the MAX7219, which needs only four Arduino pins to control the LEDs.
The connections are very simple, no soldering skills required.
MAX7219 CLK = Arduino Digital Pin10
MAX7219 CS = Arduino Digital Pin9
MAX721 DIN = Arduino Digital Pin8
MAX721 GND = Arduino Digital GND
The VCC pin from the LED Matrix should be connected to an external 5v power supply (5v 1A recommended), each pin of the Arduino is capable of providing a max current of 40mA. And the 5V regulator is capable of providing a max current of 200mA. The Led Matrix requires higher operating current.
Let's Code
The code can be found below, this is the Code to generate a Smiley on the LED Matrix. The code is simple to understand and you can change the patterns of the LED's in the code.
#include <LedControl.h>
int DIN = 12; int CS = 11; int CLK = 10;
LedControl lC = LedControl(DIN,CLK,CS,0);
void setup() {
lc.shutdown(0,false); //The MAX72XX is in power-saving mode on startup
lc.setIntensity(0,15); // Set the brightness to maximum value lc.clearDisplay(0); // and clear the display}
void loop() {
byte a[8] = {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C};
printByte(a); delay(1000);}
void printByte(byte character []) {
int i = 0; for(i=0;i<8;i++) { lc.setRow(0,i,character[i]); }
}
Downloads
Library Setup
Before you get started with coding you need Arduino IDE.
To download Arduino IDE and for Arduino setup, you can check my previous instructable. And for this Instructable you need LedControl Matrix LIbrary, you can download it from the link below.
https://github.com/wayoda/LedControl
Ok, let's begin with coding.
Downloads
Pattern Generation
To generate patterns you need Pixel to matrix converter. The converter file is attached below, you can download and use it.
The patterns are generated by editing an array in the code to the required hex array, this hex array can be generated by downloading the converter and using the tool to generate hex strings, after you have generated the string you can copy and paste the string in the sample code from the previous step to generate custom patterns.
Downloads
TADAAA!! the Ouptup Is Here
That's all folks!!
Hope you enjoy by trying various patterns. Thank you.