Arduino 8x8 LED Matrix

29,996

130

7

In this instructable I'm going to show you how to Interface with LED matrix using an Arduino and MAX7219 IC, this project can be used to make low resolution images using LEDs. This project is very simple to build and serves as a basics to getting started with controlling a large number of LEDs using the Arduino Uno.

For this project we will be using the MAX7219 which is display 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 Arudino 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 two Arduino pins to control the LEDS.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Tools and Components

Here is the list of components required to build this project, most of these parts can be purchased on eBay -

  • Arduino Uno
  • 8x8 LED matrix with MAX7219
  • Breadboard
  • Header Wires
  • 5V power supply

Step 2: Circuit

The connections are very simple and can be assembled on a breadboard. The Connections goes as follows -

  • 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.

Step 3: Code

The code can be found below, this is the code to generate a heart shaped object on the LED matrix. The code is simple to understand and you can change the patterns of the LEDs in the code. I will show you how to generate patterns in the next step.

unsigned char i;
unsigned char j; int Max7219_pinCLK = 10; int Max7219_pinCS = 9; int Max7219_pinDIN = 8; unsigned char disp1[19][8]={0x0c,0x1e,0x3e,0x7c,0x7c,0x3e,0x1e,0x0c}; void Write_Max7219_byte(unsigned char DATA) { unsigned char i; digitalWrite(Max7219_pinCS,LOW); for(i=8;i>=1;i--) { digitalWrite(Max7219_pinCLK,LOW); digitalWrite(Max7219_pinDIN,DATA&0x80); DATA = DATA<<1; digitalWrite(Max7219_pinCLK,HIGH); } } void Write_Max7219(unsigned char address,unsigned char dat) { digitalWrite(Max7219_pinCS,LOW); Write_Max7219_byte(address); Write_Max7219_byte(dat); digitalWrite(Max7219_pinCS,HIGH); } void Init_MAX7219(void) { Write_Max7219(0x09, 0x00); Write_Max7219(0x0a, 0x03); Write_Max7219(0x0b, 0x07); Write_Max7219(0x0c, 0x01); Write_Max7219(0x0f, 0x00); } void setup() { pinMode(Max7219_pinCLK,OUTPUT); pinMode(Max7219_pinCS,OUTPUT); pinMode(Max7219_pinDIN,OUTPUT); delay(50); Init_MAX7219(); } void loop() { for(j=0;j<19;j++) { for(i=1;i<9;i++) Write_Max7219(i,disp1[j][i-1]); delay(500); } }

Step 4: Generate Paterns

The patterns are generated by editing an array in the code to the requited hex array, this hex array can be generated by visiting the site below 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.

Makerspace Contest

Participated in the
Makerspace Contest

1 Person Made This Project!

Recommendations

  • Assistive Tech Contest

    Assistive Tech Contest
  • Reuse Contest

    Reuse Contest
  • Made with Math Contest

    Made with Math Contest

7 Discussions

0
None
dylano_2005

Question 3 months ago on Step 3

How do you control the timing of blinking?

0
None
ChewieB

1 year ago

My wife was very pleased when I presented one of these to her... and almost as pleased when I took it away. True love is tolerating a maker :+)

1
None
gmeadows3

2 years ago

Mine does nothing - just sits there no leds lit

0
None
chunkysteveo

3 years ago

Is there a link to the code generator that you have screenshot?

1 reply
0
None
Jaco Swartchunkysteveo

Reply 3 years ago

chunkysteveo, I think it is this one: http://blog.riyas.org/2013/12/online-led-matrix-font-generator-with.html

0
None
Richierich777

3 years ago

ok i feel stupid but i am all new to Arduino and trying to teach my self. I get a x80 was not declared in this scope error

0
None
PeterRP

3 years ago

I think I have one of these LED matrix laying around somewhere. Never used it, but now I will! Thanks for an easy tutorial for starting with these LEDs.