Need guidance for a lot of LED's

Hi again,

When I started this project I had no idea what I got myself into. Well here I am 5 to 6 months into it, What have I learned? A lot, and very little all at the same time. Very frustrated at times. Every time I think I got it, I take two steps back.

What was the original project. To light up about six to seven hundred LED’s in a prescribe sequence then turn on 10 tricolor LED’s. At the same time the six to seven hundred will turn off at a faster pace then when they came on. Obviously the Arduino Uno or Arduino Mega doesn’t have enough IO. In comes the MAX7219. A nice power house, it can control 64 individual LED’s. But how? Right now I have on a test board 16 LED’s.

Right now they are control by a program written by Nick Gammon. http://www.gammon.com.au/forum/?id=11516
This sketch uses SPI control, I don’t know how to use different pins to feed a different MAX chip. LedControl I do know some what better. But I can’t seem to get a program running for individual LED control with LedControl. Every time I think I got it I fall backwards.

Right now I have two rows of LED’s. They are turning on one at a time the first eight then the second eight, using this modified program.

[code]
#include <SPI.h>const byte SS = 10;  // omit this line for Arduino 1.0 onwards
int T = 1000;
const byte MAX7219_REG_NOOP        = 0x0;
// codes 1 to 8 are digit positions 1 to 8
const byte MAX7219_REG_DECODEMODE  = 0x9;
const byte MAX7219_REG_INTENSITY   = 0xA;
const byte MAX7219_REG_SCANLIMIT   = 0xB;
const byte MAX7219_REG_SHUTDOWN    = 0xC;
const byte MAX7219_REG_DISPLAYTEST = 0xF;

void sendByte (const byte reg, const byte data)
{
  digitalWrite (SS, LOW);
  SPI.transfer (reg);
  SPI.transfer (data);
  digitalWrite (SS, HIGH);
}  // end of sendByte

void setup ()
{
  SPI.begin ();
  sendByte (MAX7219_REG_SCANLIMIT, 3);      // show 4 digits
  sendByte (MAX7219_REG_DECODEMODE, 0x0);  // use digits (not bit patterns)
  sendByte (MAX7219_REG_DISPLAYTEST, 0);    // no display test
  sendByte (MAX7219_REG_INTENSITY, 3);      // character intensity: range: 0 to 15
  sendByte (MAX7219_REG_SHUTDOWN, 1);       // not in shutdown mode (ie. start it up)
}   // end of setup

void loop ()
{
    sendByte (3, 0);
    sendByte (4, 0);
    delay(T);
    
    sendByte (3, 0);
    sendByte (4, 64);
    delay(T);
   
    sendByte (3, 0);
    sendByte (4, 96);
    delay(T);

    sendByte (3, 0);
    sendByte (4, 112);
    delay(T);

    sendByte (3, 0);
    sendByte (4, 120);
    delay(T);

    sendByte (3, 0);
    sendByte (4, 124);
    delay(T);

    sendByte (3, 0);
    sendByte (4, 126);
    delay(T);

    sendByte (3, 0);
    sendByte (4, 127);
    delay(T);

    sendByte (3, 0);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 64);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 96);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 112);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 120);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 124);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 126);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 127);
    sendByte (4, 255);
    delay(T);

    sendByte (3, 255);
    sendByte (4, 255);
    delay(T);

  }

[/code]

I also have this program for Led Control running individual LED’s

[code]

#include "LedControl.h"
LedControl lc = LedControl(12, 11, 10, 0);
int T = 500;
void setup() {
  // put your setup code here, to run once:
  lc.shutdown(0, false);
  lc.setIntensity(0, 3);
  lc.clearDisplay(0);

}

void loop() {
  // put your main code here, to run repeatedly:
  lc.setLed(0, 0, 0, false);
  lc.setLed(0, 1, 0, false);
  lc.setLed(0, 2, 0, false);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  
  lc.setLed(0, 0, 1, false);
  lc.setLed(0, 1, 1, false);
  lc.setLed(0, 2, 1, false);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);

  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, false);
  lc.setLed(0, 2, 0, false);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);

  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, false);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, true);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, true);
  lc.setLed(0, 6, 0, true);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, true);
  lc.setLed(0, 6, 0, true);
  lc.setLed(0, 7, 0, true);
  delay(T);
  // Second column//

  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, false);
  lc.setLed(0, 2, 1, false);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, false);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, true);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, true);
  lc.setLed(0, 6, 1, true);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, true);
  lc.setLed(0, 6, 1, true);
  lc.setLed(0, 7, 1, true);


  delay(T);
}

[/code]

When I tried to wire this one for the LED’s it will fail. I am using the wiring prints for the MAX7219 pin layout from Nick Gammon web site.

I am not asking for any one to write my program. But to guide in the right direction. As those who have help in the pass know stubborn or hard head or what ever. As I get older my patience starts to wear. I noticed that I can’t seem to study like I use to. But I still have some stick-to-it-ness . As always any help or advise is welcome good or bad. Just don’t grip, that’s a turn off.

Show us a good schematic of the complete project.

.

That will be hard to do as I am winging it at this time. Attach is a picture that I will light up. The LED’s will follow the branches. Once these are all lit they will turn off in a reverse sequence at a faster rate. As they’re turning off the tricolor LED’s will turn on inside the glass jars. The tricolor LED’s will change colors in a pattern from top left to bottom right. Please see attach pictures.

I see some of the members useing a type of drawing program that ha the adruino boards, breadboards and other items already draw. Where can i get a copy of this program. Please see this link to see what I am taking about post #2 PaulRB has a photo. How did he do it and with what?

I see some of the members useing a type of drawing program that ha the adruino boards, breadboards and other items already draw.

Do not use Fritzing, your circuit will be way more complex for it to be useful. Use a pencil and paper and photograph your drawing.

You need to have a solid hardware design before you can begin to address the software.

I’m sorry guys, after 30 plus years of stripping down old machinery of relay circuits and up dating then to PLCs. Designing the control panels, rewiring and writing the program. I am stump on how to draw this simple schematic. The Arduino will be powered by either a power supply or battery with an on/off switch through the 9mm plug. The sequence will start by a proximity switch wired to the Arduino. The prox sw. is no problem just one input, I have work these for years. Have not decide on witch prox. sw. yet.

The led wring would be the same matrix display as is used with 8x8 LED matrix, wired through the MAX7219 chip repeat about ten times. The MAX 7219 would be wire to an Arduino Mega board. Example 13, 12, 11, 10, 9, 8, 7, 6, 5, and so on. For all ten or more boards. That leaves the RGB LED’s. If it is possible to put some in parallel, I will have enough room on one broad. Otherwise I will have to use one of the UNO boards.

The exact number of LED’s will not be know until I mount the frame on a board and start to drill the wholes for the LED’s. This I was not planing on until I knew I could write the program. As I said before I am retire living on SS in a nursing home with the care that my wife needs. After all the bills are paid that leaves us with litttle dollars. I really don’t want to have a cabin built for a display I can’t program.

By the way when I redid a machine I had a draftsmen draw all the prints for me in AutoCad. I never did learn how to use it.

I hope this helps if not I will send out some of the drawing I have.

The MAX 7219 would be wire to an Arduino Mega board. Example 13, 12, 11, 10, 9, 8, 7, 6, 5, and so on. For all ten or more boards.

No you don't do that, you simply chain the MAX7219s, that is the data out from one goes to the date in of the next, then all the clock and latch signals are connected together, so you only need the three pins for as many matrix chips as you want.

As to your drawings you might want to indicate which way round the LED is, they are not symmetrical devices.

HI Mike

By chaining do you mean the way in the attachment.

As to your other statement, I not sure if I understand.

If you’re referring as to which side is cathode and which is anode. Cathode is left, Dig. Anode is right, Seg. The numbers refer to timing that the LED’s would light up.

Obvious I not going to wire the LED’s in a square. Number 1 is at the bottom number 2 is on top, so on.

No that is not chaining. The output of one max chip feeds the input of the next but all the clock lines are connected to the one pin.

In that "drawing" you posted you did not use the correct symbol for an LED and the symbol you did use looked symmetrical so you could not tell which was e anode and which the cathode.

OK lets try this drawing. and no I not an artist. If this is wrong can you display a picture?

Yes that is chaining. The last thing you want to be is an artist when drawing a schematic, you need to be an engineer.

did I answer your question as to the circles I call LED's. As to which is cathode and anode?

Naneen: did I answer your question as to the circles I call LED's. As to which is cathode and anode?

You did but having a symmetrical symbol means you can't flip it over. It is also quite impossible to "read" it. It is rather like writing a story and replacing the words up and down with a star and saying to the reader that the first time you see a star it means up and the second time it means down. Yes you can work it out but it is easy to get confused.

HI again, Now that I am straighten out as to how to wire the MAX7219s. I started to look at prox SW. I found this one but right now money is tight, I have to wait till next month to order it. It looks simple enough 3 pins I assume + - and a signal wire. Has any one used this one or can tell me more about it or recommend one for me. It will be mount to the picture that I showed in the second post. https://www.parallax.com/product/28033

Money is tight?

How about the HC-SR505? |500x500 Is that not cheap enough?

Why will this sketch work on an 8x8 dot matrix and not with individual LED's? I have moved the cathode wire to all of the cathode pins on the MAX729 chip that i know of.

[code]


#include "LedControl.h"
LedControl lc = LedControl(12, 11, 10, 0);
int T = 500;
void setup() {
  // put your setup code here, to run once:
  lc.shutdown(0, false);
  lc.setIntensity(0, 3);
  lc.clearDisplay(0);

}

void loop() {
  // put your main code here, to run repeatedly:
  lc.setLed(0, 0, 0, false);
  lc.setLed(0, 1, 0, false);
  lc.setLed(0, 2, 0, false);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);



  lc.setLed(0, 0, 1, false);
  lc.setLed(0, 1, 1, false);
  lc.setLed(0, 2, 1, false);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, false);
  lc.setLed(0, 2, 0, false);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);

  delay(T);

  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, false);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);

  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, false);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, false);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, false);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, false);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, true);
  lc.setLed(0, 6, 0, false);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, true);
  lc.setLed(0, 6, 0, true);
  lc.setLed(0, 7, 0, false);
  delay(T);
  lc.setLed(0, 0, 0, true);
  lc.setLed(0, 1, 0, true);
  lc.setLed(0, 2, 0, true);
  lc.setLed(0, 3, 0, true);
  lc.setLed(0, 4, 0, true);
  lc.setLed(0, 5, 0, true);
  lc.setLed(0, 6, 0, true);
  lc.setLed(0, 7, 0, true);
  delay(T);
  // Second column//

  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, false);
  lc.setLed(0, 2, 1, false);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, false);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, false);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, false);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, false);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, true);
  lc.setLed(0, 6, 1, false);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, true);
  lc.setLed(0, 6, 1, true);
  lc.setLed(0, 7, 1, false);
  delay(T);
  lc.setLed(0, 0, 1, true);
  lc.setLed(0, 1, 1, true);
  lc.setLed(0, 2, 1, true);
  lc.setLed(0, 3, 1, true);
  lc.setLed(0, 4, 1, true);
  lc.setLed(0, 5, 1, true);
  lc.setLed(0, 6, 1, true);
  lc.setLed(0, 7, 1, true);


  delay(T);
}

[/code]

I have moved the cathode wire to all of the cathode pins on the MAX729 chip that i know of.

What have you done with the anodes? You need to post a schematic of how you have wired it.

Ok you know by now that i can’t draw but here is a drawing, also some pictures.

I tied all the cathodes together see if I could get at lease one row working.

Having problem with photos. The resizing on my camera is off. trying to get it turned on.

Attachis drawing

OK lets try some pictures.

OK lets start with the symbol. This is the symbol for an LED:-

LED.jpg

Now you appear to have all the cathodes connected to all the current sinks. That line of cathodes should be connected to only one current sink pin, like pin 2 for example. Do not connect the other current sinks together.

I connected them together as I was getting tire of trying one at time. Why doesn't any of the leds light up. When I use the program for the 7 segment display, the leds light up just fine, but if I use the program form the 8x8 matrix they fail to work. By the way both sketches are in the first post.