every pic tutorial has a lesson about using pwm to vary the intensity of a led, but i couldn't find something that explained how it works in theory. Recently someone has posted a message suggesting to use pwm to get an analog voltage. How does that work? Let's say i send a square wave to resistor-led, does the intensity of light depend on the duty cycle of the wave? And if yes, is it just for an optical effect, or there is some electrical law behind it? in the latter case, what would be a general method to obtain an analog voltage through it? i know they are very stupid questions, sorry for that and thank you in advance for any enlightening answer :)
There are no stupid questions! With the LED, your eye is interpreting a
quickly flashing light as continuous. Further, your eye interprets the
duty cycle as a variation in brightness of the LED.
A unipolar PWM signal (ie, 0V to 5V) has a DC component that is the duty
cycle times the peak voltage. A low pass filter attenuates the AC
component (above the cutoff frequency), leaving the DC component. By
choosing your PWM frequency and cutoff frequency (and sharpness of the
filter), you can adjust the PWM to generate a low frequency (relative to
the PWM frequency) analog voltage.
> analog voltage through it? i know they are very stupid questions, sorry
> that and thank you in advance for any enlightening answer :)
FCC Rules Updated Daily at http://www.hallikainen.com
More... (looser matching)
- Last day of these posts
- In 2005
, 2006 only
- New search...