Browse over 10,000 Electronics Projects using the Page Numbering provided at the bottom of each Page.

Fading RGB LED

Fading RGB LED

An RGB LED is a LED which has three LED is integrated in one packaging. These LED is have the colors red, green, and blue. Such a LED costs about 1 Euro. With these three colours you can mix to any colour.
When using 8-bit PWM a number of 256 * 256 * 256 combinations can be made, thus the LED can show 16.777 million colours, and 256 different brightnesses. When all the three LED’s are at full brightness the color will be white.When they are all off the color will be ‘black’ in the dark ;).

The RGB LED used here has four leads, one for each color an one for the common cathode(ground). The Red LED operates on a voltage of 2 V, Green needs 3.5 V, and the Blue LED needs also 3.5 V. Each LED draws 20mA current, so the maximum current consumption is 60mA.

The circuit is very simple.The RGB LED is hooked up to the PWM outputs on PORTB1, PORTB2 and PORTB3 of the ATMega8. There is also a resistor between theb LED and the ATM8 to limit the current to 20mA. There is also a link to the datasheet of the RGB LED that is used in this project

The code for the fading LED is written in assembler with the AVR Studio 4. In this example the LEDs will fade in and out one by one. The PWM timers of the ATMega8 are used to let the LED’s fade in and out. To use the PWM timers you first need to initialize the timers at the begin of the program code. The speed of the fading in and out can be changed with changing the clock speed of the ATM8.You can copy and paste the textfile into the AVR Studio 4

Visit Here for more.