0
\$\begingroup\$

I am planning to change the brightness of an LED using a PIC 16F877A. I get suggestions that the brightness can be changed by changing the time interval between two pulses. But the brightness of the LED depends on its power, and that depends only on voltage and current (which we can't change in the PIC controller). Please explain how this works, or if the suggestion is wrong please suggest some other ideas.

\$\endgroup\$
  • 1
    \$\begingroup\$ You can change the intensity level using pulse width modulation. \$\endgroup\$ – S Andrew Jan 18 '17 at 12:45
  • 1
    \$\begingroup\$ It's called Pulse Width Modulation, you adjust how long the LED is on compared with how long it's off, the higher on time : off time the brighter the led is. \$\endgroup\$ – Colin Jan 18 '17 at 12:59
  • 1
    \$\begingroup\$ The visual brightness of an LED (to a human eye) is more-or-less dependent on the average LED current (if you pulse it fast enough -preferably hundreds of Hz or a bit more- you can turn a given fixed current on and off and get variable apparent brightness with just a single switching device). \$\endgroup\$ – Spehro Pefhany Jan 18 '17 at 14:13
3
\$\begingroup\$

Look up something called pulse width modulation, usually abbreviated PWM.

With PWM, you always switch the LED either full on or full off. However, you do this so fast that a human looking at the LED only perceives the average brightness.

It only takes a few 10s of Hz to get to the point where you can't see the individual pulses when looking directly at the LED. However, it will still flicker noticeably when you move your eyes. It is usually good to use a few 100 Hz minimum PWM frequency for brightness-adjusting LEDs. You can also soften the on/off transitions with added electrical components like capacitors and inductor.

The 16F877 has PWM generators built in. Take a look at the CCP modules. Once a CCP module is set up, all the firmware has to do is write a new duty cycle into the right register or registers to set the brightness.

\$\endgroup\$
0
\$\begingroup\$

By changing how the relative duration of turning the led on and off (own), you change its brightness perceive by human eyes.

\$\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.