build custom characters using pixeltomatrix to MAX7219 Driven Led matrix
lapilipinas (66)in #utopian-io • 6 years ago (edited)
How to Build custom character using pixeltomatrix to LED Matrix 8x8 Driven by MAX7219
20180313_160411[1].jpg
What Will I Learn?
In this tutorial, you will learn the following
what is LED Matrix 8x8 Driven by MAX7219
how to make a custom character using pixelmatrix
how to make a counter 0-9 and letters using led matrix
how to program a code on arduino Desktop IDE
how to connect all the components connection using diagra
HARDWARE
Step 1: Gather all the Requirements
Requirements
For this part, you will need the following arduino components
20180313_160943.jpg
8x8 Dot Matrix With Driver Board
Breadboard or PCB/optional
jumper wires
Type B usb cable
Arduino UNO R3 board
PC
Difficulty
Intermediate
Tutorial Contents
Step 2: Build the circuit
Experimental Procedures
The arduino UNO R3
20180313_160808.jpg
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. 32k Flash Memory,
reference
codes and programs can be uploaded on to it from the easy Arduino computer program. which makes it a very easy way to get started working with embedded electronics. The name R3 is the third, and latest version of Arduino Uno Board
The LED Matrix 8x8 Driven by MAX7219
20180313_160657.jpg
The 8×8 LED matrix is made up of red 64 LEDs, the driver MAX7219 chip it is built in pcb to control the LED matrix, header PINs and sockets, one 10KOhm resistor, a 100nF capacitor, a 10uF electrolic capacitor where everything is connected. The LED matrix being used in this tutorial comes pre-soldered with the MAX7219 Controller this matrix typically used for displaying text, counters, symbols, numbers and etc.
Connection to arduino
the Driver MAX7219 has 5 pins the power pins GND / VCC , and the Digital pin output DIN,CS and CLK which will connect to specified arduino D pins.
image.png
VCC - 5V
GND - GND
DIN - digital pin 10
CS - digital pin 11
CLK - digital pin 12
SOFTWARE
Step 3: Download the Software and Libraries
If you’re ready to get started, click on the link below then select the version with your operating system.
Dowload the arduino Desktop IDE: https://www.arduino.cc/en/Main/Software
When the download is finished, un-zip it and open up the Arduino folder to confirm that click yes, there are some files and sub-folders inside. The file structure is important so don’t be moving any files around unless you really know what you’re doing.
Downlaod the LED Control Library: https://github.com/wayoda/LedControl
Once installed the Arduino desktop IDE and the Library. open the arduino software then locate the SKETCH tab at the top of the software, navigate ADD ZIP LIBRARY >> then look for the downloaded libraries in the download folder. SELECT the zip file then wait for the process. include all the libraries fo liquidcrystal display.
ad.png
Step 4: Create custom Graphics
I used pixeltomatrix It generates custom byte hex and binary for LED matrix after the design has been done to show which LED will stay on and Which LED will go off to properly represent the number and letter. download pixelmatric here: http://generator1116.rssing.com/chan-36314998/all_p1.html
Customize the character by clicking the node box it will generate byte arrays which will use to build the code later.
1.png
Once the Design is done click on GENERATE and copy the generated byte arrays for number 1.
copy gen.png
0x00,0x10,0x30,0x50,0x10,0x10,0x7C,0x00
Number 2
2.png
0x00,0x38,0x6C,0x0C,0x18,0x30,0x7C,0x00
Number 3
3.png
0x00,0x78,0x08,0x38,0x08,0x08,0x78,0x00
Number 4
4.png
0x00,0x00,0x48,0x48,0x78,0x08,0x08,0x00
Number 5
5.png
0x00,0x3C,0x20,0x3C,0x04,0x04,0x3C,0x00
Number 6
6.png
0x00,0x7C,0x40,0x7C,0x44,0x44,0x7C,0x00
Number 7
7.png
0x00,0x3E,0x02,0x04,0x08,0x10,0x20,0x00
Number 8
8.png
0x00,0x3C,0x24,0x3C,0x24,0x24,0x3C,0x00
Number 9
9.png
0x00,0x78,0x48,0x78,0x08,0x08,0x08,0x00
Letter S
s.png
0x00,0x00,0x7C,0x60,0x7C,0x0C,0x7C,0x00
Letter T
t.png
0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x00
Letter E
e.png
0x00,0x00,0x78,0x40,0x70,0x40,0x78,0x00
Letter M
m.png
0x00,0x00,0x44,0x6C,0x54,0x44,0x44,0x00
Letter I
i.png
0x00,0x10,0x00,0x10,0x10,0x10,0x38,0x00
Programming
Step 5: Build the code
#include <LedControl.h> // include led control library
int DIN = 10; // define DIN pin to digital pin 10
int CS = 11; // define CS pin to digital pin 11
int CLK = 12; // define CLK to digital pin 12
byte digit0[]= {0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00}; // number 0 byte arrays custom character
byte digit1[]= {0x00,0x10,0x30,0x50,0x10,0x10,0x7C,0x00}; // number 1 byte arrays custom character
byte digit2[]= {0x00,0x38,0x6C,0x0C,0x18,0x30,0x7C,0x00}; // number 2 byte arrays custom character
byte digit3[]= {0x00,0x78,0x08,0x38,0x08,0x08,0x78,0x00}; // number 3 byte arrays custom character
byte digit4[]= {0x00,0x00,0x48,0x48,0x78,0x08,0x08,0x00}; // number 4 byte arrays custom character
byte digit5[]= {0x00,0x3C,0x20,0x3C,0x04,0x04,0x3C,0x00}; // number 5 byte arrays custom character
byte digit6[]= {0x00,0x7C,0x40,0x7C,0x44,0x44,0x7C,0x00}; // number 6 byte arrays custom character
byte digit7[]= {0x00,0x3E,0x02,0x04,0x08,0x10,0x20,0x00}; // number 7 byte arrays custom character
byte digit8[]= {0x00,0x3C,0x24,0x3C,0x24,0x24,0x3C,0x00}; // number 8 byte arrays custom character
byte digit9[]= {0x00,0x78,0x48,0x78,0x08,0x08,0x08,0x00}; // number 9 byte arrays custom character
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,5); // Set the brightness, the maximum is 0,15
lc.clearDisplay(0); // and clear the display
}
void loop(){
byte s[]= {0x00,0x00,0x7C,0x60,0x7C,0x0C,0x7C,0x00}; // letter s byte arrays custom character
byte t[]= {0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x00}; // letter t byte arrays custom character
byte e1[]= {0x00,0x00,0x78,0x40,0x70,0x40,0x78,0x00}; // letter e byte arrays custom character
byte e2[]= {0x00,0x00,0x78,0x40,0x70,0x40,0x78,0x00};
byte m[]= {0x00,0x00,0x44,0x6C,0x54,0x44,0x44,0x00}; // letter m byte arrays custom character
byte i[]= {0x00,0x10,0x00,0x10,0x10,0x10,0x38,0x00}; // letter i byte arrays custom character
byte T[]= {0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x00};
printByte(s);
delay(1000); // set the delay time 1000 is eaqual to 1 sec
printByte(t);
delay(1000);
printByte(e1);
delay(1000);
printByte(e2);
delay(1000);
printByte(m);
delay(1000);
printByte(i);
delay(1000);
printByte(T);
delay(1000);
print0123456789();
lc.clearDisplay(0);
delay(1000);
}
void print0123456789()
{
printByte(digit0);
delay(1000);
printByte(digit1);
delay(1000);
printByte(digit2);
delay(1000);
printByte(digit3);
delay(1000);
printByte(digit4);
delay(1000);
printByte(digit5);
delay(1000);
printByte(digit6);
delay(1000);
printByte(digit7);
delay(1000);
printByte(digit8);
delay(1000);
printByte(digit9);
delay(1000);
}
void printByte(byte character [])
{
int i = 0;
for(i=0;i<8;i++)
{
lc.setRow(0,i,character[i]); // this is for blank
}
}