Skip to content

Unsynced PWM causes LED flickering #7054

Closed
@s-hadinger

Description

@s-hadinger

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: All ESP8266/8265 based
  • Core Version: 2.6.1
  • Development Env: Platformio
  • Operating System: MacOS

Settings in IDE

  • Module: Generic ESP8266 Module
  • Flash Mode: DOUT
  • Flash Size: 1MB
  • lwip Variant: v2 Higher Bandwidth
  • Reset Method: ?
  • Flash Frequency: ?
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 115200

Problem Description

For several months, some Tasmota users reported LED flickering when set at low brightness. The flickering is subtle but noticeable. The PWM values are set with analogWrite() and left unchanged.

The problem occurs with core 2.5.x and 2.6.x but did not occur with 2.4.x.

I finally took a scope and found the cause of the issue.

Setup:

  • Wemos D1 mini, with 3 GPIOs (4,5,12) set as PWM.
  • PWM frequency: 880Hz
  • PWM range: 0..1023
  • PWM1=5, PWM2=10, PWM3=3

Below are traces for PWM1 and PWM2, taken at different moments:
scope0
scope1
scope2

PWM pulses are most of the time happening almost at the same time, but regularly they get desynchronized (3rd screenshot) and get back to sync after a fraction of seconds.

Although the timing of the pulses are correct, the power supply of LED drivers are not perfect and draining current at different moments cannot be compensated by the capacitor.

For led drivers with high current, could we have PWM ensure that pulses are synced again? I will take a look at the waveform generator in between.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions