LED Rainbow – RGB LED Controller

Dedicated Pulse Width Modulation (PWM) LED Controller

LED Rainbow RGB Controller - 3 Channel LED Effects Controller

The LED Rainbow is a dedicated Pulse Width Modulation (PWM) controller that generates color-changing effects with RGB LED lighting products. The circuit controls three outputs, each of which can run an LED segment. The three separate outputs are natural for the control of RGB LED arrays.

LED Rainbow Sequences are fully customizable and contained in the microcontroller, which can strobe, cycle, and fade the lighting, creating an extensive palette of over 16 million colors using Pulse Width Modulation (PWM) technology. Each output has a resolution of 8-bits, which gives each color a range of 256 intensities, and with three-color mixing, a full rainbow of color combinations is possible.

With a minimal parts count, the LED Rainbow is very economical for the hobbyist to build, using industry-standard components. Power is from a standard 12v-15v DC energy source. The 2″ (51mm) square board is a double-sided construction with a detailed silk-screen that aids in the placement of the components.

LED Rainbow Video

Want to see the LED Rainbow in action? Posted on YouTube is a video of the controller running one of our LED MR16 RGB display boards, holding four RGB LEDs, and housed in a standard household frosted lamp globe. The assembly time of this project was about one hour, and the results are amazing to see and produce a bright, shadow-free show. We have seen our LED Rainbow incorporated into other lighting products also, including acrylic displays for edge lighting.

We have an Instructable, which is a very detailed construction guide of the LED Rainbow. The Instructable walkthrough of the complete assembly process of one of the systems and can be completed by even a beginner at electronics in about 30 minutes.

We provide additional code for the LED Rainbow, and we encourage you to visit our site often to view the different coding sequences we develop. All are fully downloadable for free and to program into your PIC processor (providing you have a PIC programmer). Additional detailed support, including coding information, is also on our support website to assist you in creating your effects.

LED Rainbow Options and User Guides

The LED Rainbow is available as a fully assembled and tested product, as a kit of components you can build at home, or just the bare board which you can supply the parts. The average assembly time of the package by a novice builder is less than one hour.

You can download the complete Instruction Manual with a construction guide, schematics, and detailed assembly instructions. Are you looking for the user guide for a previous version of the LED Rainbow? The User Guide for both version 2 and version 1 model is available for download.

Display Sequences

The LED Rainbow contains a pre-built set of routines. The initial public release of the firmware was version 2.0 includes over 30 fades, flashes, and color combinations. Version 3 of the firmware now contains over 50 different sequences.

New in version 3, in addition to the additional sequences, is the placement of “markers.” Markers allow you to quickly visually determine where in the list of sequences you are located. They are positioned every ten sequences, and there is a unique sequence that blinks out the current location. For example, if you were on display 30, the LEDs would flash three times; and the same for positions 10, 20, 40, and 50, with one blink for every ten positions. The exception to this is the sequence located at position 60. Sequence 60 is the last usable sequence and is not a place marker. The sequence located at position 61 (the last sequence on the chip) is used to identify the version of firmware, which will blink just the green channel three times (for version 3 of the firmware).

Pressing the Mode (S1) button selects each effect. The LED Rainbow will remember the last sequence you were using after 10 seconds of viewing, which, when powered on at a later date, will automatically start with your last displayed sequence.

We have attempted to describe the various effects below, but the descriptions cannot describe just how good the LED Rainbow displays the combinations. We encourage you to use the chart as a reference. The version 3 firmware is available for immediate download from the Programming page.

Sequences Included In The Version 3 Firmware

  1. Slow fade all colors to 25% intensity and fade back down
  2. Slow fade all colors to 50% intensity and fade back down slower
  3. Slow fade of all colors up to 50% intensity with slow fade down low intensity
  4. Very slow fade of all colors to 50% intensity with slow fade back down very low intensity
  5. Very slow fade of all colors to 50% intensity with even slower fade back down very low intensity
  6. Slow fade of all colors to 50% intensity with faster fade back down to fully off
  7. Slower fade of all colors to 50% intensity with faster fade back down to fully off
  8. Red full intensity, slow fade to off; Green full intensity, slow fade to off; Blue full intensity, slow fade to off
  9. Slow fade of Red to full intensity, slow fade to off; Slow fade of Green to full intensity, slow fade to off; Slow fade of Blue to full intensity, slow fade to off
  10. Position Marker: Position 10 (1 blink of all LEDs)
  11. Slow fade of Red on, slow fade of Green on, slow fade of Red off, slow fade of Blue on, slow fade of Green off, slow fade of Red on, slow fade of Green off
  12. Slow cycle of fade between rainbow of color, various combinations of Red, Green and Blue on/off at various intensities
  13. Full Red, 100% intensity
  14. Full Green, 100% intensity
  15. Full Blue, 100% intensity
  16. Purple: Red and Blue combination
  17. Orange: Red and Green combination
  18. Bright White: Red, Green and Blue combination
  19. Half White: Red, Green and Blue combination
  20. Position Marker: Position 20 (2 blinks of all LEDs)
  21. Low White: Red, Green and Blue combination
  22. Full color spectrum fade
  23. Slower full color spectrum fade
  24. Slow warm color spectrum fade
  25. Cool color spectrum fade
  26. Purple color fades
  27. Red, Green, Blue cycle at 50mS rate
  28. Red, Green, Blue cycle at 100mS rate
  29. Red, Green, Blue cycle at 200mS rate
  30. Position Marker: Position 30 (3 blink of all LEDs)
  31. Red, Green, Blue cycle at 300mS rate
  32. Red, Green, Blue cycle at 400mS rate
  33. Red, Green, Blue cycle at 500mS rate
  34. Red, Green, Blue cycle at 1000mS rate
  35. Slow flashing Red
  36. Slow flashing Green
  37. Slow flashing Blue
  38. Red to green wig-wag 100ms each color on
  39. Red to green wig-wag 150ms each color on
  40. Position Marker: Position 40 (4 blinks of all LEDs)
  41. Red to green wig-wag 200ms each color on
  42. Double flash red, pause, double flash green, pause and repeat (100ms on, 150ms off)
  43. Double flash red, pause, double flash green, pause and repeat (150ms on, 200ms off)
  44. Triple flash red, pause, triple flash green, pause and repeat (100ms on, 150ms off)
  45. Triple flash red, pause, triple flash green, pause and repeat (150ms on, 200ms off)
  46. Dark blue to purple throb
  47. Light blue to purple, slow throb
  48. Pastel colors morphing
  49. Full spectrum fade over 1.27 seconds per color, hold color for 50mS
  50. Position Marker: Position 50 (5 blinks of all LEDs)
  51. Full spectrum fade over 2.50 seconds per color, hold color for 50mS
  52. Full spectrum fade over 5.10 seconds per color, hold color for 50mS
  53. Full spectrum fade over 10.2 seconds per color, hold color for 50mS
  54. Full spectrum fade over 1.27 seconds per color, hold color for 100mS
  55. Full spectrum fade over 2.50 seconds per color, hold color for 100mS
  56. Full spectrum fade over 5.10 seconds per color, hold color for 100mS
  57. Full spectrum fade over 10.2 seconds per color, hold color for 100mS
  58. Purple pulsing
  59. Lime-green pulsing
  60. Orangey pulsing
  61. Firmware Version Marker: 3 Flashed of Green

Programming

12F683 Processor As Used On The LED Rainbow RGB ControllerDisplay routines to control the LEDs are fully customizable. Some programming skills and a PIC programmer to store your customized code t the microcontroller is all that is required.

We have customized the sequence files, and have both the source and HEX files available for free download.

If you would prefer not to customize the code yourself, you can choose to download the HEX files. These are programmed into your PIC microcontroller. We have standardized on the Microchip PIC 12F683, which features 2Kx14 of programming space, along with 128×8 bytes of RAM, all in a single, 8-pin package. This model has sufficient room to accommodate almost any customized sequences you can dream of creating.

When you download the source files, the ZIP file contains several individual files. Each of these files is necessary when compiling the application, which is done with the Microchip MPLAB IDE. For our programming and testing, we used v8.00.

The Microchip MPLAB IDE is available from their site for free. When visiting the Microchip site, look for a link to the MPLAB IDE from their home page.

In the ZIP file, there is a single file called SequenceData.inc which contains the code to control the lighting sequences. This file can be edited, adding additional code to customize your sequences, or you can amend the code to bring new or different features, or delete sections if you do not want specific sequences.

Shown below is a sample of the SequenceData.inc file. Pay close attention to the format of the data as each sequence is terminated with an ‘end of sequence’ terminator line (shown in BLUE). An ‘end of all data’ tag is used to finish all activities (shown in RED). Each line of data, other than a terminator line, must contain five separate values, which indicate Fade Rate, Hold Time, along with the Red, Green, and Blue intensity levels.

Customizing LED Rainbow RGB Controller Firmware Using MPLab

Designing Custom Sequences

When designing sequences, there can be a maximum of 256 individual sequences although you are likely to run out of program space on the processor before reaching that level. Some simple guidelines to follow when creating your sequences:

  1. Data lines must start with the ‘dt’ (data table) assembler directive
  2. All data is specified using decimal values
  3. Data values must be separated by a comma
  4. The sequence data on each line has five separate comma-separated fields:
    1. Fade Rate: The speed at which the colors fade from the current value to the new value. Each step occurs at an interval of 5ms x Fade Rate. Legal values range from 0 to 254
      1. A Fade Rate value of 0 indicates the RGB values will update immediately without fading
      2. The Fade Rate value must not be set to 255 except to indicate an end of the sequence. (see e. below)
    2. Hold Time: After fade completes, delay before moving to next data line. Interval is 50mS x Hold Time. Legal values range from 0 to 254.
      1. A Hold Time value of 255 following a Fade Rate of 255 indicates an ‘end_of_all_sequencea data.
    3. Red, Green and Blue PWM values. 0 = 0% (LED off) through to 255 = 100% (LED fully on). Typically changes in LED brightness are more noticeable between 0 and 128 than from 128 to 255
  5. End of the current sequence data is indicated by the Fade Rate value of ‘255’. When the routine encounters this, it restarts the sequence from the beginning.
  6. At the end of all available sequence data, both the Fade Rate and Hold Time fields must be set to ‘255’

After editing sequenceData.inc the file should be saved and the rgbsa-inet.asm reassembled. The resulting rgbsa-inet.hex file can be programmed into the PIC.

LED Rainbow Downloads

  • led_rainbow_all_files_v3.zip – Version 3: Contains all files necessary to edit or compile your own sequences for the LED Rainbow. All files are included and represent the version 3.0 code as supplied by us. Also included in the ZIP file is the HEX file which can be used to program your own 12F683 microchip processor.
  • led_rainbow_v3_for_12F683.zip – Version 3: Contains version 3.0 of our LED Rainbow code in HEX format which can be used to program your own 12F683 microchip processor.
  • led_rainbow_all_files_v2.zip – Contains all files necessary to edit or compile your own sequences for the LED Rainbow. All files are included and represent the version 2.0 code as supplied by us. Also included in the ZIP file is the HEX file which can be used to program your own 12F683 microchip processor.
  • led_rainbow_v2_for_12f683.zip – Contains version 2.0 of our LED Rainbow code in HEX format which can be used to program your own 12F683 microchip processor.

Custom Animation Sequences

Color RainbowDuring the development process, we sometimes receive special requests for customized sequences for the LED Rainbow, and other times we receive sequences that others have developed and desire to share with others. The sequences below are all customized, some simple, some very complex, but are all available for you to take and use in your displays. All you need to do is to download the files that you wish and program them into your processors.

Each of the sequences below is ZIP files containing a simple text file which should be renamed to the sequencedata.inc format which you compile and program into your processor.

pade.zip: This is the sequence used by Manfred Pade for his outdoor garden lights project. See his dedicated page for more information including a tutorial on building up the garden lights.

fades.zip: Two very simple, yet visually stunning displays which cycle through either a blue-red sequence or a red-orange sequence. Each available in six display speeds of approximately 3.6, 6.1, 8.7, 11.2, 13.8 and 16.3 seconds.