Summary of Pic RGB color generator using PIC12F629
The PIC RGB project uses a PIC microcontroller to generate and fade random RGB colors on an RGB LED at different speeds using integer math. It operates via a simple circuit including a PIC12F629 or PIC12F675, a voltage regulator, resistors calculated for LED current limits, and a push-button to switch modes. Enhanced versions support higher power LEDs and infrared control. The design features a compact PCB created with Eagle, suitable for small PICs with 1 Kword flash and two timers.
Parts used in the PIC RGB:
- PIC12F629 or PIC12F675 microcontroller
- 78L05 voltage regulator
- Decoupling capacitor
- Resistors (150 ohm, 82 ohm, 82 ohm)
- RGB LED
- Push-button switch
- PCB (designed in Eagle)
Description
PIC RGB is a circuit that generates random RGB colors using a RGB LED and fades between them. The idea for this circuit came from the candle simulator [1] and another project called TinyRGB [2] .
The challenge was to create an algorithm that could fade 3 independent colors at different speeds in the same time interval, using integer math, (of course).
There are other enhanced versions of this project named Pic RGB Power board and Pic RGB Power board with Infrared remote control. Both circuits drive a powerful 3W Prolight RGB LED.
Design and Implementation
The PIC may be any small 12F***, as long as they have 1KWords of flash and two timers. Below at the downloads section are two hex files for PICs 12F629 and 12F675 [3].
Schematic
Basic schematic includes a voltage regulator 78L05, the PIC with a decoupling capacitor and a few resistors.
Since each PIC pin can supply a maximum of 25mA of current, and the LED specification indicates a maximum of 25mA, the LED resistors were calculated to provide 20mA of current in each color.
Vred = 2.1V, Vgreen=3.4 and Vblue=3.5V
R=V/I
Rred = 145 Ohm -> 150 Ohm
Rgreen = 80 Ohm -> 82 Ohm
Rblue = 75 Ohm -> 82 Ohm
The push-button switches between running modes, random and sequence.
PCB
The PCB and Schematic were created using Eagle from Cadsoft and are available below at the downloads section. Click on the image below to expand it and have a look at the top placement information.
Note: PIC pin1 is the lower right one.
For more detail: Pic RGB color generator using PIC12F629