loading
Hola , I am Javier from Makespace Madrid. Last week we organised a meetup to play with LED matrixes and Arduinos. This was part of  "La noche de la electrónica con Jameco"
This instructable is based on the workshop. It uses one single LED matrix and shows how to switch its LEDs on/off and how to display ASCII characters.
A future instructable will show how to work with mulitple LED matrixes connected together.

Step 1: Components

For this example, you need the following components:
- Arduino Uno board
- MAX7219 Red Dot Matrix Module
- 5 jumper wires F/M (female/male)

Although this instructable uses an Arduino Uno board, you can use other Arduino (compatible) boards

You can find the matrix module at many online stores (e.g. http://dx.com/p/max7219-dot-matrix-module-w-5-dupont-lines-184854). This includes a 8x8 LED matrix (red colour), a MAX7219 chip to control the LEDs, header PINs and sockets, one 10KOhm resistor, a 100nF capacitor, a 10uF electrolic capacitor and a PCB where everything is connected together. You can purchase the module already soldered and mounted or just the components. Up to you;-)

If you want to learn the low level details, you should check this article at arduino playground.

IMPORTANT: The LED matrix is common cathode. This module does not work with common anode matrixes.

Step 2: Arduino Library

The LED matrix is controlled from the MAX7219 chip through an Arduino Library.
This instructable is based on the LEDControl library. You can read a very clear and detailed tutorial about this library at arduino playground.
The nice thing about this library is that you can connect up to 8 matrixes together to build larger displays (more about this in a future instructable).

The LedControl library has been updated with several new methods to simplify the display of characters and strings. The new version of the library is available here (chose your preferred compression format: zip or rar)

To install the library in your Arduino IDE:
- uncompress the library file that you just downloaded
- make sure that you close all the open windows of the Arduino IDE
- look for the libraries folder inside the folder where you installed the Arduino IDE (see picture)
- copy the uncompressed LedControlMS folder (the folder with all its content)  inside the libraries folder


If everything worked fine, you can now open the Arduino IDE again. If you go to File-> Examples, there should be a tab named LedControlMS with four files inside it.

Step 3: Wiring

Once you have installed the library, it is time to connect the LED matrix to the Arduino board.

The LED Matrix module has two sets of male header PINs. In this instructable you will only use the input PIN headers that are located closer to the MAX 7219 chip.
There are five PINs that must be connected through F/M jumper wires to the corresponding Arduino PINs:

LED Matrix        Arduino         Colour of wire in picture
VCC                        5V                       Red
GND                       GND                   Black
DIN                         D12                    Yellow
CS                          D10                     White
CLK                        D11                     Blue

You can check the colours of the wires in the pictures in case that you have any doubt.

Step 4: Example Sketch

The original LedControl library can handle both 7-segments LED displays as well as LED matrixes. This instructable only uses the LED matrix methods.

The updated library created for the Makespace Madrid workshop defines an alphabet/font of characters that can be displayed in the LED matrixes. It also includes two new methods, writeString and displayChar. You can see practical examples of how the different methods work in the MakeSpace_LEDMatrix example sketch distributed with the library.
To open this sketch, in the Arduino IDE menu go to File-> Examples->LedControlMS->MakeSpace_ LEDMatrix

You can now upload the sketch to your arduino and see what the example does.

Note1: if the version of your Arduino IDE is "quite" old (0.x) you will need to change the extension of the arduino sketches distributed with the library. Change the extension of the files from .ino to .pde (MakeSpace_ LEDMatrix.ino -> MakeSpace_ LEDMatrix.pde). Your IDE should be able to read and open this file (probably you need to close all the Arduino IDE windows, change the file extensions and then restart the IDE again).

Note2: Before uploading the sketch, make sure that you have selected the right card and serial port for your arduino

Step 5: And Play!

If everything worked fine, your LED matrix will start a sequence of actions switching on and off leds and displaying different characters.
You can now map the code in the example sketch to the actions in the matirx. Update the sketch to do new things and experiment with  the library methods.

To help you, the PDF file below has some hints about how the LEDs, rows and columns are numbered and coded in the LEDControl library.
Don't be afraid to make errors! That is the fastest way to learn.

Enjoy!
<p>I am only getting two leds showing at once. I have checked for bridges and there are none. Can anyone help me here?</p>
<p>I am now getting more LEDs on at once but no distinguishable letters.</p>
<p>Hello, Most probably you fixed the LED matrix on the wrong side of the PCB.<br>It might be soldered on the CHIP side of the PCB.</p>
<p>I had the same /similar problem. the reason was that the MAX7219 was wrong inserted. I just removed it and inserted it in the other way round. Then it works!</p>
<p>Sorry for the late response. </p><p>Not sure what is wrong, but I suggest to check three points:</p><p>- Are you providing enough power (miliamps) to the matrix?</p><p>- Have you double/triple checked that the wires are properly connected?</p><p>- Are you using a common cathode matrix? (the code does not work if the matrix is common anode)</p>
<p>nice work. Will this code run on USB attiny85 ?</p>
<p>Sure it does. The ATTiny85 has plenty of pins for this. Even though it has only eight. <br><a href="https://www.instructables.com/id/V-USB-ATtiny85-Project-Board-and-an-8x8-Red-LED-Ma/" rel="nofollow">https://www.instructables.com/id/V-USB-ATtiny85-Pro...</a><br><a href="https://halfbyteblog.wordpress.com/2015/11/29/using-a-max7219-8x8-led-matrix-with-an-attiny85-like-trinket-or-digispark/" rel="nofollow">https://halfbyteblog.wordpress.com/2015/11/29/usin...</a><br></p>
hi, can the max7129 be used for a dot matrix display with an Arduino pro Micro? If so, What would be suitable pin connections?
I have used it with an Arduino ProMini so a ProMicro should also be ok. The pins in the instructable are defined as:<br> LED Matrix &nbsp; &nbsp;Arduino &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Colour of wire in picture<br> VCC &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5V &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Red<br> GND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Black<br> DIN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;D12 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Yellow<br> CS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; D10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; White<br> CLK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; D11 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Blue<br> <br> You can remap them for your ProMicro by updating their values in the following line of the sketch:<br> <br> LedControl lc=LedControl(12,11,10, NBR_MTX);
<p>Hey Tumaku, thanks for your post! This helped me out a ton when I first started out with my 8x8 Matrix.</p><p>I've linked to your instructables in an INO I made to make it easier to animate moving animations on the MAX7219 8x8 LED Matrix. I think I need to comment more of the code here, but the basics are there.</p><p><a href="https://github.com/ProcStack/Arduino/tree/master/LED_8x8_Matrix" rel="nofollow">https://github.com/ProcStack/Arduino/tree/master/L...</a></p><p>Here's what the animation looks like (Sorry, it might be a little loud.)<br><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/bccOX-seROI" width="500"></iframe></p>
<p>Cool animations!</p>
<p>Made this using breadboard for interconnect... Simple, flawless! Works GREAT! Recent Computer Science graduate, played with image matrix binaries to make happy/sad face animation... The binary creator at http://www.pial.net/tools/ helps a LOT! Thnx for posting! </p>
<p>Thanks a lot for that website! That really speeds up the most tedious part of coding these things! </p>
<p>Great! Thanks for sharing the result :)</p>
<p>can i get code or any information for respective project ?</p>
<p>Code and explanation is available in Step 2</p>
<p>can you give me sketch(coding) in arduino ? khuzzair@gmail.com :D Thanks</p>
<p>Code and explanation is available in Step 2</p>
<p>Made this using breadboard for interconnect... Simple, flawless! Works GREAT! Recent Computer Science graduate, played with image matrix binaries to make happy/sad face animation... The binary creator at http://www.pial.net/tools/ helps a LOT! Thnx for posting! </p>
<p>:-)</p>
<p>Made this using breadboard for interconnect... Simple, flawless! Works GREAT! Recent Computer Science graduate, played with image matrix binaries to make happy/sad face animation... The binary creator at http://www.pial.net/tools/ helps a LOT! Thnx for posting! </p>
<p>Hii,</p><p>I have different type of matrix tube.I want to program it using Arduino Uno R3. I have attached the photo of my 8*8 Dot Matrix Led Tube</p>
<p>Thanks this is a great tutorial. I learnt a lot from it!</p>
<p>Keep learning :-)</p>
<p>I updated the library to display smiles 8x8 using <strong>lc.displaySmile(0,X)</strong>; function replace X with a number from 0 to 3 (I added only 4 smiles).</p><p>you can download it from here: </p><p><a href="https://drive.google.com/file/d/0B0rVZYzj6RpOcFF1Uk9UR1NWRHc/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B0rVZYzj6RpOcFF1U...</a></p><p>to display them copy this code into you loop:</p><p>void loop() { <br> lc.clearDisplay(0);<br> lc.displaySmile(0,0);<br> delay(2000);<br> lc.clearAll();<br> lc.displaySmile(0,1);<br> delay(2000);<br> lc.clearAll();<br> lc.displaySmile(0,2);<br> delay(2000);<br> lc.clearAll();<br> lc.displaySmile(0,3);<br> delay(2000);<br> lc.clearAll();<br>}</p><p>you can custom these smiles (or add other 8x8 icons) using this online tool: <a href="http://www.pial.net/tools/" rel="nofollow"> http://www.pial.net/tools/</a> and paste them into the LedControlMS.h file, under the declaration of smileBitmap matrix (also remember to change size of const static byte smileBitmap if you add or remove items).</p>
<p>Great update to the library!!! And excellent link to code bitmaps:-)</p>
<p>thanks</p>
<p>When I use 5 matrices only four of them display letters, but when I reset they all light up and then go back to only 4, I already edited the code to 5 MTX. Help plz</p>
I did this one before but didn't have any luck with changing the message. this time I was able to change it but I couldn't figure out how to slow it down so it is more readable. Any suggestions? I really need someone that would be willing to help me from time to time.
<p>If you lare using the method writeString() to display your text, you should modify this method in the corresponding library flle (LedControlMS.cpp). This method waits 300 milliseconds after displaying a character. You can meke this dealy longer just changing '300' value by your desired delay, e.g. delay(1000) if you want to wait for one second.</p><blockquote>void LedControl::writeString(int mtx, char * displayString) {</blockquote><blockquote> while ( displayString[0]!=0) {</blockquote><blockquote> char c =displayString[0];</blockquote><blockquote> int pos= getCharArrayPosition( c);</blockquote><blockquote> displayChar(mtx,pos);</blockquote><blockquote> <strong>delay(300);</strong></blockquote><blockquote> clearAll();</blockquote><blockquote> displayString++;</blockquote><blockquote> } </blockquote><blockquote>}</blockquote>
<p>my frend i need your help, i do all what you did, but when i run the program all the led always are ON and i can't turn them Off. why? i have to increment the intensity to 15 and i can si how the text is moving but other leds always are ON.<br><br></p>
<p>One possible cause is the wrong connection of the wires. Please double-check that you have connected the right PINs in Arduino/LED matrix and that the wires are in good state.</p><p>It could also be that you soldered something wrong in the board or that one of the PINS in the matrix is broken or bended.</p>
<p>di you speak spanish? can you say me you facebook or email to contact to you? thank you.</p>
that's great.
<p>Congratulations :-)</p>
<p>Your library really rocks, congratulation :))</p>
<p>:-)</p>
<p>How do I make the text scroll smoothly across a single matrix?</p><p>Because with the sketch I have now (yours), the letters will just appear and dissapear on the same position.</p><p>I hope you can help me!</p>
<p>Sorry for the late reply. The library does not support smooth scrolling. You need to update it addding scrolling functionality (handle every letter/char as a set of pixel columns that scroll over the 8 columns of the matrix). Not difficult, but it requires some coding.</p>
<p>Just use the code from the other Instructable and change #define NBR_MTX 4 to #define NBR_MTX 1</p>
<p>How would I make a 16 row display,... please advise....</p><p>my email is eng.gachara@gmail.com</p>
<p>It is a long time since I made this project, but as fas as I can remember the maximum number of matrices supported by the library and the MAX7219 chip is 8. I tested it in the past and it worked fine. I just had to provide enough power ideally with an external power source other than Arduino (when many LEDS are ON Arduino cannot provide enough miliamps and things start going wrong)</p><p>8 marices make 64 x 8 LEDS. If you need a larger display, the current library is not suitable and you need to either synchronise somehow two sets of matrices or dig into the curent library code and see if you can update it to control two sets of matrices (i.e. 16 matrices)</p>
<p>Excellent stuff, very clear and easy to follow - thanks a lot. </p><p>I have a bunch of matrices lying around and will definitely be doing your other 'ible :) </p>
<p>Thanks for trying it out:) Have fun!</p>
<p>I soldered up a MAX7219 kit ($8 with prime shipping on Amazon - constantly amazes me how cheap things are these days) and this instructable was exactly what I needed next. Just wanted to say thanks!</p>
<p>Thanks for your message! If you decide to solder more matrices, you can then browse my second instructable ;-)</p><p> <a href="https://www.instructables.com/id/Multiple-LED-Matrixes-with-Arduino/" rel="nofollow">https://www.instructables.com/id/Multiple-LED-Matri...</a></p>
<p>Hello,</p><p>congratulations for the project !!!</p><p>I'd like to get help to realize this project using two MAX7219.</p><p>http://scuola.arduino.cc/lesson/l81bRbQ/Tabellone_Segnapunti.</p><p>I have some problem with the code ... it's very urgent.</p><p>best regards</p>
<p>Can you be more specific about the problem that you have? What is not working? Note that the LED matrices in your link are 7x5 instead of 8x8 (the ones my project and library are using)</p>
<p>Hi,</p><p>thank you for answering!<br>Simply'm buildingthescoreboardbutinsteadof the two7x5matricesI would usetwo8x8matricesMAX7219so I shouldrewrite the code(usingifthey also servethe appropriate libraries).I would also liketo addtwo buttonsto increase or decreasethe scoremanually.Unfortunately I am notgood at writingthe code...</p>

About This Instructable

350,580views

266favorites

License:

More by tumaku:Multiple LED Matrices with Arduino LED Matrix with Arduino 
Add instructable to: