Progressive flicker with longer the word is. 3bit 8x8 LED NeoPixel Adafruit


I made a LED matrix from 3pcs 8x8 NeoPixel. After I programmed the Matrix I saw that the Matrix is doing a strange flicker depending oh how long the word is. It affect the speed too.

For example: If I am tying to write “HELLO WORLD” that last letters will start to flicker. Check link below:


If I am trying to write only “H” it will not flicker and the speed it’s much faster even though I didn’t change the code for speed. Check link below.


Both of the examples run at 50 ms of speed transition and as you can see, the shorter word is moving much faster that the longer one.

To summarize my code, I made a Matrix of 8x24 for the LED and to call the letters I made separate functions for each one.

Attached you can find my Arduino code and my electric diagram.

ENG_Matrice_LED.ino (23.7 KB)

I briefly read your code. You could not post it in code tags, it is too long. Did you create this code yourself? If so, I admire your patience completing it.

I suspect that the flickering is because the sketch calls too frequently. It is called after each letter is printed. It should only be called after all the letters have been printed. In loop(), move from after the call to letter() and put it just before the delay(50). Also remove the from turn_off().

In your circuit, you should have some large capacitors, e.g. 1000uF, perhaps one for each 8x8 matrix. Also, you should have a ~500R resistor in the data line from the Arduino to the first matrix. But I do not think these missing components are causing your flicker problem, I think that is a software problem.

I tried to use code tags but it said that I exceeded 9000 characters. Me and my work colleague are working for this side project at work. We are only 2 people working at it :slight_smile:

It is called after each letter is printed. It should only be called after all the letters have been printed.

Correct! I am 99% sure that this is the problem! :slight_smile:

Also remove the from turn_off().

I cannot remove that because the logic behind is: the user ( I am currently developing an android app with MitAppInventer ) can chose the background color and the color font for the word. That’s why i need the syntax in void turn_off(), because it won’t be always black.

I also tried:

void turn_off() {

instead of:

void turn_off() {
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 24; j++)
      strip.setPixelColor(A[i][j], BACKGROUND_COLOR);;

and the flickers still continues, so I am almost definitely sure that calling after each letter is the problem. I will test it as soon as I get to work Monday and I will update my progress.

Best regards,

and the flickers still continues

because you have not removed from turn_off(). Trust me. Take it out, you don't need or want it. Your explanation of the "logic" behind having it there is just wrong, you can have any background colour you like, but you do not need to use in that function to make that happen. If you want to update the strip every 50ms you must call one time for each delay(50). If you call it twice, you will get flickering or maybe reduced brightness or muddied colours.

If you want some suggestions how to make your sketch about 10 times shorter, let us know.

I cannot remove that because the logic behind is......

Never ceases to amaze me that some people ask for help, help is given, and then they argue why that help is wrong.

Why ask for help if you will not accept it? If you knew more than the senior people giving help here you would not be asking such questions in the first place, you would be finding the solution to your own problem.

You have been given very good top quality advice, take it.

What is the purpose of turn_off()? As currently written, the code will display a frame of the scrolled text, then display a frame of the background color. If your intent is to display a bit of the text, then display a solid background (currently black), then there will always be flicker because you are alternating between the two. If you want to scroll the text across a background color, that is not the way to do it.

I see that you did handle the letters properly, only changing the colors of the pixels that represent the letter, and leaving the surrounding background intact. As was recommended, removing the in turn_off() will remove the flicker, but you really don't need the turn_off() function, strip.fill(BACKGROUND_COLOR) will accomplish the same thing.

Thank you PaulRB. It works now without any flickering.

I removed from turn_off function and moved the 2nd strip.shpw() before 50ms delay. I still don't understand why does the function turn_off works without, but it works.

Isn't supposed to push the data into the LEDs? And my data was the for function inside void turn_off.

Anyway thank you PaulRB for the patience in explaining me. If you are interested in my final product, to see how I can transmit any text+color and color background from my phone, I'll post a short video link. Take care.

Isn't supposed to push the data into the LEDs?

Yes, correct. But you only want to do that once every 50ms. If you do it just before the delay(50) and do it again after the delay(), inside turn_off() you will be pushing the data to the LEDs twice every 50ms.

When your code calls strip.setPixelColor(), this updates an area of memory, an array variable, in the Arduino's RAM. This array is "global", not local to any function like loop() or turn_off(), so it's contents will not be lost when those functions end. So those functions don't need to call in order to avoid loosing the changes they make. The changes remain in global memory until overwritten by another call to strip.setPixelColor().

Imagine you are creating an animated cartoon by painting each frame and then capturing it with a stop-motion camera. For each frame, you paint over the entire frame with the background colour. Then you paint the character, Mickey Mouse or whatever, on top of the background. Then you capture the image. You don't capture an image between overpainting the background and painting Mickey. That would cause Mickey to flicker. Calling in turn_off() is like capturing the frame before Mickey is painted.

PS. I didn't intend to insult you by implying this is all "Mickey Mouse stuff". Just the first character that came to mind!

PS. I didn't intend to insult you by implying this is all "Mickey Mouse stuff".

I'm sure (s)he will manage to cope. :roll_eyes:

No no PaulRB, I couldn't possibly get offended :slight_smile: All your explanation was quite intuitive and helpful.

As I said, here is my final product:

Inside Case

Video Link

Thank you for all the help. Take care.