1
\$\begingroup\$

I am using a PIC18F452 micro-controller to generate PWM with ADC. The PWM output is connected to an LED through a MOSFET. There is some flicker occurring. How can the flickering be reduced?

can you provide a circuit for this led brightness control?

\$\endgroup\$
  • 5
    \$\begingroup\$ We will need more information to help. You should update your question and post a schematic, or photo of a schematic, and the code. \$\endgroup\$ – gbulmer Aug 21 '14 at 11:12
  • 4
    \$\begingroup\$ Most likely cause is PWM frequency too slow, it must be 50Hz or faster to appear steady. \$\endgroup\$ – John U Aug 21 '14 at 11:16
  • \$\begingroup\$ Or even higher if the object is moving. \$\endgroup\$ – s3c Aug 21 '14 at 11:46
  • 3
    \$\begingroup\$ Hey @Demetris, thanks for the edit! But when you are editing posts, make sure you fix the title, too. See my edit. That's easy to miss because the title sits up there, away from the message body. It takes a while for us editors to automatically do it. Thanks for the edit again!! \$\endgroup\$ – Ricardo Aug 21 '14 at 12:56
  • 1
    \$\begingroup\$ @Ricardo you are right I missed it! I will have it in mind for the next time. \$\endgroup\$ – Demetris Aug 21 '14 at 14:07
1
\$\begingroup\$

No schematic or code so this answer is a little generic, though the same question can be encountered with completely different code and schematic.

As John U. suggested, see if you can increase the PWM frequency or possibly use a different algorithm. This stackoverflow post suggests an approach. Trade-offs can be made between levels of brightness and period.

If this doesn't reduce the flicker enough, try adding an RC filter between the PWM output and the MOSFET gate to smooth the waveform.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.