LED Matrix Animation speed.

Hi. I’m trying to create 11x42 led matrix with a CD4040B 12 bit binary counter with 11 2N3904 transistors for the 11 rows, 6 74HC595B’s each with 7 outputs for the columns, and an Arduino to control it all. I’m worried that the animations will take ages to scroll the whole matrix and am wondering if and/or how I can speed the animations up if needed. Thanks in advance!

I don't see a reason why it would be slow. If you have an Arduino, you can test; you don't need the 595s and the 3904s to be connected; just print the timings over Serial.

newbtriestoprogram:
6 74HC595B’s each with 7 outputs for the columns

That might cause complications which could result in some degree of slowness, certainly some complexity in your code. Better to use all 8 pins on first 5 of the chips and only outputs 0, 1 used on the last chip.

Use the Arduino's SPI pins to send data to the 74hc595 chips.

Slowness of animation will only occur if you write code which is inefficient and does not make good use of the Arduino's resources. If you find this happens, post your code here and we can make suggestions to improve it.

Thanks for the advice guys! What my goal for this (which I stupidly forgot to mention) is something like this:

You can see it well at 0:52. Basically, the animation speed is controlled by a potentiometer. That’s what I’m asking how I can do it. If anyone knows of a way to do this with Arduino, please reply, and thanks all of you for the help so far!

Do you know how to connect a potentiometer? How to use analogRead?

You can map an analog reading to a value that you use to slow down the animation. E.g.

unsigned long delayTime = analogRead(A0) * 1000UL;

If you would use delay(delayTime) you could have a delay between 0 and 1000 seconds.

Note:
You will need a millis() based approach and refrain from using delays, for-loops and while-loops if you want to keep your code responsive.

Thank you so much! I do know how to wire potentiometers. I partially know how to use analogRead. So I need to use analogRead, define analog pin for potentiometer, make it input, define CS CLK and Data pin as output for this to work right? Also, there is one thing I don’t understand:

sterretje:
Note:
You will need a millis() based approach and refrain from using delays, for-loops and while-loops if you want to keep your code responsive.

What do you mean by that? Thank you for the code though.

Let's assume that your code is a simple blink where the delay is determined by the potentiometer reading

void loop()
{
  unsigned long delayTime = analogRead(A0) * 1000UL;

  digitalWrite(ledPin, HIGH);
  delay(delayTime);
  digitalWrite(ledPin, LOW);
  delay(delayTime);
}

If your potentiometer is set to 5V, you will have a delay of 1000 seconds (times 2) before you read the analog pin again.

Note:
you can actually use for-loops and while-loops, but not with delays in the body, So you can use a for-loop to shift data out to a 595 as it does not take much time.

You will need a millis() based approach and refrain from using delays, for-loops and while-loops if you want to keep your code responsive.

That means using a state machine type of programming, a step up from the normal.

Look at the blink without delay example in the IDE. Also look at the sticky post, how to do several things at the same time at the start of the projects section of the forum.

Thank you guys so much for the explanations and code. Correct me if I’m wrong, but what you guys are saying is that I use onBoardLedInterval, blinkDuration, and buttonInterval for delays that aren’t supposed to be changed, and currentMillis, previousMillis, and ledInterval for delays that are supposed to be changed? One last question (probably). With this setup when the wiring and code are correct and working, will I still be able to program the matrix in binary format? Again, thank you guys so much for the help, coding, and advice!

There is code for these types of animations here (MD_MAX72XX/examples/MD_MAX72xx_DaftPunk at main · MajicDesigns/MD_MAX72XX · GitHub) that you can use if you want. The hardware platform is different but the principles will be the same.

OMG thanks so much! I have been looking for the daft punk code for AGES! This will help a ton!

You're welcome. Here is a video (could not find it before) from someone else who used the code.

newbtriestoprogram:
Hi. I’m trying to create 11x42 led matrix with a CD4040B 12 bit binary counter with 11 2N3904 transistors for the 11 rows

Two immediate errors there! One is that the CD4040 is more-or-less obsolete, if it were appropriate, it would be a 74HC4040.

But it is a ripple carry binary counter, where what you actually wanted was a one-of-12 counter. :astonished: The nearest thing to that is a 74HC4017, one-of-10. But this always enables at least one output so you can only really use nine outputs, you would need two Arduino pins to generate the other two row selects as well as the clock and reset for the 4017, total four pins to control the 11 rows. :sunglasses:

newbtriestoprogram:
Thank you guys so much for the explanations and code. Correct me if I’m wrong, but what you guys are saying is that I use onBoardLedInterval, blinkDuration, and buttonInterval for delays that aren’t supposed to be changed, and currentMillis, previousMillis, and ledInterval for delays that are supposed to be changed?

No.

Just don't use delay(); and specifically not within for-loops and while-loops. Every delay() blocks your code and they accumulate. You might get away with 10ms here and a 10ms there and a 10ms somewhere else but 100 of them will make 1 second.

Paul__B:
Two immediate errors there! One is that the CD4040 is more-or-less obsolete, if it were appropriate, it would be a 74HC4040.

You are saying that it would be better to use a 74HC4040 because if yes, I’m designing the pcb for this at the moment.

sterretje, I think I understand, but want to make sure. The main point is, don’t use delay(), and whatever the potentiometer puts in to the Arduino will be sent to the leds, and change milis() where the code has milis(delayTime).

newbtriestoprogram:
I’m designing the pcb for this at the moment.

That is inappropriate. You start by designing a circuit, a schematic. Then you build a prototype, on breadboard or perhaps proto-board or stripboard. Then you test the prototype. You may have to go back and change the schematic and prototype and re-test many times before it works correctly. Once the prototype is tested and working, then you design a PCB.

newbtriestoprogram:
You are saying that it would be better to use a 74HC4040 because if yes, I’m designing the PCB for this at the moment.

No, I am saying you appear not to understand what a "4040" actually does! :roll_eyes:

PaulRB:
That is inappropriate. You start by designing a circuit, a schematic. Then you build a prototype, on breadboard or perhaps proto-board or stripboard. Then you test the prototype. You may have to go back and change the schematic and prototype and re-test many times before it works correctly. Once the prototype is tested and working, then you design a PCB.

That too! Obviously none of that has been completed yet! :astonished:

Paul__B:
No, I am saying you appear not to understand what a "4040" actually does! :roll_eyes:
That too! Obviously none of that has been completed yet! :astonished:

How is it obvious! I never told you if I had done a schematic! You guys should be ashamed for making such an idiotic assumption. I did make a schematic! I just told you what part I’m on. I might be a newb on programming, but that doesn’t mean I’m a noob with everything! Sorry if you take this as me being mean, but don’t make assumptions like that!

Here it is. i used a tutorial for a 24x6 matrix.

PaulRB:
That is inappropriate. You start by designing a circuit, a schematic. Then you build a prototype, on breadboard or perhaps proto-board or stripboard. Then you test the prototype. You may have to go back and change the schematic and prototype and re-test many times before it works correctly. Once the prototype is tested and working, then you design a PCB.

Btw, I'm not saying your idea isn't good to use, I just don't have those at the moment and haven't seen tutorials use that. they just make a schematic and then the final pcb. Also, I used a tutorial and followed some of the wiring because it worked. Yes I changed from a 4017 to a 4040. I just want to try this out as a PROTOTYPE pcb. If it doesn't work, it was only $2 and probably costs less than a prototyping board.