Make a USB color changing light
Posted on Feb 5, 2014 3884
This color changer mixes light from high-power LEDs to create more than 16 million colors. A smooth auto-fader cycles the colors, or you can hook it up to a USB port and control it from your computer. This color changer borrows a well-known color model used in TVs and LCD panels. These displays blend red, green, and blue light to create a vast num
ber of colors. Look closely at your monitor - this image of the DIY Life site is made of tiny red, green, and blue dots. We`ll mimic this technique by mixing light from red, green, and blue LEDs. The easiest way to dim LEDs is to blink them and vary the ratio of on and off time. If the LED blinks fast enough, we perceive it as a solid light of lower intensity. This method of dimming is known as pulse-width modulation (PWM). The figure below shows a single period in a pulse-width modulation cycle. At the start of the period, the signal is high (the LED is on) for the time defined as the duty cycle. When the duty cycle is finished, the signal goes low (the LED is off) for the remainder of the period. Adjusting the duty cycle varies the brightness of the LED. By extending this to red, green, and blue channels, we can mix a nearly infinite number of colors. I chose the Microchip PIC 18F2550 as the microcontroller for this project (IC1). It has a full-speed USB connection and a free firmware framework for a generic serial port to USB emulator. It`s got a ton of program space for fancy, stand-alone fading programs. As far as support gear goes, we need a 0. 1uF capacitor between the power and ground pins (C6), and a resistor and diode are needed for the ICSP programming header (R7, D1). The on-chip USB peripheral requires an additional two 0. 1uF capacitors (C7, 8) and a 20 MHz crystal (Q1)- don`t forget two 27pF caps for the...