Adafruit NeoPixels and neopixelbus

I’m using both an ESP-WROOM-32 board I bought on Amazon and an M5Stack Core 2 with 3 Adafruit NeoPixels. [EDIT] The NeoPixels are on a single GPIO25, use WS2812B’s. I’ve tried different board types and different GPIO’s to no success.

If I were to use them with the rainbow test sketch, they work perfectly fine.

When I use them with ESPHOME, they work perfectly fine after flashing until I unplug the power after flashing. (meaning power cycle)

Any ideas why?

esphome:
  name: towerlight

esp32:
  board: denky32
  framework:
    type: arduino

# Enable logging
logger:

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

light:
  - platform: neopixelbus
    type: GRB
    pin: GPIO25
    variant: 800KBPS
    num_leds: 36
    id: light1
    name: "NeoPixel Light"
  - platform: partition
    name: "Ring #1"
    segments:
      - id: light1
        from: 0
        to: 11
    effects:
      - addressable_scan
  - platform: partition
    name: "Ring #2"
    segments:
      - id: light1
        from: 12
        to: 23  
    effects:
      - addressable_scan
  - platform: partition
    name: "Ring #3"
    segments:
      # Use LEDs 11-20 from the light with ID light1
      - id: light1
        from: 24
        to: 35   
    effects:
      - addressable_scan

ota:
  password: "XXXX"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Towerlight Fallback Hotspot"
    password: "XXXX"

captive_portal:
    

Unplug the power … and then how are you powering the ESP and the LEDs afterwards? And is the ESP itself working (i.e. connecting to WiFi, connecting to HA, etc.) and it’s just the LEDs that are not working, or is nothing working?

The device shows online in ESPHOME.

I meant ‘powercycle’, I unplug the USB cable, then plug it back in and then the lights no longer work when toggled in HA.

My ESPHOME version shows 2023.2.0 at the bottom.

Logs:

INFO Reading configuration /config/esphome/towerlight.yaml...
INFO Starting log output from towerlight.local using esphome API
INFO Successfully connected to towerlight.local
[16:54:58][I][app:102]: ESPHome version 2023.2.0 compiled on Feb 15 2023, 16:53:17
[16:54:58][C][wifi:504]: WiFi:
[16:54:58][C][wifi:362]:   Local MAC: 30:C6:F7:25:C4:38
[16:54:58][C][wifi:363]:   SSID: [redacted]
[16:54:58][C][wifi:364]:   IP Address: 172.16.1.132
[16:54:58][C][wifi:366]:   BSSID: [redacted]
[16:54:58][C][wifi:367]:   Hostname: 'towerlight'
[16:54:58][C][wifi:369]:   Signal strength: -30 dB ▂▄▆█
[16:54:58][C][wifi:373]:   Channel: 8
[16:54:58][C][wifi:374]:   Subnet: 255.255.254.0
[16:54:58][C][wifi:375]:   Gateway: 172.16.0.1
[16:54:58][C][wifi:376]:   DNS1: 172.16.0.10
[16:54:58][C][wifi:377]:   DNS2: 0.0.0.0
[16:54:58][C][logger:293]: Logger:
[16:54:58][C][logger:294]:   Level: DEBUG
[16:54:58][C][logger:295]:   Log Baud Rate: 115200
[16:54:58][C][logger:296]:   Hardware UART: UART0
[16:54:58][C][light:104]: Light 'NeoPixel Light'
[16:54:58][C][light:106]:   Default Transition Length: 1.0s
[16:54:58][C][light:107]:   Gamma Correct: 2.80
[16:54:58][C][light:104]: Light 'Ring #1'
[16:54:58][C][light:106]:   Default Transition Length: 1.0s
[16:54:58][C][light:107]:   Gamma Correct: 2.80
[16:54:58][C][light:104]: Light 'Ring #2'
[16:54:58][C][light:106]:   Default Transition Length: 1.0s
[16:54:58][C][light:107]:   Gamma Correct: 2.80
[16:54:58][C][light:104]: Light 'Ring #3'
[16:54:58][C][light:106]:   Default Transition Length: 1.0s
[16:54:58][C][light:107]:   Gamma Correct: 2.80
[16:54:58][C][captive_portal:088]: Captive Portal:
[16:54:58][C][mdns:108]: mDNS:
[16:54:58][C][mdns:109]:   Hostname: towerlight
[16:54:58][C][ota:093]: Over-The-Air Updates:
[16:54:58][C][ota:094]:   Address: towerlight.local:3232
[16:54:58][C][ota:097]:   Using Password.
[16:54:58][C][api:138]: API Server:
[16:54:58][C][api:139]:   Address: towerlight.local:6053
[16:54:58][C][api:141]:   Using noise encryption: YES
[16:55:23][D][light:035]: 'Ring #3' Setting:
[16:55:23][D][light:046]:   State: ON
[16:55:23][D][light:084]:   Transition length: 1.0s
[16:55:26][D][light:035]: 'Ring #1' Setting:
[16:55:26][D][light:046]:   State: ON
[16:55:26][D][light:084]:   Transition length: 1.0s
[16:55:28][D][light:035]: 'NeoPixel Light' Setting:
[16:55:28][D][light:046]:   State: ON
[16:55:28][D][light:084]:   Transition length: 1.0s
[16:55:33][D][esp32.preferences:113]: Saving 3 preferences to flash...
[16:55:33][D][esp32.preferences:142]: Saving 3 preferences to flash: 0 cached, 3 written, 0 failed

And are you then using a different power source, like a USB power adapter? If so, can that provide enough power to all the LEDs?

Another quick thing to test is to configure the neopixelbus component as internal, to avoid having a light entity in HA which may interfere with the individual segments.

My USB is plugged into a power bar with USB ports (NOMA brand) that has a 2.1A rating on it. Again, it works just fine on the rainbow strand test using the Arduino IDE.

I changed my code to:

light:
  - platform: neopixelbus
    type: GRB
    pin: GPIO25
    variant: 800KBPS
    num_leds: 36
    id: light1
    name: "NeoPixel Light"
    internal: True

no success.

Have you tried using “WS2812x” for the variant instead of the “800KBPS” you are using now?