One by one LED lighting - 56 LEDs

Hi people,

I'm kind of new for the arduino and I only know some basic applications. Therefore you can assume me as a zero level user. Anyway;
For my project, I need to enlighten 56 LEDs one by one with delays. One LED is going to be enligtening then it goes off and the one comes after will be enlightening and... Same thing for 56 LEDs.

How can I do this with MAX7219 and Arduino Uno?
(I have to use MAX7219 because of some transportation problems,
I will detach the LEDs on it and extend them with cables)

Please Help & Any help is appreciated.

Easy to do with MAX7219 & Arduino. I have a breakout board to extend the LEDs out already:
http://www.crossroadsfencing.com/BobuinoRev17/


I personally would do it following this pesudocode:

#include <SPI.h> // bring in SPI library, use SCK/MOSI/SS to send data to the MAX7219
declare variables, such as the MAX7219 control and data registers
byte ssPin = 10;
void setup(){
pinMode (ssPin, OUTPUT);
SPI.begin();
send data to the 5 control registers, DecodeMode, Intensity, ScanLimit, Shutdown, DisplayTest, using this command format:
digitalWrite (ssPin, LOW);
SPI.transfer(registerAddress);
SPI.transfer(dataToTransfer);
digitalWrite (ssPin, HIGH);
}
void loop(){
send data to the data registers using a for loop within a for loop
for (outerLoop = 1; outerLoop <9; outerLoop = outerLoop +1){
dataToSend = 0b00000001;
for (innerLoop = 0; innerLoop <8; innerLoop = innerLoop+1){
digitalWrite (ssPin, LOW);
SPI.transfer(outerLoop); // data registers, 1 to 8
SPI.transfer(dataToSend); // data to put in register,
digitalWrite (ssPin, HIGH);
delay(displayTime);
dataToSend = dataToSend <<1; // 0b00000001, 0b00000010, 0b00000100, etc to 0b10000000
} // end inner loop
clear out data for the next register
digitalWrite (ssPin, LOW);
SPI.transfer(outerLoop); // data registers, 1 to 8
SPI.transfer(0); // turn off all LEDs with current register
digitalWrite (ssPin, HIGH);
} // end outerLoop
} // end loop()

Can you follow that?

You do not need Max 7219 to do this...

As an alternative, you can use 8 digital pins from the Arduino, plus 8 series resistors, and nothing else (except your 56 leds). This technique is known as charlieplexing. You would organize your 56 leds into 8 groups of 7 leds. In each group, connect the 7 anodes together. For the first group of leds, connect the common anode to one pin and the 7 cathodes to the other 7 pins. Each group has it's common anode connected to a different pin. Do this in a regular methodical way, not at random.

To light, for example, led #34, divide 34 by 7 to give 4 remainder 6. Set your 4th Arduino pin to HIGH and your 6th Arduino pin to LOW. The other 6 pins you have already set to INPUT.

Here's a smaller example of 6 leds in 3 groups of 2.

c3.png

Paul