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!