CO2 Ampel with WS2812b Ring

I am stuck and dont see why this esp config is not working.
Could need some help.
Compiling with esphome works finde, MHZ19 readings are fine and working, too. BUT the WS2811b led ring just turns on bright white and does not change the color according to the on_value_range definitions.

esphome:
  name: co2ampel
  platform: ESP32
  board: esp32dev
        
wifi:
  ap:
    ssid: "CO2 Hotspot"
    password: "blablabla"     

captive_portal: 

logger:

ota:           

api:
  services:
    - service: mhz19_calibrate_zero
      then:
        - mhz19.calibrate_zero: co2sensor
uart:
  rx_pin: GPIO16
  tx_pin: GPIO17
  baud_rate: 9600

sensor:
  - platform: mhz19
    co2:
      name: "CO2 Konzentration"
      id: co2werte
      on_value_range:
        - below: 1200
          then:
            - light.turn_on: 
                id: ring_co2
                brightness: 50%
                red: 5%
                green: 100%
                blue: 5%
        - above: 1200
          then:
            - light.turn_on:
                id: ring_co2
                brightness: 50%
                red: 5%
                green: 100%
                blue: 100%
        - above: 1800
          then:
            - light.turn_on:
                id: ring_co2
                brightness: 50%
                red: 100%
                green: 5%
                blue: 5%
    temperature:
      name: "MH-Z19 Temperature"
    update_interval: 60s
    automatic_baseline_calibration: false     
    id: co2sensor     

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: GPIO23
    num_leds: 12
    rgb_order: BRG
    name: "FastLED Light"
    id: ring_co2
    restore_mode: ALWAYS_ON

    

  
1 Like

Not sure, but given that you’re using addressable LED’s, try using light.addressable_set instead of light.turn_on

Thanks, but nope. Did not help

I assume you have ruled out any obvious issues, like GPIO23 not being correct. Instead of fastled_clockless, have you tried neopixelbus? How are the LED’s powered?

Yep, tried several gpios and connected correct. Also tried neopixelbus but with neopixelbus lights don’t turn on at all. Power is with 3.3v from the esp and they Turn on. But not changing the color accordingly.

Hi Jensen,

I posted looking for help with my WS2812Bs here not long ago. Still looking for help but you may find something useful in my post. Your last comment indicates you are using 3.3v for power to the pixels if I understand you correctly. I think these are rated for 5V. They might work ok at 3 but a lot dimmer and likely not full 8 bit resolution. You can get away with using the 3.3V GPIO to provide data even with 5V led power. I use a 200 Ohm or so resistor in series with gpio pin and if you like a pair of switching diodes to 3.3v rail and ground on the controller side of the resistor to keep ringing in check. Better if the diodes switch fast than handle more current since there is very little current involved. This is not like driving a relay coil.

Q

If your ESP device is USB-powered, the 3.3V will come from a regulator, which might not be specced to deliver the mA’s required for the LED’s.

Try powering them from the 5V pin instead. Like @Quanta says, WS2812B’s are 5V-devices; officially, the power supply range is 3.5 to 5.3V, so 3.3V is outside of the spec. Input voltage (for the data pin) can be lower, so it’s not a problem to drive them from a 3.3V GPIO pin.

Hi, I have a very simular Projekt. But i do it with some automations for each ESP so i can set a Slider for the value_ranges. But in the automations light.turn_on is a service and i must setup like this to work in the automation, otherwise the LED turn on white like yours. Maybe it is the same in the esp.yaml´s

alias: Beta GS
description: ''
trigger:
  - platform: time_pattern
    minutes: /1
condition:
  - condition: numeric_state
    entity_id: sensor.beta_co2_equivalent
    below: input_number.schwelle_gelb
action:
  - service: light.turn_on
    entity_id: light.beta_rgb
    data:
      brightness: 255
      rgb_color:
        - 0
        - 255
        - 0
mode: single