MAX7219 + LED Matrix Wiring?

Well today i received my parts in the mail
2 8x8 dot matrix led display 8x8 Dot Matrix LED Display Red 3mm Row Anode
and a Max7219

I found out in a hurry that the matrix does not fit in a breadboard. I'm not sure how to get around that at the moment.as i don't have any wire, just jumpers and I only have one half breadboard.

Also the wiring diagram is a little confusing I know you need 1 resistor and a cap, but not sure how to wire them all the diagrams i have seen are pretty confusing. was wondering if anyone had a fritzing diagram of the set up with an Arduino that they could possibly share?

use the datasheet of your display and connect each column cathod pin to each "dig" pin of the MAX7219. (row 1 -> "dig 0", row 2 -> "dig 1"etc)
after that connect each row anode pin to each segment pin of the max7219 (row 1 -> seg a, row 2 -> seg 2" etc.
find the right current set resistor, connect the IC to your platform and it's done :slight_smile:

column display pin MAX7219 pin
1 13 2
2 3 11
3 4 6
4 10 7
5 6 3
6 11 10
7 15 5
8 16 8

row display pin MAX7219 pin
1 9 14
2 14 16
3 8 20
4 12 23
5 1 21
6 7 15
7 2 17
8 5 22

pixel forward current is 20mA but you must think of the total power dissipation and a protective value if the scan duty cycle is too slow during programming tests. A 10mA is more conservative value for test. so Rset must be a 62K resistor. (after if all works fine and the duty cycle is set you can decrease the Rset value to increase the led current. the maximum allowed current is 500ma divided by number of pixels (8 units) and duty cycle. You can decrease the value to 15K I think).

Don't forgot to use a 100nF and at least 10uF caps near the power supply pins (19 and 9) of the maxim IC as a local current tank.
connect the CLOCK, DIN and LOAD pins to your arduino platform. best if connected to the SPI bus (SPI UART is faster than bit twidling)
DOUT can be left unconnected if no daisy chain is used.

I've done a google search after that and i've foiund this:

but be careful if you want to use an allready made library you must be sure of the right wiring order.

WOW that is super helpful thanks man!

no problem :wink:

TheCapn – If your matrices seem to have the same pin out as these ones
http://www.ebay.com.au/itm/5mm-LED-Dot-Matrix-ROW-ANODE-RED-2088B-8x8-60x60mm-16-pin-2-pieces-/120975133462?pt=AU_B_I_Electrical_Test_Equipment&hash=item1c2aae0b16
then try this attached circuit schematic. Also have a look at marco-c”s Parola for Arduino project
http://parola.codeplex.com/
as it’s the best Max 7219 project that there is period.
Note - The M part of the matrix pin numbers just stands for Matrix :smiley:

nice! soon as i get some wire i'll try this out

Pedro147 are you sure about the 1K resistor value? seems very low compared to the mine and defined with the datasheet. (page 11 where 9.69K is the lowest value defined for 3.5 Vf voltage and 40mA If current ) -> 1K is very low! and give very high current (can destroy the led and/or the chip)

the value is 62K from the hardware schematic/BOM from the website where you can find the library:
http://parola.codeplex.com/downloads/get/761595

@Genesis92 - you are correct, 1k is far too low. You should follow the guide in the data sheet for the MAX7219.

Sorry about that incorrect resistor value gents. I won't try and make excuses I stuffed up :blush:

I'm also struggle with this. It work but the rows are in wrong order. When using the test code below it shows the row in order 0, 7, 6, 5, 4, 3, 2, 1.

I have tested several LED matrix and max7219 units with the same result. Also tried to rewire to change the row orders, but that make things worse.

Can it be the library that is buggy?

#include "LedControl.h"
LedControl matrix = LedControl(30, 31, 32 1);

void setup()
{
  matrix.shutdown(0, false);
  matrix.setIntensity(0, 5);
  matrix.clearDisplay(0);

  for (int r = 0; 8 > r; r++) {
    for (int c = 0; 8 > c; c++) {
      matrix.setLed(0, c, r, true);
      delay(200);
    }
    delay(300);
    matrix.clearDisplay(0);
  }
}

I'm using a Mega 2560.

thehardwareman:
Also tried to rewire to change the row orders, but that make things worse.

Can it be the library that is buggy?

Try again, more carefully. It's your wiring that is buggy.

I have tried - for two days. All other wiring make it worse. I have checked each led and the pin on the matrix is ok.

By modifying the code it works as expected:

#include "LedControl.h"
LedControl matrix = LedControl(30, 31, 32 1);

void setup()
{
  matrix.shutdown(0, false);
  matrix.setIntensity(0, 5);
  matrix.clearDisplay(0);

  for (int r = 0; 8 > r; r++) {
    for (int c = 0; 8 > c; c++) {
      matrix.setLed(0, c, (7 ==r) ? 0 : r + 1, true);
      delay(200);
    }
    delay(300);
    matrix.clearDisplay(0);
  }
}

Well, if you can fix it that easily in the code, it should take seconds to fix the wiring by making the equivalent changes. Maybe post a picture of your wiring. One where we can trace exactly where every wire starts and ends. If you find you can't take a clear picture showing where each wire goes, then I think we may have located the problem.

I have made three different boards using a matrix and a max7219 (starting from scratch each time). Carefully checking the wires. And a friend of my also checked it. We could not find any errors.

I'll see if I can make a picture of a cleaner version (the current one wires are overlaying each other so a picture will not show anything usefull right now).

But if the wiring was incorrect and shifted the rows, I must have misplaced 50% of the connections, which should be rather easy to spot.

This code fix it:

MyLedControl::MyLedControl(int dataPin, int clkPin, int csPin, int numDevices) : LedControl(dataPin, clkPin, csPin, numDevices) 
{
}

void MyLedControl::setLed(int addr, int row, int column, boolean state)
{
  LedControl::setLed(addr, row, (7 == column) ? 0 : column + 1, state);
}

void MyLedControl::setRow(int addr, int row, byte value)
{
  byte b = (value & 0x01) << 7;
  b |= value >> 1;
  LedControl::setRow(addr, row, b);
}

When using the test code below it shows the row in order 0, 7, 6, 5, 4, 3, 2, 1.

Are you sure that you are mapping the DP (decimal point) output signal from the IC to the right column or row?

I made a new board with MAX7219 and a led matrix. Same result. It works with my modified code (as shown above).

Here is the image of the wiring.

A bit messy with long wires - so that the wiring is more easy to follow.

Full scale image

A bit messy

An understatement! :wink:

This is exactly my point. With wiring this messy you can check the connections until the cows come home and will miss an error.

I use solid core wire when building breadboard prototypes, cut to length and laid flat against the breadboard.

I agree, but in this case following the wires would be more difficult having only one prototype board available.

Using different colors do help a bit.

However, I carefully checked the wiring when making this board using the following table:

col      led pin    chip pin
1        13         2
2         3         11
3         4         6
4        10         7
5         6         3
6        11         10
7        15         5
8        16         8

row     led pin     chip pin
1         9         14
2        14         16
3         8         20
4        12         23
5         1         21
6         7         15
7         2         17
8         5         22

BTW, image of the complete setup showing all three 7219+led matrix units plus a bit more :slight_smile:


I already got that information :slight_smile:

Why do five different attempts give the same result? And why do the minor modification in SW (done by the derived class MyLedControl) fix this? The wiring cannot be completely wrong, can it?