I’m having weird flickering on my LED strip, especially at low light levels.
My setup:
Arduino 1.8.7 (Windows Store 1.8.15.0)
Arduino/Genuino Uno
100 WS2801 RGB LEDs on pins 11&13
external switching power supply to drive both LEDs and Arduino@5V up to 10A
When going to very low light levels, I get a high frequency flickering in brightness. This is uniform over all my LEDs. The flickering is not visible at higher light levels, approximately above a brightness of 3 (per RGB Channel).
My sketch:
//suggested fix from other threads
#define FASTLED_ALLOW_INTERRUPTS 0
#include <FastLED.h>
FASTLED_USING_NAMESPACE
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning “Requires FastLED 3.1 or later; check github for latest code.”
#endif
#define DATA_PIN 11
#define CLK_PIN 13
//using hardware SPI-Pins makes things a little better
#define LED_TYPE WS2801
#define COLOR_ORDER RGB
#define NUM_LEDS 100
//another suggested fix
#define FASTLED_INTERRUPT_RETRY_COUNT 0
CRGB leds[NUM_LEDS];
void setup() {
delay(3000); // 3 second delay for recovery
//disable dithering to be sure to have exact values
FastLED.setDither(0);
// tell FastLED about the LED strip configuration
//disable Correction to be sure to have exact values FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS);//.setCorrection(TypicalLEDStrip);
}
void loop()
{
// send the ‘leds’ array out to the actual LED strip
fill_solid(leds, NUM_LEDS, CRGB(1,1,1));
FastLED.show();
// insert a delay to keep the framerate modest
FastLED.delay(3000);
}
If I exchange the FastLED.delay(3000);
call with a call to the plattform’s delay()
call, everything is as it should be. This pushes me in the direction to believe, that I’m writing out data too fast, however I only saw this problem around this forum for WS281x LEDs. So, what I my alternatives here? Would the preferred way of fixing this be an implementation with a blocking delay()
or alternatively some construct using milis()
to be non-blocking? Or am I missing something else? And especially, if a too high datarate is the problem, why is this not showing at high brightness?