0

APA102 LED panels have flicker problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

APA102 LED panels have flicker problem

by mrjdaddy on Thu May 27, 2021 5:16 am

Hi Folks,

Apologies if this has already been covered. A quick search did not reveal any obvious previous post covering the same problem, but I might have missed it if it was there.

Some APA102 LED panels were made for me to be 10 high by 40 wide. I have connected them in series so that to a microcontroller it looks like a 800 long strip of LEDs that are essentially DotStar LEDs.

I am controlling the 800 LEDs with a Arduino Due running the DotStar software using hardware SPI:

Code: Select all | TOGGLE FULL SIZE
Adafruit_DotStar led_strip(800, DOTSTAR_BRG) ;
    // THIS USES HARDWARE SPI, SO DO NOT INDLUDE DATAPIN & CLOCKPIN IN DECLARATION


My test program changes the colors of the LEDs column by column. cycling between blue, purple, magenta, red, yellow, green, cyan, and white, then repeating the cycle. This works great for brightness values less than 60:

Code: Select all | TOGGLE FULL SIZE
led_strip.setBrightness(60) ;


However for brightness values above 60, the LEDs in the second panel (i.e. the last 400 LEDs in the chain) start to flicker. The higher the brightness value, the greater the amount of flicker, until at sufficiently high brightness levels the last 400 LEDs in the second panel start to have random colors.

I tried the experiment of using software SPI, and found that it works perfectly for any brightness level for all 800 LEDs:

Code: Select all | TOGGLE FULL SIZE
Adafruit_DotStar led_strip(800, DATAPIN, CLOCKPIN, DOTSTAR_BRG) ; // SOFTWARE SPI


The problem with using software SPI is that it runs 800 LEDs at around 15 frames per second, and I need at least 30 frames per second, preferably more.

This leads me to ask: is it possible to lower the hardware SPI clock speed using commands included in the DotStar library?

Thanks for any suggestions!

David Kasle

P.S.: I should mention that my power supply is 5V / 10A, the 5V and 9V supplies on the Arduino Due breadboard are both filtered with 10,000 microfarad capacitors, the LED panels have 1,000 microfarad capacitors filtering their 5V supplies, and the Din signals to both LED panels have a 220 ohm resistor wired in series. The SPI clock and the SPI Din signal are both raised from 3.3V to 5V via a bidirectional level shifter on the breadboard.

mrjdaddy
 
Posts: 11
Joined: Sun Dec 08, 2013 2:07 am

Re: APA102 LED panels have flicker problem

by mrjdaddy on Thu May 27, 2021 5:29 pm

Another question I should ask: is it possible to increase the clock speed in software SPI mode? How would one do that?

Either slowing down the hardware SPI clock or speeding up of the software SPI clock might solve my problem.

Thanks for any suggestions,
David

mrjdaddy
 
Posts: 11
Joined: Sun Dec 08, 2013 2:07 am

Re: APA102 LED panels have flicker problem

by adafruit_support_mike on Fri May 28, 2021 10:20 pm

That sounds like noise in the supply rails. That many LEDs will use enough current to create a noticeable voltage drop across the resistance of the wiring.

Have you included any debounce capacitors in your matrix design?

adafruit_support_mike
 
Posts: 63059
Joined: Thu Feb 11, 2010 2:51 pm

Re: APA102 LED panels have flicker problem

by mrjdaddy on Sat May 29, 2021 2:19 am

Hi Mike,

I really appreciate your constructive response. Yes, I have two 1000 uFD capacitors to minimize bouncing in the the power rails on each LED panel, for a total of four 1000 uFD capacitors.

After I asked this question, I solved the flickering problem by using the FastLED library (instead of the DotStar library) with an Arduino Nano 33 IOT board. I did this because the FastLED library allows the user to set the hardware SPI clock speed, so I set the speed to 20 MHz:

Code: Select all | TOGGLE FULL SIZE
FastLED.addLeds<APA102, DATAPIN, CLOCKPIN, BGR, DATA_RATE_MHZ(20)>(ledstrip, NUMPIXELS);


This works perfectly without any flickering, and gives me a frame rate of 64 FPS for all 800 LEDs, which is plenty for for my application. In fact it even works without the power supply debounce capacitors.

May I suggest that the DotStar library would be improved by allowing the user to set the hardware SPI clock speed? Based on my experience I think that would help with the sort of problem that I encountered.

Thanks,
David

mrjdaddy
 
Posts: 11
Joined: Sun Dec 08, 2013 2:07 am

Please be positive and constructive with your questions and comments.