Introduction: LED Matrix With Arduino
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.
8 People Made This Project!
- MarvinAndroid made it!
See 4 More