-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flicker at 50% :-( #9
Comments
same here |
|
|
Can you please clarify the second answer? |
i test it again: |
no videos, please. Just describe, step by step, what you are doing, and what results you have, e.g.:
|
yes! - your's describe is correct |
i think it's because at the 50% pwm you just invert signal... but this inverse have destroy smoth regulation... :-( |
What do you mean by flicker? A single flash? Or constant flickering? |
sorry - single flash only |
Hi, I have the problem with a single flash when passing the 50% also. Example with 2 channels: Kind regards, Uwe. |
Do you use a selfbuilt board or something from the shelf? I can not reproduce it, and am suspecting a hardware specific issue. |
Hello Stefan, Both sets are OK and create exact the duty cycles which are defined. But if we have a look at channel 2 when switching pwm sets (finish cylce after pwm_start) we see this (duration/output state): Condition 2 - 2 channels have nearly the same duty cycle which is > 16: Both sets are OK and create exact the duty cycles which are defined. But if we have a look at channels 0,1,4 when switching pwm sets we see this: Following changes are necessary to get rid of these flickering/flashes:
Positive effects:
Unfortunately this will have negative side effects:
I wonder why you could not reproduce these problems when they are clearly visible in debug outputs and also on the LEDs (also in source code). Kind regards, |
Hi Uwe, I am completely aware of the calculations, and also the fact that the phase mirroring extends the pulse length when crossing the 50% setting. At a PWM frequency of 250Hz, the pulse scheme is changed from 2ms low/2ms high/2ms low/2ms high to 2ms low/4ms high/2ms low. From a human vision standpoint, double the luminous flux does not equal double the perceived brightness. There is a tradeoff between the the length of a flash and its intensity to be noticeable. If you can notice a brightness increase, either the pulse is longer than 4ms, or the brightness increase is more than intended. Depending on the MOSFET and the driver strength, you may not be switching the MOSFET fully on with a 2ms pulse, but do with a 4ms pulse, increasing the power from e.g. 20% to 100%, instead of the expected 50% to 100%. None of you proposed changes is applyable in general:
The term "inversion" is also not good to describe the effects, you better used "phase shifting". The maximum phase shifting happening for any duty cycle below 50% is 3us, less than 1% of the cycle of a 250Hz PWM, which is completely irrelevant. When crossing 50% duty, there is a one-time phase shift by 2ms between consecutive pulses which might be relevant. Feel free to come up with a pulse scheme under the following constraints:
|
Hi, I use IRLML2502 MOSFET which is a very fast switching Ultra low On-Resistance MOSFET. I added a 180Ohm resistor in the signal line to limit the gate current. This Setup should work well. I removed the 50% Phase switching, the "shift left to align right edge" and the cyclic shift if last phase is short. Then I added the check for restart PWM cycle to the while cycle (only executed if current PWM phase is shorter then 16 ticks). With this modifications a get a smooth Fading between 0 and 100% and also when randomly cross fade all 5 channels (which produced flickering when diff between duty cycles are < 16). The PWM is not affected by my main application (include httpd, oled Display, color calculation). The execution time of the pwm_intr_handler is only longer (if Statement with 2 expressions) if we have a PWM phase which is shorter than 16 ticks. Kind regards, |
Now set your 5 channels to 12, 24, 36, 48, 60 ticks duty, and measure the duty of the fifth channel, it will be well beyond 60 ticks ... |
As there are no new posts and the problem still exists, @UweHeinritz I would like to try your changes in my project, maybe it'd solve the flickering. Can you fork this repo and publish your changes? That would be awesome. |
Hello Stephan, |
Thanks Uwe, it works and looks good at first glance. 🥇 |
i have flicker at 50% pwm!
if range=10000 than
pwm from 4998 to 4999 ok but from 4999 to 5000 flicker :-(
The text was updated successfully, but these errors were encountered: