Xiao ESP32-C3 + 6x10 RGB MATRIX for XIAO + ESPHome troubles

Using:

I am trying to setup my XiaoC3+LED Matrix for control with ESPHome. I am able to talk to the LED matrix just fine using Arduino firmware. However, I have gotten nothing working with the ESPHome firmware–no progress after too many hours. Sad face. I do see my debug “.” being logged so the lambda routine is running but showing nothing.

My ESPHome YAML is below. Can anyone help me figure out how to the LED matrix working with ESPHome?

esphome:
  name: "led-matrix"
  friendly_name: LED Matrix
  platformio_options:
    board_build.flash_mode: dio

esp32:
  board: seeed_xiao_esp32c3
  variant: esp32c3
  framework:
    type: arduino
    platform_version: 5.4.0

logger:
  level: DEBUG
  #hardware_uart: UART0 # this causes firmware to fail to boot, pin overlap?

api:
  encryption:
    key: !secret api_key

ota:
  password: !secret ota_key

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

  ap:
    ssid: "led-matrix-fallback"
    password: !secret ap_key

captive_portal:

color:
  - id: YELLOW
    red_int: 6
    green_int: 3
    blue_int: 0
  - id: AMBER
    red_int: 6
    green_int: 2
    blue_int: 0
  - id: ORANGE
    red_int: 6
    green_int: 1
    blue_int: 0

light:
  - platform: neopixelbus
    name: "LED Matrix Light"
    id: led_matrix_light
    variant: WS2812X #WS2812 doesn't work either
    type: GRB
    num_leds: 60
    pin: 2 # pin 0 doesn't work either
    #method:
      #type: bit_bang #sp32_rmt
      #channel: 0
  # - platform: fastled_clockless # doesn't build, might be issue/bug
  #   name: "LED Matrix Light"
  #   id: led_matrix_light
  #   chipset: WS2812B
  #   rgb_order: GRB
  #   num_leds: 60
  #   pin: GPIO2
  # - platform: esp32_rmt_led_strip
  #   name: "LED Matrix Light"
  #   id: led_matrix_light
  #   chipset: ws2812
  #   rgb_order: GRB
  #   num_leds: 60
  #   pin: GPIO2
  #   rmt_channel: 0

display:
  - platform: addressable_light
    id: led_matrix_display
    addressable_light_id: led_matrix_light
    width: 6
    height: 10
    rotation: 0°
    update_interval: 500ms
    lambda: |-
          ESP_LOGD("custom", ".");
          Color yellow = Color(0x060300);
          Color amber = Color(0x060200);
          Color orange = Color(0x060100);
          // try these colors
          it.draw_pixel_at(0, 0, yellow);
          it.draw_pixel_at(1, 1, amber);
          it.draw_pixel_at(2, 2, orange);
          // try these colors too
          it.draw_pixel_at(3, 3, YELLOW);
          it.draw_pixel_at(4, 4, AMBER);
          it.draw_pixel_at(5, 5, ORANGE);

Hi there,
I’m thinking maybe try using the GPIO pin number

HTH
GL :slight_smile: PJ
:v:

You have a Picture?

I am using the GPIO number if you look at my yaml. The input pin for the LED matrix has to be GPIO2/A0/D0 (the upper-left-most pin in the image). I’ve tried “GPIO2”, “2”, and “0” to no effect.

The wiki page specifies “A0” in the Arduino code, though both “GPIO2” and “2” work as well for me (with Arduino firmware):
Getting Started with 6x10 RGB MATRIX for XIAO | Seeed Studio Wiki

Thanks for the suggestion!

1 Like

OK. Sat on this a bit, revisited, added each ESPHome component one by one, and was able to come up with a working config. Here’s what I ended up with:

light:
  - platform: esp32_rmt_led_strip
    internal: True
    id: led_matrix_light
    chipset: ws2812
    rgb_order: GRB
    num_leds: 60
    pin: GPIO2
    rmt_channel: 0
    color_correct: [30%, 30%, 30%]
    restore_mode: ALWAYS_ON
    
display:
  - platform: addressable_light
    id: led_matrix_display
    addressable_light_id: led_matrix_light
    width: 6
    height: 10
    rotation: ${rotation}
    auto_clear_enabled: false
    lambda: |-
      <a bunch of code>
1 Like