8 bit Data Byte Explanation:
A basic computer data byte (hence forth referred to as 'byte'), is 8 bits wide and holds a maximum number of 255 decimal. The 8 bits are numbered bit0 to bit7. Each bit is a logic '1' or a logic 'zero'. If the bit is set to logic '1', then that 'bit 'number' is added to get the total value of the byte in decimal. As you can see by the 'Bit-Binary-Decimal' Table below if all bits are set and you add all the bits together the maximum number is 255. Note: Logic 1 is the same as 'on' and Logic 0 is the same as off.
Here is a table of 'bits' and equivalent decimal values.
Just add the decimal numbers together to get the bits set on that you want. Setting all bits on is 255d (decimal). Setting bits 0 and 7 on is 128+1 or 129 decimal. To set multiple colors, set the color# to the combination of bits.
Note: Although the 4 color drivers were developed to drive 'rope style LED lighting', these 4 color drivers can be used for motors, Incandescant Lighting, and more.
Set Colors On: The 'Color#' that represents setting Red, Green, Blue and White are the lower 4 bits of the byte. Bit 0 (set to 1), selects Red to be on, Bit 1 (set to 1), selects Green to be on and so on. Therefore, any combination of colors can be set on utilizing the lower for bits of the 'Color# Byte'. Just add the numbers together that the bits represent and you have the number to send as the 'Color# byte'. I.E. to set Red and White add 1 to 8 (1 for Red) and (8 for White) =9 (both Red and White will be set on by the color command).
Maintain Colors: In a similar fashion, the upper bits (Bits 4-7) select which colors to 'Maintain On' with certain 'Color Commands'. (See the Table above as the Bit action is shown in the table). So if all the upper bits of the 'Color# byte' are set low (zero), then all 4 colors will be turned off and and lower bits set on would set on the color controlled by the bits set to logic 1. This scheme allows one 'Color# Byte' to not only set colors on, but to set colors off with the same one byte. So, if you want to keep 'Green' on, and Set Red to flashing then you would set bit 5 on (32 decimal) to maintain the Green On, and set Bit 0 on (1 decimal), to Set the Red on (Red Select Bit). So, the 'Color# byte' would be 32+1 or 33. So, if you want to 'Maintain' all four colors, then all four upper bits (bits 4-7) would be set to logic 1. This decimal number is 128+64+32+16 or 240. So, to 'Maintain' colors on, send 240+ the colors to select to be on with the current command. If you want White to go out, and turn on Red, you would send binary 01110001 or decimal 113. Note that bit 7 is logic zero, this turns off white. Bits 4,5 and 6 are all logic '1', so those colors are not turned off. Of the lower 4 bits, only bit zero is set, so red is selected to turn on.
Another Example: You want to keep White on while alternating Blue and Red (command 8). The bit to keep White on is bit 7 or 128 decimal. So the first 'Color# byte' will be 128+Blue Select bit (4) or 132. Blue will come on at conclusion of the command. The second Byte (Color# Bits off), sets what color or colors come on when Blue goes off. Since we want Red to come on after Blue turns off, the 'Color# Bits off' is 1. This second byte is not processed to 'Maintain colors', so the second byte value is 1.
Minimum & Maximum Brightness (only if fade value >0) : Incandescent Lights and
Motors don't provide light or motion at low PWM (power) levels. The command to set
PWM minimum and Maximum values improves performance of Incandescent Lights and
Motors when fade control is used to 'ramp' motors or lights . This also improves the 'look' of LED lighting.
If power starts at 1, a change from PWM value 1 to 2 is 50% change in brightness
with one step of change. This 'large' step change (50% step change) has a
poor look to it. If you start
with a minimum PWM of 5, the next step of brightness (6) is only a 17% change in
brightness. Starting with a value of 5 or 10 makes the fade control
look very smooth and not 'jerky'.
Command10 (Set Minimum and Maximum PWM) can set all of the color drivers MIN/MAX with
one command or use multiple commands to set individual color PWM values.
I.E. to set all 4 color PWM Min/Max values, the same the 'Color# bits' should be
set to 15
(bits 0,1,2 and 3) to record the Min/Max values to Red, Green, Blue and
White. E.G. To set just white, the Color# = 8 (white select) or
[10,8, Minimum 'Start' Value, Maximum Value for Switch to full power] I.E.
[10,8,20,240]. The White driver will start with a minimum value of 20, and
at value 240, will switch to full power. Note: If you send a power setting
of 239, the power level will stop increasing once 239 is reached and will not
switch to full power because the full power threshold was set to 240.
I.E. Suppose you have a motor connected to the White Output. The motor
starts to turn with power level = 40. And you want the motor to run up to
200 (fade or ramp to 200) and hold at that power level. Then set the
minimum to 40 and the maximum to 255 because you don't want to switch to full
power.
I.E. Suppose you have an incandescent Light. The light just begins to glow
at value=40. When the power level gets to 200, then you want the light
power to switch to full on. So, set the minimum = 40 and the maximum = 200
for White. Command 10: [10,08,40,200]. Then to command the light on
(using command 4), you would send this command: [4,08,255 (full brightness),
fade value (maybe 20)]. The motor will begin at power setting of 40 and
ramp up (20 milliseconds per ramp step) to 200. Then at the next increment
of power (200->201), then the light will receive full power (255).
IF you want ramp-up and ramp-down power to behave differently, then just set the
Minimum/Maximum for the color driver prior to ramping up the power. Then
set the Minimum/Maximum prior to ramp down the power.
Another Example with 'Maintain Colors'. To maintain all 4 Color Drivers
when when a new 'color' value is set, then send 240+Color# for the color you
want to change. Note: Color# is 1,2,4,8 or combination of the 4 bits.
I.E. Suppose Red Green and Blue are already on and you want to start a motor
using the White driver. Then send command 4: [4,248,255,0]. The
result of this command is:
1. Any colors that were on are not turned off
2. The white channel is set to 255 (full power), with a fade value=0 (instant
full power).
If you want to 'ramp the motor', then set the fade value to get the ramp style
that suites your application and set the min/max power settings to achieve the
motor action that you are looking for.
Setting the TTL Port in BrightAuthor:
1. Select 'Edit', then 'Preferences' on the main menu.
2. Select 'Interactive', Port=1, Baud 38400, Data bits=8, Parity='none', Stop
Bits=1
updated: 02/16/2011