Close

PWM frequency in Shelly RGBW2 controller

teardownitteardownit wrote 03/24/2024 at 08:08 • 4 min read • Like

I received an interesting email from a reader of my post:
https://teardownit.com/posts/shelly-rgbw2-controller-and-shelly-duo-rgbw-bulb-dangerous-light-pulsations

=====
After having some bloody eyes and reading your article I decided to change the firmware on shelly rgbw2 with ESPHome so I can modify the pwm freq to 1500 Hz like you recommended.
Don't know if placebo or not but I feel better :) .

I can test only with camera from phone with shutter speed at 1/1500 and no flicker (and sub multiples like 1/500).
With PWM freq at 600 Hz I could see flicker on camera at anything above 1/600.

Don't know if this is the same you have tested but I was curious if you can test with a modified Shelly with ESPHome to be able to put higher frequency.
I also don't know if there is a limit on the maximum frequency  (the shelly or the COB LED strip it's dimming ) it will work and if is there any benefit in increasing any further.

Thank you for publishing this extensive tests online.
Ciprian

=====

Great news!

I was very interested and read the ESPHome firmware description.
https://esphome.io/components/output/esp8266_pwm.html
Perfect!

I have not previously used ESPHome, but I have been actively using Tasmota for a long time. In this firmware I also found PWM frequency adjustment:
https://tasmota.github.io/docs/Commands/#pwmfrequency

Let's do the tests!

The measurement scheme is simple.


1. Old Shelly native firmware.

I found a new old Shelly RGBW2 controller with 2021 firmware in my stock.

Measurements are taken at 25% brightness. The PWM controller is running at 600 Hz.

2. New Shelly native firmware (20230913-131259/v1.14.0-gcb84623).

The PWM controller operates at 1000 Hz for a brightness of 25%.

3. Tasmota firmware.

Firmware installation is easily done without wires and additional devices using OTA.
Manual: https://github.com/arendst/mgos-to-tasmota

However, I couldn't use this script and found many errors mentioned for this device.

The solution is found right here:
https://github.com/yaourdt/mgos-to-tasmota/issues/102

This is my successful script:

  1. RGBW2 must be set to Color mode. You do not need to do anything if the device is already in this mode.
  2. The firmware needs to be downloaded from this link:
    http://deviceIP/ota?url=http://dl.nekohell.eu/mg2tasmota-ShellyRGBW2c.zip
  3. Once the WiFi network is configured, you need to use two commands through the Tasmota console (changes will be saved after rebooting or shutting down the device):
    SetOption68 1 // The device will switch to 4-channel white mode (if you need it)PWMFrequency 2000 // PWM frequency will increase to 2000 Hz

Configuration for Tasmota and additional information:
https://tasmota.github.io/docs/devices/Shelly-RGBW2/

I set the PWM frequency by a multiple margin (I was just curious). 4000 Hz.

The optical measuring tool showed an incomprehensible picture for me. But this phenomenon is outside the scope of this post, and I will deal with it later.

Conclusions.

  1. The Shelly device manufacturer can change and does change the PWM frequency in their firmware. I really don't understand their answer about not being able/unwilling to change the PWM frequency to a safe level.
  2. I am very grateful to Ciprian for the excellent advice. Thank you, Ciprian!
Like

Discussions