PWM ( Pulse Width Modulation ) is a square signal involves changes in the duration of the on time ( duty cycle ) . It can be easily generated by the PIC 16F84 . This PWM signal can be used in many applications ( for example : DC motor speed , LED brightness intensity , Mood Light Lamps ) .
PWM can be used when no DAC ( Digital-to-Analog Converter ) is available in the microcontroller chip or as a stand alone chip. The average DC voltage values are equivalent to analoge values as where you used DAC for motor speed control .
And for light brightness intensity , at high frequency , the blinking process is not observed by human eyes and what you see is only brightness intensity corresponding to the duty cycle ( time at which light is ON)
At longer duty cycle , LED is ON for longer time , so you see it brighter.
At shorter duty cycle , LED is ON for shorter time , so you see it less brighter.
The previous examples used constant duty cycles at each time which means constant brightness LED and constant speed for motor.
To make Mood Light LED, you need to change the duty cycle of the PWM signal by increasing and decreasing it back and forth.
You get this one .
You see this image still, just click it and save it to your PC you 'll see it animating ( PWM is variable ) .
I connected this circuit to the LED and it did just as I expected , it looked brighter then dimmed and then brighter again.
You can have the circuit and the code files from here.
If you need any help configuring the compilation settings for Hi-Tech and ISIS 7 , you can check the previous posts. If you need further help about code and hardware you are welcome to contact me.
If you like this blog you can support us by many ways:
1. Leave comments stating your point of view about this article.
2. Buy our book on Amazon Learn By Making.
3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices
Join Amazon Kindle Unlimited 30-Day Free Trial
Try Amazon Prime 30-Day Free Trial
Shop Amazon - Give the Gift of Amazon Prime
Try Audible and Get Two Free Audiobooks
Thank you for visiting our blog.