LED Rainbow

RGB LED PWM Driver - Programming Information

LED Rainbow Assembled Side ViewRoutines used on the LED Rainbow are fully customizable, although programming skills are required along with a PIC programmer to write your code to the PIC microcontroller.

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

12F683 Used on the LED RainbowIf you would prefer not to customize the code yourself, you can choose to download the HEX files, which can be programmed into your PIC microcontroller. We have standardized on the Microchip PIC 12F683, which features 2Kx14 of programming space, along with 128x8 bytes of RAM, all in a single, 8-pin package. This should have more than enought space to hold almost any customized sequences you can dream of creating.

When you download the source files, the ZIP file will contain a number of 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.

Contained 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 own 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), while an 'end of all data' tag is used to terminate all activities (shown in RED). Each line of data, other than terminator lines, must contain five separate values, which indicate Fade Rate, Hold Time, along with the Red, Green and Blue intensity levels.

MPLab Screen Layout Information

When designing sequences, there can be a maximum of 256 individual sequences although you will likely run out of program space on the processor prior to 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. Each data value 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.
      • A Fade Rate value of 0 indicates the RGB values will be updated immediately without fading.
      • The Fade Rate value must not be set to 255 except to indicate an end of 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.
      • 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 them be programmed into the PIC.

LED Rainbow Downloads

File Date File Name File Description File Size
04-05-2009 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. 15,370 bytes
03-20-2009 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. 2,930 bytes
06-17-2008 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. 11,487 bytes
06-17-2008 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. 1,956 bytes