Actions

Difference between revisions of "RGB Light Show (Wired/Wireless)"

From Just in Time

Line 1: Line 1:
This page will contain a description of the wireless RGB spot controller. For now there's just the one section that describes the command bytes.
+
We were able to get our hands on a set of par-56 RGB led spots. We thought it would be fun to create a wireless controller for these. While experimenting, we soon found out that you may not want your stage lighting depend on the reliability of a cheap 433Mhz transmitter/receiver pair, so we soon added an option to send the command through a wire as well.
 +
 
 +
Each controller is based on an ATTiny 2313 and performs PWM control on 3 separate RGB spots (9 channels). Since the whole PWM is controlled through timer interrupts in software, 8 bits is the best resolution we could manage. This is pretty basic for an RGB spot, especially given that our perception of brightness is not linear to the relative pulse widths (or in other words: going from 1/256 to 2/256 pulse has a much bigger effect than moving from 200/256 to 201/256). Note that the schematics are for common-cathode leds, hence the P-channel mosfets.
 +
 
 +
The software implements 3 faders that control 3 channels each. Every fader uses Bresenham's line algorithm to smoothly change the 3 RGB values from some starting color to an end color, essentially creating a 4D line (R,G,B,time). Interrupt-driven pwm control makes sure that the RGB-values are translated into pulse widths.
 +
 
 
==Command bytes==
 
==Command bytes==
 
In general, the most significant 4 bits describe the command (room for 16 commands), the lower 2 bits may contain a spot number, depending on the command. Arguments in ''<angle brackets>'' are encoded in the lower 2 bits of the command byte.  
 
In general, the most significant 4 bits describe the command (room for 16 commands), the lower 2 bits may contain a spot number, depending on the command. Arguments in ''<angle brackets>'' are encoded in the lower 2 bits of the command byte.  

Revision as of 23:49, 6 November 2012

We were able to get our hands on a set of par-56 RGB led spots. We thought it would be fun to create a wireless controller for these. While experimenting, we soon found out that you may not want your stage lighting depend on the reliability of a cheap 433Mhz transmitter/receiver pair, so we soon added an option to send the command through a wire as well.

Each controller is based on an ATTiny 2313 and performs PWM control on 3 separate RGB spots (9 channels). Since the whole PWM is controlled through timer interrupts in software, 8 bits is the best resolution we could manage. This is pretty basic for an RGB spot, especially given that our perception of brightness is not linear to the relative pulse widths (or in other words: going from 1/256 to 2/256 pulse has a much bigger effect than moving from 200/256 to 201/256). Note that the schematics are for common-cathode leds, hence the P-channel mosfets.

The software implements 3 faders that control 3 channels each. Every fader uses Bresenham's line algorithm to smoothly change the 3 RGB values from some starting color to an end color, essentially creating a 4D line (R,G,B,time). Interrupt-driven pwm control makes sure that the RGB-values are translated into pulse widths.

Command bytes

In general, the most significant 4 bits describe the command (room for 16 commands), the lower 2 bits may contain a spot number, depending on the command. Arguments in <angle brackets> are encoded in the lower 2 bits of the command byte.

value meaning arguments comments
0x90 wait_for_fader <fader> halts processing further commands until the given fader has finished
0xA0 fade <spot> time red green blue lets the spot fade from its current color to the given one
0xB0 set_initial <spot> red green blue sets the initial (switch-on) values for a spot
0xC0 hold none stops all faders
0xD0 resume none resumes all faders
0xE0 set <spot> red green blue sets the color for the given spot
0xF0 address new addres sets the device address of this controller, if the address button is pressend simultaneously

Schematic & Board

Ledspot schematic.pngLedspot board.png