PWM Mood Light using PIC 16F84


Generating PWM signal using PIC 16F84

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 .

Note :

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.


Leave a Reply

Your email address will not be published.