Newsflash
I've set up some message forums.  Use the link in the main menu to get to them.   Eventually, I'll integrate all this into the CMS.
 
This site looks best when viewed with a secure, standards-compliant browser like Firefox or Opera
Color-Changing Landscape Lights - The Fixtures PDF Print Email
 Written by Administrator   
Wednesday, 19 April 2006
Image
The guts of a lighting fixture
I'm in the process of assembling the landscape fixtures with the redesigned driver PCBs, so I thought it would be a good time to delve more into the lighting fixtures themselves.

The hardware of the landscape fixtures consists of two PCBs: The driver PCB and the LED PCB. The LED PCB contains 9 LEDs -- three each of red, green and blue. The brains of the fixture is on the driver. A PIC 16F628A clocked at 10MHz controlls the PWM of each of the three channels and responds to the commands it receives on its serial port.

Comm

The fixtures are configured to receive data at a rate of 62.5Kbps. A MAX485 is used to connect the data bus to the PIC. The control lines of the MAX485 are connected to output pins of the PIC. This allows for the capability of the fixtures to send data as well as receive it, although this capability is not presently used. The code in the PIC sets the MAX485 to receive data and leaves it that way.

The PIC16F628A has a built-in USART, which is one of the main reasons I chose it for the LED driver. Serial comm is fully interrupt driven and a very simple state machine is used for receiving the packets on the wire.

General Capabilities

  • 16 non-volatile color memories
  • 8-bit PWM on each red, green, and blue channel
  • 1 temporary color register

Each of the 16 non-volatile color memories can store a single color which can then be made the active color (the color that is actually being shown) using a single-byte instruction. One thing I thought of using this for was color chases. The initialization of the effect would have the color memories in each fixture set up for the colors to be used. Each successive fixture would have the colors offset by one. For example, if fixture 1 had blue stored in color memory 1, fixture 2 would have it in color memory 2, etc. Then, the chase effect would be extremely simple: Send a broadcast packet for all fixtures to make the color in memory 1 the active color, then color 2, color 3, and so on.

Using 8-bit PWM theoretically allows over 16 million colors. However, in practice, I find that it is easier to distinguish between single increments of lower intensity values than it is for higher intensity values. I'm not sure why this is, but for outdoor lighting, I'm sure nobody is going to be able to care that they can't tell the difference between color (255,255,255) and (254,254,254).

The temporary color register is similar to one of the color memories, however, its contents will be lost when power to the fixtures is removed. There are a number of instructions that use the temporary color register as a source or destination. The idea behind the temporary color register is similar to that of a frame buffer. I can set up the temporary registers of the fixtures to the colors that I want. Then, with a single broadcast command, those colors can be made active on all of the fixtures simultaneously.

The Instruction Set

Each instruction contains a single byte opcode followed by up to three bytes of operands. The instruction set is described in the table, below (all opcodes are shown as hexidecimal numbers).

Instruction Opcode
Operands
Description
SET_MEMORY
0x0?1 byte each for R,G, and B
Sets a color memory to a given color. The lower 4 bits of the opcode specify which color memory.
MEM_SET_COLOR
0x1?
None
Makes the active color of the fixture the color that is stored in the color memory. The color change is instantaneous. The lower 4 bits of the opcode specify which color memory.
MEM_FADETO_COLOR
0x2?
None
Makes the active color of the fixture the color that is stored in the color memory. The color change is a fade from the current active color to the new color. The speed of the fade can be set by the SET_FADE_SPEED instruction. The lower 4 bits of the opcode specify which color memory.
SET_COLOR
0x31
1 byte each for R, G, and B
Sets the active color of the fixture to the color specified by the operands. The color change is instantaneous.
FADETO_COLOR
0x32
1 byte each for R, G, and B
Sets the active color of the fixture to the color specified by the operands. The color change is a fade from the current active color. The speed of the fade can be set by the SET_FADE_SPEED instruction.
SET_FADE_SPEED
0x331 byte speed
Sets the speed of the fade. Lower values represent faster fades. This value is stored in EEPROM and is saved across power cycles.
SAVE_ACTIVE_TO_TEMP
0x34
None
Saves the current active color to the temporary color register.
RESTORE_ACTIVE_COLOR
0x35
None
Makes the current active color the color that is stored in the temporary color register. The color change is instantaneous.
VARY_OFF
0x36
None
Turns a fixture "off". When a fixture is "off", it is unlit and will respond to only a VARY_ON or UNLOCK instruction. The current active color will be stored in the temporary color register. The change is instantaneous.
VARY_ON
0x37
None
Turns a fixture "on". The color stored in the temporary color register (presumably from a VARY_OFF) will be made the active color. The color change is instantaneous.
SET_RANDOM_COLOR
0x38
None
Sets the active color of the fixture to a random color that is chosen by the fixture. The color change is instantaneous.
FADETO_RANDOM_COLOR
0x39
None
Sets the active color of the fixture to a random color that is chosen by the fixture. The color change is a fade from the current active color to the new color. The speed of the fade can be set by the SET_FADE_SPEED instruction.
SET_TEMP_COLOR
0x3a
1 byte each for R, G, and B
Stores the specified color in the temporary color register. The active color is unchanged.
FADETO_TEMP_COLOR
0x3b
None
Sets the active color of the fixture to the color that is stored in the temporary color register. The color change is a fade from the current active color fo the new color. The speed of the fade can be set by the SET_FADE_SPEED instruction.

VARY_OFF_FADING

0x3c
None
Similar to VARY_OFF except that the fixture fades to black from the current active color. The speed of the fade can be set by the SET_FADE_SPEED instruction.
VARY_ON_FADING
0x3dNone
Similar to the VARY_ON instruction except that the fixture fades to the color stored in the temporary color register. The speed of the fade can be set by the SET_FADE_SPEED instruction.
LOCK
0x3e
None
Similar to the VARY_OFF instruction, except the active color does not change. The fixture will only respond to an UNLOCK, VARY_ON, or VARY_ON_FADING instruction.
UNLOCK
0x3f None
Similar to the VARY_ON instruction, except the active color does not change.
SET_MEMORY_RANDOM
0x4?
None
Sets a color memory to a random color selected by the fixture. The lower 4 bits of the opcode specify which color memory.

One thing to note about the commands is that the commands that fade are interruptable while the fade is happening.  I added this capability to make the fireflies effect more interesting.  I'll have a  video of this effect in the gallery soon.

That's about it for the fixtures. I hope you weren't completely bored. Next time, I'll talk a bit about the lighting controller.

Last Updated ( Thursday, 20 April 2006 )