I'm having weird flickering on my LED strip, especially at low light levels.

fastled-support
gplus
(Jonathan Schock) #1

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?

(X-WL) #2

Hi! what version of FastLED are you using?
I use the following design to hold the desired FPS:
#define TargetFPS 60
int RefreshTime = 1000 / TargetFPS;
if (millis()-lastUpdate>RefreshTime)
{
lastUpdate = millis();
FastLEDshowESP32();
}

(Jonathan Schock) #3

Version is 3.2.0

(X-WL) #4

@Jonathan_Schock try using the code above. You must declare a variable outside the loop ()

(Jonathan Schock) #5

I already mentioned, that this works in my original post. However I want to understand why that happens.

(Jeremy Spencer) #6

Try FastLED.setdither(0);

See this

(Jonathan Schock) #7

@Jeremy_Spencer you can see from my code, that I already did this. However for integer values of CRGB, that shouldn’t matter at all.

(Jonathan Schock) #8

@Jeremy_Spencer Furthermore: temporal dither seems to not make sense at all, if I don’t call FastLED.delay() and manage the framerate with a millis() construct.

(Jeremy Spencer) #9

Try using every n milliseconds to call fastled.show less often and drop the delay all together.

(Michael Aramini (MickyNuts)) #10

For me is the Fastled version. I have tested other version of fastled work (but I am on esp-01) the Fastled web server (from JasonCoon) work on earlier version of Fastled. With last version I have flickering on all luminosity. But with old version it’s work fine. Test another version (include test version)