Making a Neopixel on an Adafruit ESP32-C6 work with ESPHome
Introduction
I’m using ESPHome as my preferred choice for a lot of work on sensor microcontrollers around the house because it works really well with Home Assistant, and it’s more or less config and wireless OTA for updating, which is really convenient.
I recently picked up the Adafruit ESP32-C6 Feather at the local microcenter so that I could use the Neopixel to display a color tied to my calendar, and hang it off a door handle powered off the battery. Out of the box, it took enough finagling that I figured I’d write it up because I couldn’t find what I needed online.
So a few things about this board:
- It uses the WS2812 LED, which can be driven from the esp32_rmt_led_strip light platform.
- The RGB order is GRB on this LED, which I’ve found to be the same for my Adafruit metro boards as well
- The LED is sitting on what adafruit says is pin IO9, or GPIO9 in ESPHome
- It’s off by default, and needs GPIO20 (what adafruit calls
NEOPIXEL_I2C_POWERon this board) to be pulled high in order to turn it on, assuming you’re using the esp-idf anyway, which is all that seems supported on this board
Putting that all together, you need some configuration blocks like this:
esphome:
name: status-light
friendly_name: status-list
# Enable neopixel on boot
on_boot:
- priority: 90
then:
output.turn_on: neopixel_i2c_power
esp32:
board: esp32-c6-devkitc-1
framework:
type: esp-idf
light:
- platform: esp32_rmt_led_strip
id: neopixel
rgb_order: GRB
pin: GPIO9
num_leds: 1
chipset: ws2812
name: "neopixel"
effects:
- pulse:
transition_length: 550ms
update_interval: 550ms
Hopefully if you’re stuck getting this board to work, this will get you started.