LEDs flickering while using brightness

Hi all,
after i get my first wled-light running, i have the next issue.

when i set the brightness higher, the leds starts to flicker a little until the final brightnes is set.

it looks like there is a kind of a smooth-effect to set the brightness but there is not enough power to do this. I use a nodemuc with esp8266 and 60 apa102 leds on a 7A powersupply.
i orderd a new esp32 to see if its realy a perfomance issue but i do not really believe in that.

any ideas, anyone?

thx
boostar

Hi,
i managed to capture this flickering, i raised the brightness two times in this video.

cya
BooStarVIDEO-2020-02-21-22-02-54.zip (2.2 MB)

I have that too with my apa102 leds. (WS2812B are fine)
But it only happens when you use the brightness slider.
With everything else it works perfectly fine, so also as ambilight etc no problems.

Already tried other pins and that doesnt really help.
It doesnt really bother me, not changing the brightness via the slider much anyways.

Hi… Good to See that i m Not alone with that…
Have you tried this with an esp32?

Hi!
This issue look to me like the logic level of the ESP might be to low to reliably drive your LEDs.
What happens if you run effect modes (like Colortwinkle or Wipe)?
It could probably be fixed by using a 3.3V->5V level shifter (74AHCT125N is a good one)

Hi!
Are your LEDs real APA102 or maybe SK9822.
I found this site where the differences are explained.


I think the neopixelbus library would need a small change for SK9822

I use a level shifter, the one you said even.
It doesnt happen when I use ESPHome with the apa102 or some other firmware.
Only with WLED, but its just the brightness part, so doesnt bother me.
But to be honest I use fastled_spi with the other ones as library and use gpio13 and 14 for them.
As gpio0,2&3 also flicker on those.

Effects are fine, no problem.

Ow and this is on a D1 Mini v3

The problem lies in the library used with the mode used on gpio, I do know D4/GPIO2 will allways result in brightness flicker.
I recall gpio3 should be able to do it with a certain setting, but forgot, need to check if i still have those sketches laying around.

Edit3: Ow and my apa102 are real ones, just in case.

Edit4: Yeah with neopixelbus library I had to use gpio3 in dma mode, to not get flicker. (RX pin)
Dont use bitbang mode for this tho, allways flickers with apa102.
Fastled_spi can just use the spi bus pins.

1 Like

Interesting, thank you for the insight!
Neopixelbus can use the hardware SPI pins as well, you could try out if that helps. But I don’t know why fast effects would work flawlessly, that doesn’t really make sense to me if driving was an issue.
If you want to try it, just replace #define PIXELMETHOD DotStarMethod in NbpWrapper.h line 69 with #define PIXELMETHOD DotStarSpiMethod

I will try that tomorrow, too sleepy atm.
Yeah I know its kinda strange that fast effects work, even hyperion with fast action over updraw works perfectly without flicker.
I will try the dotstarspi tomorrow to see if that helps.

1 Like

Hi,
i tried #define PIXELMETHOD DotStarSpiMethod
LEDs are connected to #define CLKPIN 0 an #define DATAPIN 2
but no change, LEDs still flickering while setting the brightness up.

Hi,
i found something but do not know how to fix it.
The APA102 and also the SK9822 use a 32bit frame for each LED.
The first 8 bit define the global brightness and the rest 24 bit set each color.
I used sigrok to capture the spi transfers going to the leds and found that the first 8 bit
get set depending on the brightness set in WLED.
I think they should always be 255 because the brighness is defined by the 24 bit of the RGB colors.
Dont know if the problem lies in WLED or NeoPixelBus.

Thanks for testing! You’ll need to connect clk to gpio 14 and data to gpio 13, those are the hardware SPI pins. Neopixelbus probably falls back to the normal DotStarMethod if pins are different.

That is a very interesting consideration, thanks! I’d believe that Neopixelbus handles this correctly internally, so that for WS28xx the NeopixelBrightnessBus would scale the 24-bit RGB color while it is left alone for APA102 and the brightness byte used instead. WLED doesn’t do the brightness scaling, it happens completely in NeoPixelBus.

I dont think the Brightness Byte should be used at all because scaling is only from 0-31.
In the DotstarTest example from Neopixelbus this is explained.

I tested it now with the dotstarspi on gpio 13 and 14.
Brightness flicker is still there.
Everything else works just like normal.
So it must be something else that only affects the brightness slider.
Maybe feindsender is on to something?

This has nothing to do with the slider it also happens when brightness is set via http-api

I am playing around with the NeoPixelBrightness Example.
It seems the problem is from the NeoPixelBrightnessBus. The Brightness set there is also
send trough SPI to the Pixels.

Same thing as via slider, its just brightness settings.
I noticed also it only happens if i set it higher, if i do it lower its ok, strange.

I am pretty sure the problem lies within the NeoPixelBrightnessBus.
The Brightness set with strip.SetBrightness function should not be sent to the Pixels.

Edit: I am not allowed to add a new post

I think i found the problem.
The strip.SetBrightness function is modifing every byte of the strip.
This is right for normal RGB strips where every byte stands for one color.
In our case the first of 4 bytes is special. It can be used to control brightness (also not very good) but
should be left at 0xff if brightness is controlled through the RGB colors.
The strip.SetBrightness is modifing this byte.

I have modified the function in NeoPixelBrightnessBus.h

    // re-scale existing pixels
    //
    uint8_t* ptr = this->Pixels();
    uint8_t* ptrEnd = ptr + this->PixelsSize();
    while (ptr != ptrEnd)
    {
        uint16_t value;
        *ptr++;

        value = *ptr;
        *ptr++ = (value * scale) >> 8;

        value = *ptr;
        *ptr++ = (value * scale) >> 8;

        value = *ptr;
        *ptr++ = (value * scale) >> 8;
    }

    _brightness = newBrightness;

This fixes the flickering but will also break every other type of led strip.
So a real fix needs to be found

One more thing, do you guys have the power limiter in LED settings enabled? If yes and your power supply is sufficient, you could turn it off to see if that makes any difference…

Off or on… no differnece