LED matrix 11 X 11

Hi,

I am a newbie when it comes to electronics.. I'm more like a programmer :slight_smile:

I want to make a 11 X 11 LED matrix (White LEDS of 3,3V and 20mA, Voltage 5V).
I already read a lot of stuff about shift registers

I think I have to work with two 74HC595 shift registers and two ULN2803 driverarrays, but how do I connect all this together with my arduino? Can anyone help me out with the wiring?

thanks a lot

Basically this project is an 8 by 8 matrix and a key in each matrix position.
http://www.thebox.myzen.co.uk/Hardware/Econo_Monome.html

You just need to add an extra 74LS42 and ULN28003.

Then you can use shift registers to control them rather than directly from the Arduino if you want.

Frankly, I think (as I nearly always do) that you would be much better off to simply use two MAX7219.

Makes the wiring and PCB dead simple (compared to four chips and lots of resistors).
It is true that you have to figure out the mapping (in code), but that should not be all that hard. Most particularly, the MAX7219 does all the multiplexing for you - you only have to load the bit pattern once and it stays displayed until you need to change it.

think (as I nearly always do) that you would be much better off to simply use two MAX7219.

Only if you can get them at a decent price, which doesn't appear to be the case in the UK.

Grumpy_Mike:
Only if you can get them at a decent price, which doesn't appear to be the case in the UK.

Well, pooh-pooh it if you like, but I recckon you wouldn't be too far off with this seller.

Paul__B:
Makes the wiring and PCB dead simple (compared to four chips and lots of resistors).

I found something on the internet and change it a little bit (I tried to add a second max7219 component)

Is this what I need to do ??

Paul__B:
Well, pooh-pooh it if you like, but I recckon you wouldn't be too far off with this seller.

Thanks, I have searched many times on eBay but never come up with that one. I'll try it.

Yes that sort of circuit will do.

BramWerbrouck:
Is this what I need to do ??

Yes, you've got the chips wired up right. What needs more careful thought is how best/easiest way to use the two chips together to form the 11x11 matrix.

For example if the first chip makes an 8x8, you then need 2 strips of 3x8 (one vertical) and a 3x3 which will itself have to be split into a 2x3 and a 1x3.

There must be 50 ways to lay out the setup, and some must be easier than others, from both software and hardware points of view.

Paul

Or maybe this…

@PaulRB: I guess that the “1” is the 8x8 matrix (with this first chip) but what do you mean with the 2 - 5 ??? (in your first grid) I assume you mean the second chip (MAX7219) but why different numbers??

I see that I forgot some LED’s in my drawing… I had only 112 but 11 x 11 = 121

So in this attachment: the black numbers would the pins on chip 1, the red numbers: the pins on chip 2. what do you guys think of this version?

a second question: A work with with LEDs (3,3V) so I need a resistor… or is this one resistor named Rset in my previous MAX7219_schematic??

and why are there two capacitors ,C1 and C2 ? is this really necessary?

Schermafbeelding 2014-11-01 om 17.06.16.png

Yes two capacitors are necessary, one is for high frequencies and the other for low.
The chip has a constant current drive in it so there is no need for external resistors.

BramWerbrouck:
@PaulRB: I guess that the "1" is the 8x8 matrix (with this first chip) but what do you mean with the 2 - 5 ??? (in your first grid) I assume you mean the second chip (MAX7219) but why different numbers??

The cells marked "1" are from the first max chip. The cells marked "2", "3", "4" & "5" are all from the second max chip. The lower 8x8 diagram shows how these cells would appear to the second max chip. I was attempting to fill the 11x11 matrix with a small number of large groups of cells from the 8x8 matrices without resorting to "rotating" any of the groups, ie. the rows are always rows and columns always columns. This should make the transformation of the 11x11 matrix into two 8x8 matrices easier in the sketch.

I bought a SainSmart MEGA2560 R3 board. Can I connect this one to a MAX7219 chip

The documentation of the MAX7219 (http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf) says that I need to connect as follow:

(see also: http://playground.arduino.cc/uploads/Main/MAX72XX_SPI.jpg)

pin 19 to Vcc
pin 18 to Vcc (with a resistor)
pin 4 and pin 9 to Gnd

pin 1 to Dln
pin 13 to Clk
pin 12 to Load (CS) (with a line above CS)

what pins do I have to use on my SainSmart MEGA2560 R3 board? It's only the last 3 (Dln, Clk and Load(CS)) that I don't know..

You can use almost any 3 pins. Avoid 0 and 1 because they are used for sketch upload. Even analog pins can be used as digital outputs, if you run out of digital pins.

You would then use the shiftOut() function to send data to the max chip.

A second option is to use the SPI bus, which is what those instructions are suggesting (although I think you may have copied those pin numbers incorrectly from the instructions). This means you must use three particular pins, but I don't know their numbers on a Mega. SPI is significantly faster, but since you will only have 1 or 2 max chips, the extra speed will make no noticeable difference. Using shiftOut() will be more than fast enough.

Once again I tried to wire the LEDs…

M1= the first MAX7219, M2 = the second MAX7219

If this is right, should this be the easiest way to solder and program the matrix??

PaulRB:
A second option is to use the SPI bus, which is what those instructions are suggesting (although I think you may have copied those pin numbers incorrectly from the instructions). This means you must use three particular pins, but I don't know their numbers on a Mega. SPI is significantly faster, but since you will only have 1 or 2 max chips, the extra speed will make no noticeable difference. Using shiftOut() will be more than fast enough.

I found this on the site of Arduino (http://http://arduino.cc/en/Reference/SPI):

Mega1280 or Mega2560
MOSI MISO SCK SS SS
51 or 50 or 52 or (slave) (slave)
ICSP 4 ICSP 1 ICSP 3 53 -

but this is making me more confused :-s I still don't know with pin numbers to use with the SPI bus...

Worry about spi bus later. For now just use any 3 digital pins and shiftOut().

Ok,

I have my matrix working.. but you see them flashing (it happens very fast, but you can see it) I think I need to use this SPI bus, but how?? anyone?

I disagree. Using shiftOut() rather than spi.transfer() is probably not causing the flashing you are seeing. Can you post a schematic showing the mega, the max chips and other components? You already posted a shematic showing how the leds connect to the 2 max chips -has that changed? Also post your sketch. Use code tags so itlooks like this

I don’t use shiftOut()… see my code below

#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <LedControl.h>

// lines to drive the two MAX7219 LED controllers
const int LC1CLK   = 11;
const int LC1LOAD  = 10;
const int LC1DATA  = 12;

LedControl LC1=LedControl(LC1DATA, LC1CLK, LC1LOAD, 2);

tmElements_t tm;

void setup() {
  Serial.begin(9600);
  while (!Serial) ; // wait for serial
  delay(200);
  Serial.println("DS1307RTC V1.1 Read Test");
  Serial.println("------------------------");
  
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if(timeStatus()!= timeSet) {
     Serial.println("Unable to sync with the RTC");
     Serial.println("Time set to the default: 00:00:00");
     tm.Hour = 0;
     tm.Minute= 0;
     tm.Second = 0;
     RTC.write(tm); //set the time to 00:00:00
     }
  
  // the zero refers to the MAX7219 number, it is zero for 1 chip
  LC1.shutdown(0,false);// turn off power saving, enables display
  LC1.setIntensity(0,15);// sets brightness (0~15 possible values)
  LC1.clearDisplay(0);// clear screen

  LC1.shutdown(1,false);// turn off power saving, enables display
  LC1.setIntensity(1,15);// sets brightness (0~15 possible values: 0 = dim, 15 = full brightness) 
  LC1.clearDisplay(1);// clear screen
}

void loop() {
 
  if (RTC.read(tm)) {
    Serial.print("Ok, Time = ");
    print2digits(tm.Hour);
    Serial.write(':');
    print2digits(tm.Minute);
    Serial.write(':');
    print2digits(tm.Second);
    Serial.println();
  } else {
    if (RTC.chipPresent()) {
      Serial.println("The DS1307 is stopped. Please run the SetTime to initialize the time and begin running."); //"The DS1307 is stopped. Please run the SetTime"
      //Serial.println("example to initialize the time and begin running.");
      Serial.println();
    } else {
      Serial.println("DS1307 read error! Please check the circuitry.");
      Serial.println();
      Fault();
    }
    delay(9000);
  }

  if (tm.Minute % 5 == 0 ) {
    FillMatrix();
  }
  }
  
 void FillMatrix(){
  
  //Clear the whole matrix
  Clear_Matrix();
   
    switch (tm.Hour) {
    case 1:
      String1();
      break;
    case 2:
      String2();
      break;
    case 3:
     String3();
      break;
    case 4:
      String4();
      break;
    case 5:
      String5();
      break;
    case 6:
     String6();
      break;
    case 7:
      String7();
      break;
    case 8:
      String8();
      break;
    case 9:
      String9();
      break;
    case 10:
      String10();
      break;
    case 11:
      String11();
      break;
    case 12:
      String12();
      break;
  }
    Empty();
   
}

void print2digits(int number) {
  if (number >= 0 && number < 10) {
    Serial.write('0');
  }
  Serial.print(number);
}


//Clear the matrix
void Clear_Matrix() {
 LC1.clearDisplay(0);  
 LC1.clearDisplay(1);  
}   

void String1() {
  LC1.setLed(1,2,0, true);
  LC1.setLed(1,2,1, true);
  LC1.setLed(1,2,2, true);
  LC1.setLed(0,0,5, true);
  LC1.setLed(0,0,6, true);
}

void String2() {
  LC1.setLed(2,2,0, true);
  LC1.setLed(2,2,1, true);
  LC1.setLed(2,2,2, true);
  LC1.setLed(0,1,5, true);
  LC1.setLed(0,1,6, true);
}