Smoother ESPHome light transitions?

Hello, I have a light component that is outputting to a special 16 bit output device. When I set the transition length to 2s, it appears choppy, and I’m seeing steps of size 30-80. I’d like to see more, smaller steps. How can I do this?

Do you mind telling us anything about the hardware you are using? :face_with_monocle:

Maybe a esp82xx with software pwm?

Note that this is a software PWM, so there can be some flickering during periods of high WiFi activity. Hardware PWMs like the one on the ESP32 (see ESP32 LEDC Output) are preferred.

Or by chance a esp32 with hardware pwm?

And what about your yaml? How does that look like? What frequencies are you using? So many questions… :thinking:

Good read btw. :point_down:

I am using GitHub - andyboeh/esphome-dmx512 this DMX output component to control a 16 bit dimmer. I am just seeing fewer and larger steps than I expect (on the order of 200 units per step). This causes my DMX led driver to not appear smooth on the transition. Is there a parameter I’m missing in the documentation for Light or Output that would give me more frequent, smaller steps during the transition? I haven’t found any parameter like that.

How can we know? :man_shrugging:

One link posted previously hosts a table with “Recommended frequencies” including bit depth and available steps for transission. Thing is for now we don’t even have a clue what hardware you are using and if you can make use of the hardware pwm at all :see_no_evil:

I am asking about whether, in the root object for Light or Output: are there parameters, like Gamma, but which control the step size of the floating point interpolation. I do not want help with the hardware, only software parameters I may not be aware of.

This has nothing to do with pwm.

Sounds like it’s content of docs previously linked in this thread :point_down:

Recommended frequencies

To get the highest available frequency while still getting the same bit depth it is recommended to pick one of the following frequencies.

Higher bit depth means that the light has more steps available to change from one value to another. This is especially noticeable when the light is below 10% and takes a long transition, e.g. turning slowly off.

Frequency Bit depth Available steps for transitions
1220Hz 16 65536
2441Hz 15 32768
4882Hz 14 16384
9765Hz 13 8192
19531Hz 12 4096

The ESP8266 for instance has usually a frequency of 1000Hz with a resolution of 10 bits. This means that there are only 4 steps between each value.

And as said it differs greatly depending of which hardware (esp82xx VS esp32) is used :bulb:

1 Like

As I wrote and repeatedly stated, I’m not using an ESP PWM. That table doesn’t apply at all.

I am using a Monochromatic Light to the Template Output described in this link: GitHub - andyboeh/esphome-dmx512

So I’m looking for parameters that can be used with Monochromatic Light or Template Output to reduce the step size during transitions.

light:
  - platform: monochromatic
    name: "Test Lights 1"
    output: dmx_1
    id: light_test1
    default_transition_length: 2s

output:
  - platform: dmx512
    channel: 12
    universe: dmx
    id: dmx_A_coarse
  - platform: dmx512
    channel: 13
    universe: dmx
    id: dmx_A_fine
  - platform: template
    id: dmx_1
    type: float
    write_action:
      - lambda: |-
          int lvl = static_cast<int>(state*65535.0);
          uint8_t low = lvl & 0xff;
          uint8_t high = (lvl >> 8);
          id(dmx_A_coarse).set_level(high/255.0);
          id(dmx_A_fine).set_level(low/255.0);

I believe the step size is determined by the transition length. 2s seems like it would be enough for a smooth transition though. I’d ask in the discord server where the esphome devs hang out or better yet, ask the person who’s repo your using.

Idk what type of lights your using but some lights just don’t do well with dimming and have a limited range

1 Like

It would have been great to see this snippet in your first post or at least second post after your yaml was requested. :page_facing_up:

Please take the time to read how to ask a good question so you can get quicker help in the future :point_down:

As the docs state all possible parameters is it as easy to hit this both links :point_down:

to find out their is not much to tweak for you. :man_shrugging:

You might want to contact the author of the custom component you are using :point_down:

After a very quick look it doesn’t seem like esphome is actually involved to much in the dimming and like @Fallingaway24 is stating it just might be your lights (or dmx) is the limiting factor :thinking:

If you are using a custom component, ask the author!

1 Like

that was suggested multiple times already, try to follow along with the conversation.

If you use i2c converter like PCA9685, try to put higher i2c frequency (frequency: 100kHz). This solved the problem in my case.