This color changer mixes light from high-power LEDs to create over 16 million colors. A smooth auto-fader cycles the colors, or it can be connected to a USB port for computer control. The device utilizes a well-known color model employed in televisions and LCD panels, blending red, green, and blue light to produce a wide spectrum of colors. The technique mimics the pixel structure of displays, which consist of tiny red, green, and blue dots. The dimming of LEDs is achieved through a method called pulse-width modulation (PWM), where the LED is turned on and off rapidly, varying the on and off time ratio to create perceived brightness. The signal is high (LED on) for a duration defined as the duty cycle, followed by a low signal (LED off) for the remainder of the cycle. Adjusting the duty cycle allows for the control of LED brightness, enabling the mixing of nearly infinite colors across the red, green, and blue channels.
The Microchip PIC 18F2550 microcontroller (IC1) is selected for this project due to its full-speed USB connection and a firmware framework that facilitates a generic serial port to USB emulator. It provides ample program space for advanced fading programs. Supporting components include a 0.1 µF capacitor between the power and ground pins (C6), along with a resistor and diode for the ICSP programming header (R7, D1). The on-chip USB peripheral necessitates two additional 0.1 µF capacitors (C7, C8) and a 20 MHz crystal (Q1), accompanied by two 27 pF capacitors for the crystal (C1, C2). The device is designed to run a color fading program independently when not connected to USB power, functioning as a self-powered device with an external power source.
To monitor the USB power line, one microcontroller pin is utilized. When a USB cable is connected, the PIC detects the voltage and activates the USB connection. The USB power line is interfaced with the PIC through two small resistors (R8, R9) to minimize noise and protect the microcontroller. Resistor values of 100K ohm and 10K ohm are recommended, although other close values may suffice. The PIC features two hardware PWM outputs suitable for fading LEDs, but three channels are required for red, green, and blue control. Instead of using a dedicated hardware PWM device, software PWM is employed to leverage the processing power of the PIC without incurring additional costs.
Since a microcontroller pin cannot directly power multiple LEDs, the PIC controls the LEDs through transistors or MOSFETs (Q2, Q3, Q4). The design incorporates a basic LED circuit along with switching circuits utilizing FETs and transistors. An IRLZ44 MOSFET is chosen for its suitability, although various options exist. It is imperative to select a FET that can fully switch at 5 volts or lower, as indicated in the datasheet, which typically includes a graph depicting operation over a range of gate-source voltages (Vgs). A FET with a minimum gate voltage requirement of 12 volts will not operate effectively when controlled by the PIC at 5 volts.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 crystal (C1, 2).
Crystals vary, but 27pF capacitors usually work. The device should continue to run a nice color fading program when the USB isn`t connected. This type of USB device is `self powered` - it has an external power source and runs independently of the USB connection. This setup requires one microcontroller pin to monitor the power line of the USB cable. When a cable is attached, the PIC senses a voltage and opens the USB connection. The USB power line is connected to the PIC through two small resistors (R8, 9), in order to cut down on noise and protect the chip.
I used 100K ohm and 10K ohm resistors, but any close values should work fine. The PIC has two hardware PWMs that could be used to fade LEDs, but we need a total of three channels - one each for red, green, and blue. We could use a hardware device, but with so much power in the PIC we can do it in software without the added expense.
A microcontroller pin is unable to power more than a few LEDs directly. Instead, the PIC will switch the LEDs with a transistor or MOSFET (Q2, 3, 4). This diagram shows a simple LED circuit, and switching circuits that use a FET and transistor. I used an IRLZ44 MOSFET, but there are many options. You should choose a FET that switches completely at 5 volts or less. The data sheet usually has a graph of operation over a range of switching voltages (Vgs). A FET with a minimum gate voltage of 12 volts will never turn on when switched by the PIC running at 5 volts. 🔗 External reference
Most cars lack delayed interior lights. The presented circuit addresses this issue by gradually switching the interior lights on and off. This feature facilitates activities such as locating the ignition keyhole after the car door has been closed. The...
This circuit operates at 73 MHz and is designed for controlling halogen lights through radio frequency remote control. The primary function is to toggle the power state of a halogen lamp. When the button on the remote control is...
This simple circuit drives six LEDs in a Knight Rider scanner mode. Power consumption primarily depends on the type of LEDs used, especially when utilizing a 7555 (555 CMOS version).
The Knight Rider scanner circuit is designed to create a...
This whistle light switch allows for the control of lighting installations. The primary component of this circuit is the UM3763 integrated circuit, manufactured by UMC. A piezo-ceramic buzzer serves as a microphone, detecting sound frequencies between 1.2 kHz and...
This device is a simple timer that keeps the headlights of a vehicle on for approximately 1 minute and 30 seconds, allowing access to dark areas without the need to manually switch off the lights. Activating switch P1 initiates...
The circuit comprises three main components. The first component features an oscillator, while the second component includes a mod 16 counter (7493). The oscillator is configured in self-triggered mode, and a potentiometer (VR1) is utilized for speed control of...
We use cookies to enhance your experience, analyze traffic, and serve personalized ads.
By clicking "Accept", you agree to our use of cookies.
Learn more