[solved] How to configure these simple single, oldskool RGB LEDs?

I'm trying to add this kind of LED

to a Wemos S3 mini but I cannot figure out how to configure it.
It's a common cathode type and I have put 200Ohm resistors on the anodes so I guess that part is OK.

EDIT: the solution was given by @Karosm and this post shows the full code

EDIT 2: the code for a Lolin D1 mini (esp8266) is in this post

1 Like

Cathode to GND and anodes to gpio pins via resistors. On your code make LEDC outputs for those gpios and RGB light component to control outputs.

1 Like

Hi guys, thanks for helping out!

I was already searching for hours but couldn't find what to use for coding.
Just now, I got it working like this:

output:
  - platform: ledc
    pin: GPIO16
    id: gpio_16
  - platform: ledc
    pin: GPIO18
    id: gpio_18
  - platform: ledc
    pin: GPIO35
    id: gpio_35      

light:
  - platform: monochromatic
    output: gpio_16
    name: "Blue Light"
  - platform: monochromatic
    output: gpio_18
    name: "Green Light"
  - platform: monochromatic
    output: gpio_35
    name: "Red Light"

Although I like ESPHome very much as a technology but TBH, I still don't know if this is the right and only way for this kind of LED and I struggle each time when trying something new... :blush:

It's more "common" to use single RGB-light component than multiple mono.

2 Likes

Like @Karosm said - use a single light component:

output:
  - platform: ledc
    pin: GPIO16
    id: gpio_16
  - platform: ledc
    pin: GPIO18
    id: gpio_18
  - platform: ledc
    pin: GPIO35
    id: gpio_35      

light:
  - platform: rgb
    name: "RGB Light"
    red: gpio_16
    green: gpio_18
    blue: gpio_35

Anyone knows what is needed to make this work on a D1 mini (esp8266)?

Just replace LEDC outputs with:

output:
  - platform: esp8266_pwm

It's software pwm though...

You are quick on the ball! :person_bowing:

The code for a Lolin D1 mini (esp8266)

output:
  - platform: esp8266_pwm
    pin: GPIO12
    id: gpio_12
  - platform: esp8266_pwm
    pin: GPIO13
    id: gpio_13
  - platform: esp8266_pwm
    pin: GPIO15
    id: gpio_15

light:
  - platform: rgb
    name: "LED"
    id: rgb_led
    red: gpio_12
    green: gpio_13
    blue: gpio_15  

What does that mean 'software pwm'?

Esp8266 doesn't have dedicated peripheral for PWM like esp32 has. So it's using cpu resources and has some limitations compared to LEDC.

1 Like