ESP8266 Rebooting – Suspect Overload from Rainbow Effect on WS2812b LED Strips

Hello everyone,

I’m experiencing an issue with some ESP8266 D1 Mini devices running ESPHome to control WS2812b LED strips. After running for a few minutes, these devices unexpectedly reboot. The power supplies are robust (5V, 30A) and work perfectly with other devices, so I believe the problem lies elsewhere.

What I’ve Tested:

  • I’m using several ESP8266 devices with the same version of ESPHome, but only those using the Rainbow effect (among other effects) are rebooting.
  • I enabled debug mode and captured the moment of the reboot.
  • My hypothesis is that the Rainbow effect is overloading the CPU of the ESP8266 when many LEDs are active, causing the Hardware Watchdog to trigger.

Relevant Log Snippet:

[13:45:57][D][sensor:093]: 'Heap Free': Sending state 18584.00000 B with 0 decimals of accuracy
...
[13:46:02][D][sensor:093]: 'Heap Free': Sending state 18584.00000 B with 0 decimals of accuracy
WARNING painel-tv-suite @ 192.168.20.42: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for painel-tv-suite @ 192.168.20.42
WARNING Disconnected from API
...
Reset: Hardware Watchdog
Fatal exception:4 flag:1 (Hardware Watchdog) epc1:0x401037f9 epc2:0x00000000 epc3:0x00000000

ESPHome Configuration for the Suite (with sensitive info removed):

substitutions:
  project_name: "painel_tv_suite"
  friendly_name: "Painel TV Suíte"

esphome:
  name: ${project_name}
  friendly_name: "${friendly_name}"
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "${friendly_name} Fallback Hotspot"
    password: "********"

logger:
api:
ota:
  - platform: esphome
    password: "********"

captive_portal:
web_server:

light:
  - platform: neopixelbus
    variant: WS2812
    pin: D1
    num_leds: 69
    type: GRB
    id: led_sofa
    name: "Led do sofá"
    icon: hass:led-strip-variant
    effects:
      - random:
      - addressable_rainbow:
          name: "Rainbow"
          speed: 3
          width: 69
      - addressable_rainbow:
          name: "Rainbow Fast"
          speed: 10
          width: 69
      - addressable_rainbow:
          name: "Rainbow Ultra"
          speed: 30
          width: 69
      - addressable_color_wipe:
      - addressable_scan:
          name: "Scan"
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s

  - platform: neopixelbus
    variant: WS2812
    pin: D2
    num_leds: 71
    type: GRB
    id: led_aereo_inferior
    name: "Led aereo inferior"
    icon: hass:led-strip-variant
    effects:
      - random:
      - addressable_rainbow:
          name: "Rainbow"
          speed: 3
          width: 71
      - addressable_rainbow:
          name: "Rainbow Fast"
          speed: 10
          width: 71
      - addressable_rainbow:
          name: "Rainbow Ultra"
          speed: 30
          width: 71
      - addressable_color_wipe:
      - addressable_scan:
          name: "Scan"
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s

  - platform: neopixelbus
    variant: WS2812
    pin: D4
    num_leds: 71
    type: GRB
    id: led_aereo_superior
    name: "Led aereo superior"
    icon: hass:led-strip-variant
    effects:
      - random:
      - addressable_rainbow:
          name: "Rainbow"
          speed: 3
          width: 71
      - addressable_rainbow:
          name: "Rainbow Fast"
          speed: 10
          width: 71
      - addressable_rainbow:
          name: "Rainbow Ultra"
          speed: 30
          width: 71
      - addressable_color_wipe:
      - addressable_scan:
          name: "Scan"
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s

  - platform: partition
    name: "Led corredor inferior"
    icon: hass:led-strip-variant
    segments:
      - id: led_corredor
        from: 0
        to: 18
    effects:
      - random:
      - addressable_rainbow:
          name: "Rainbow"
          speed: 3
          width: 19
      - addressable_rainbow:
          name: "Rainbow Fast"
          speed: 10
          width: 19
      - addressable_rainbow:
          name: "Rainbow Ultra"
          speed: 30
          width: 19
      - addressable_color_wipe:
      - addressable_scan:
          name: "Scan"
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s

  - platform: partition
    name: "Led corredor superior"
    icon: hass:led-strip-variant
    segments:
      - id: led_corredor
        from: 19
        to: 37
    effects:
      - random:
      - addressable_rainbow:
          name: "Rainbow"
          speed: 3
          width: 19
      - addressable_rainbow:
          name: "Rainbow Fast"
          speed: 10
          width: 19
      - addressable_rainbow:
          name: "Rainbow Ultra"
          speed: 30
          width: 19
      - addressable_color_wipe:
      - addressable_scan:
          name: "Scan"
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s

  - platform: neopixelbus
    variant: WS2812
    pin: D7
    num_leds: 38
    internal: true
    type: GRB
    id: led_corredor
    name: "Led corredor"
    icon: hass:led-strip-variant

Context and Issue:
After powering the devices with the usual setup, the ESP8266 running the suite reboots unexpectedly. The debug log shows that at around 13:46:02 the device disconnects and then resets with a “Hardware Watchdog” error:

Reset: Hardware Watchdog
Fatal exception:4 flag:1 (Hardware Watchdog) epc1:0x401037f9 ...

This indicates that the main loop is blocked for too long (likely due to heavy CPU load).
I strongly suspect that the Rainbow effect, which continuously recalculates and updates a large number of LEDs via bit‑banging, is overloading the ESP8266’s CPU—especially since other devices running similar setups (without using the Rainbow effect) work fine.

I’m looking for suggestions on how to optimize or replace the Rainbow effect (for example, by implementing it as a lambda effect) to reduce CPU load and avoid watchdog resets. I’m currently stuck with ESP8266, switching to an ESP32 is not an option right now.

Has anyone experienced something similar or have recommendations on how to implement a less CPU-intensive Rainbow effect?

Thanks in advance for your help!

Your whole condig is all lights and light effects… If you dont actually need any of the non led Esphome functions then why are you even using Esphome?

Esphome isnt really made for doing complicated or high demand led effects and is really best used for doing basic effects and things like solid color accent lightning which is why you really shouldn’t even be using esphome for this.

You are bit-banging on three buses.
Read what the library says about method and pins for esp8266.
ESP8266 NeoMethods · Makuna/NeoPixelBus Wiki · GitHub

1 Like

Hello! Thanks for the reply. That makes a lot of sense, I will try different pins and see if it helps. Thanks a lot!

Hello again, a lot of progress from here: I’ve been running it for about an hour and no reboot whatsoever, amazing!

I have reorganized pins for two other similiar D1 Minis on my home, they all seems to be working fine now. The only problem is with this one:

substitutions:
  project_name: 'painel_tv_suite'
  friendly_name: 'Painel TV Suíte'

esphome:
  name: painel-tv-suite
  friendly_name: "${friendly_name}"

esp8266:
  board: d1_mini
    
# Enable logging
logger:
  level: debug

# Enable Home Assistant API
api:
  encryption:
    key: "******"

ota:
  - platform: esphome
    password: "*****"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
#  reboot_timeout: 0s

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${project_name}"
    password: "****"

  reboot_timeout: 10min  # Antes estava em 0s (desativado), pode causar travamento
  power_save_mode: HIGH

captive_portal:

web_server:

debug:
  update_interval: 5s

text_sensor:
  - platform: debug
    device:
      name: "Device Info"
    reset_reason:
      name: "Reset Reason"

sensor:

# Wifi signal
  - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
    name: "${friendly_name} - Sinal Wi-Fi"
    id: "wifi_signal_db"
    update_interval: 60s
    entity_category: "diagnostic"

  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    name: "${friendly_name} - Qualidade Wi-Fi"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "Signal %"
    entity_category: "diagnostic"

  - platform: debug
    free:
      name: "Heap Free"
    fragmentation:
      name: "Heap Fragmentation"
    block:
      name: "Heap Max Block"
    loop_time:
      name: "Loop Time"


switch:

# Raspberry Pi TV
  - platform: gpio
    name: "Raspberry Pi TV Suíte"
    pin: D7
    inverted: true
    icon: "mdi:raspberry-pi"
    id: relay_0

light:

# Luz do espelho
  - platform: binary
    name: "LED do espelho"
    output: output_01
    icon: "mdi:mirror-rectangle"

  - platform: neopixelbus
    variant: WS2812
    pin: D1
    num_leds: 164
    type: GRB
    id: led_tv_suite
    name: "Led da TV da Suíte"
    icon: hass:led-strip-variant
    effects:
      - random:
      - addressable_rainbow:
          name: Rainbow
          speed: 3
          width: 164
      - addressable_rainbow:
          name: Rainbow Fast
          speed: 10
          width: 164
      - addressable_rainbow:
          name: Rainbow Ultra
          speed: 30
          width: 164
      - addressable_color_wipe:
      - addressable_scan:
          name: Scan
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s

  - platform: neopixelbus
    variant: WS2812
    pin: D4
    num_leds: 248
    type: GRB
    id: led_teto_suite
    name: "Led do Teto da Suíte"
    icon: hass:led-strip-variant
    effects:
      - random:
      - addressable_rainbow:
          name: Rainbow
          speed: 3
          width: 248
      - addressable_rainbow:
          name: Rainbow Fast
          speed: 10
          width: 248
      - addressable_rainbow:
          name: Rainbow Ultra
          speed: 30
          width: 248
      - addressable_color_wipe:
      - addressable_scan:
          name: Scan
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s
      - addressable_lambda:
          name: "Sunrise"
          update_interval: 3500ms
          lambda: |-
            static uint16_t progress = 0;
            static uint16_t half_size = it.size() / 2;
            if (initial_run) {
              progress = 0;
              it.all() = Color::BLACK;
              return;
            }          
            if (progress < half_size) {
              it[half_size - 1 - progress] = current_color;
              it[half_size + progress] = current_color;
            }
            progress++;

  - platform: neopixelbus
    variant: WS2812
    pin: TX
    num_leds: 210
    type: GRB
    id: led_chao_suite
    name: "Led do Chão da Suíte"
    icon: hass:led-strip-variant
    effects:
      - random:
      - addressable_rainbow:
          name: Rainbow
          speed: 3
          width: 248
      - addressable_rainbow:
          name: Rainbow Fast
          speed: 10
          width: 248
      - addressable_rainbow:
          name: Rainbow Ultra
          speed: 30
          width: 248
      - addressable_color_wipe:
      - addressable_scan:
          name: Scan
          move_interval: 10ms
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - random:
          name: "RGB transition slow"
          transition_length: 5s
          update_interval: 30s
      - random:
          name: "RGB transition fast"
          transition_length: 5s
          update_interval: 10s

output:

# GPIO da luz do espelho
  - platform: gpio
    id: output_01
    pin: D5
    inverted: true

One of the strips (TX pin) are showing a timed white blink on the start of the strip:

This was not happening before. Any ideas?

Thanks again!

Try with
baud_rate: 0
on logger component

Incredible, you are a star! That worked like a charm, everything is working great now. Thank you very much and have a good night.

Thank you.
Lucky star, I have never tried neopixels on Esphome

1 Like

Its not very good and really only does well with very simple effects like fading or slow sequences and obviously it will work for any kind of ambient lighting.

This guy isnt doing anything special with this esp board and i tried telling him he should use WLED if hes wanting all kinds of effects and whatever else hes doing with partitions etc. WLED would be far superior and helpful for the OP but, you like doing that thing where you help people by answering their questions instead of helping them ask better questions that will benefit them much more. We’re working on it though! Daddy will be here to help you out, dont worry!

Yes, it’s kind of common to help people by answering their questions.
And it’s quite strange if it bothers someone.