How to get ~800 Leds to work smooth with Fastled or Neopixel

I am working on a project to have an ESP32S with WS2812B leds on each step of my staircase. I chose ESPhome running under HA in Docker to run the sequences with PIR sensors. The project has 796 LED’s in total that are split into 14 partitions (variable lenghts).

I am now working multiple days to get rid of the problems that I experience but can’t get my head around it. Basically, the created YAML file is functional with the fastled integration. Relevant code blocks:

 - platform: fastled_clockless
    chipset: WS2812B
    rgb_order: GRB
    internal: true
    pin: GPIO4
    num_leds: 796
    name: "staircase"
    id: staircase


# Creating 14 partitions for each step
# LED strip WS2812B, total 796 LEDs

# Step 1: 52 LEDS - LED 0 to LED 51
  - platform: partition
    name: "step1"
    id: step1
    internal: true
      - id: staircase
        from: 1
        to: 50


# Run light on from bottom to top
  - id: lightdownup
      - light.turn_on: 
          id: step1
          transition_length: !lambda |-
            return id(transition);                      
          brightness: !lambda |-
            return id(brightness);            
          red: !lambda |-
            return id(red);
          green: !lambda |-
            return id(green);
          blue: !lambda |-
            return id(blue);
      - light.turn_on: 
          id: step2.... etc,

Skipping further code as it doesn’t contribute to the problem.

To start, I do experience the often recognized flickering that has been described in many other topics. These glitches increase when either monitoring live with the ‘log’ function and when connected to HA via the API. Without, flickering is rather limited. Cause is to be found in interrupt handles as I see.

To solve that, I’ve tried to step to NeoPixelBus instead:

  - platform: neopixelbus
    type: GRB
    variant: WS2812X
    method: ESP32_I2S_1
    pin: GPIO4
    num_leds: 796
    name: "staircase"
    id: staircase

This works perfectly fine with a limited amount of LEDs, however, it became clear to me that NeoPixelBus either or not combined with partitions screws up as soon as more than 350 LED’s are used.

I have ran endless attempts to fix these problems.
Played with different NeoPixelBus and FastLed libraries (not at the same time of course):

- [email protected] (by the way, the currently standard distrubution 2.5.7 doesn’t work at all)
(- AsyncTCP)
(- [email protected])

None of them solved the issue.

The final suggestion that I see around is playing with interrupt handling, such as including one of the following above the #include “FastLED.h” in fastled_light.h:


Unfortunately it is not easy to do this as the subsequent libraries (in this case fastled_light.h) are overwritten each time when compiled with the one from the source base, which is somewhere out of the ESPHOME docker container.

So now after explaining I have some questions that somebody may be able to answer:

  1. I prefer NeoPixelBus as it handles the output to the LED’s via DMA or other non-interrupt based method, which is a root solution. Would it be possible to address ~800 LED’s in the way described above flawlessly in an ESP32S with ESPhome? How?

  2. If Fastled is the option left (which by itself functions, but with the glitches), how can I play with the abovementioned inclusion of the #defines for the fastled interrupts, I have no clue how to change the source base outside the HA ESPhome container.

  3. Any other solution would be welcome, if you need additional info, please phrase as I am out of creativity here…

Please read this How to help us help you - or How to ask a good question and format your code properly.

Thanks, followed your suggestions.

1 Like

I have a similar set up of 598 SK6812 (wanted RGB + warm white) on 13 step stair case but am running it on WLED (ESP32). Works great; no issues and with custom mod can light up individual steps in either direction with reverse turn off.

I can’t tell from your description what the blinking issue is but it very well might have nothing to do with esphome, fastled, etc. How long is the data line from your ESP32 and the first LED?

Thanks Tdw. I have considered WLED and might jump to that if I cannot resolve this, but like ESPhome very much and it allows to run things with PIR sensors independant from HA, while eventually having the ability to do manual stuff over HA if desired.

The wiring is all fine, only couple of centimeters between ESP and first LED. I also played with a level shifter but no difference could be found. Other trick was to lower the LED strip voltage a bit (I use an adjustable PSU for the test environment) to overcome the level shift, but that also didn’t do the trick.

Alternatively I will jump to Segmented WLED. WLED is to me the prove that it is not a problem at all to run ~800 LED’s flawlessly. I only have to find out whether I find a way to include some code to create my own effects, optimized for stairs as I have some particular wishes. I’m just rather limited in coding deeply…

It’s super easy to flash so probably worth a shot. You could always go back to esphome if issue persists. Lots of effects included and there are some stair specific user mods available. The wled wiki is pretty clear on how to add user mods if the included effects aren’t exactly what you are looking for.

I believe that you can use standard audrino code in a specific file in wled to add sensors right to the esp. I don’t use it but it happens to be on the same page as custom effects.

Programming is done in the Arduino IDE. There is a special file, usermod.cpp , to write your own code. (however, if you think your code may be relevant to many users, feel free to code it in directly and open a pull request)
This file has three empty methods:

  • userSetup() is called after loading settings but before connecting to WiFi. Use it to start own interfaces if it does not depend on WiFi (IR, Sensors, GPIOs,…).

Thank you for the suggestion, I will dig into that. With the experience I currently have to run some addressable LEDs in a smooth matter, I have to say that Aircookie has done an amazing job.

I use WLED in quite some home lights already for some time and played with the recent segments that have been added. Automation has to be done in HA but timing is not so accurate. This causes that steps turn on/off not so equally in time. In addition I like the transition to be smooth, which is also not possible in WLED. See a little video of it in which I demonstrate it:

You don’t have to do the effects through a HA automation.

I don’t. Effects are handled withing WLED in this video, but switching segments on/off one by one do, right? If not please make me some suggestions as I didn’t find another way. By the way, this is not what the topic is about, but thank you for helping.

I understand the topic. Check out the wled discord. There is a user mod for stairs that does what you want by segment. You could also make your own effect if needed. Good luck on it

I wanted to share the progress. It seems that the “flicker” effect happens to most people and I am under the impression this is not easy to resolve. With the feedback from this topic, I decided to move to WLED and with aid of HA the results become satisfying now. For me therefore topic closed, here some videos to show the result:

Most impressive: the rainbow effect, segmented per step:

And from the top:

Steps turning on- and off:



Hello, would you mind sharing how you have configured wled and the homeassistant config?