SHC RGB Dimmer

RGB Dimmer

Purpose

The SHC RGB dimmer powers three LEDs with a current of up to 600mA. You can assemble it in different housings and use differend LED types. You can use the device as an ambient / mood light or as a general purpose alarm / information lamp. The circuit and RGB LEDs are small enough to fit in many different lamp housings.

By requesting the device to show different colors and color animations, you can use it to show different states for whatever you like. To react on specific events, you have to configure the PC application controlling your SHC network accordingly. To give you some examples, you could make the LEDs blink in red if your fridge is left open or set the color depending on the outdoor temperature.

In addition to the LEDs, the device can power a small piezo speaker to alarm you as needed.

Functions, Behavior

The device is powered by a DC adaptor. It can receive commands any time. You can request one of the following functions:

  • Set a fixed color
  • Request a color animation

Supported Messages

  • Generic_Version_Status
  • Dimmer_Color_Get/Set/SetGet/Status/Ack/AckStatus
  • Dimmer_ColorAnimation_Get/Set/SetGet/Status/Ack/AckStatus

For v0.9.0, it is planned that the device also supports some sound effects (beep etc.).

Color Palette

The SHC RGB dimmer uses a 6 bit color palette (same as EGA) for the messages to reduce the needed message sizes. Internally, fading between colors uses full 24 bits (8 bits per color), so there are no visible jumps from one color to another within a color animation.

These are the 64 colors used in the supported messages Color and ColorAnimation:

Color 0 = 000 Color 1 = 005 Color 2 = 00A Color 3 = 00F Color 4 = 050 Color 5 = 055 Color 6 = 05A Color 7 = 05F
Color 8 = 0A0 Color 9 = 0A5 Color 10 = 0AA Color 11 = 0AF Color 12 = 0F0 Color 13 = 0F5 Color 14 = 0FA Color 15 = 0FF
Color 16 = 500 Color 17 = 505 Color 18 = 50A Color 19 = 50F Color 20 = 550 Color 21 = 555 Color 22 = 55A Color 23 = 55F
Color 24 = 5A0 Color 25 = 5A5 Color 26 = 5AA Color 27 = 5AF Color 28 = 5F0 Color 29 = 5F5 Color 30 = 5FA Color 31 = 5FF
Color 32 = A00 Color 33 = A05 Color 34 = A0A Color 35 = A0F Color 36 = A50 Color 37 = A55 Color 38 = A5A Color 39 = A5F
Color 40 = AA0 Color 41 = AA5 Color 42 = AAA Color 43 = AAF Color 44 = AF0 Color 45 = AF5 Color 46 = AFA Color 47 = AFF
Color 48 = F00 Color 49 = F05 Color 50 = F0A Color 51 = F0F Color 52 = F50 Color 53 = F55 Color 54 = F5A Color 55 = F5F
Color 56 = FA0 Color 57 = FA5 Color 58 = FAA Color 59 = FAF Color 60 = FF0 Color 61 = FF5 Color 62 = FFA Color 63 = FFF

Color Animation

A color animation is defined by a series of up to 10 colors with an additional time value. The RGB dimmer fades one color to the other in the given time.

Time values

The time value used in the ColorAnimation message results in an animation time according to the following formula:

fading time in seconds = 0.05s * 1.3 ^ value

The value 0 has the special meaning and marks the end of the animation if you use less than 10 colors. The calculation was chosen to have both small exact time frames and also bigger ones with a small amount of message data. With the given 5 Bits per time value, it covers the following animation times (rounded values used in the firmware):

time value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
fading time [s] end marker 0.03 0.07 0.1 0.13 0.20 0.26 0.33 0.39 0.52 0.69 0.88 1.2 1.5 2.0 2.6
time value 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
fading time [s] 3.2 4.3 5.6 7.3 9.5 12.4 16 21 27 35 46 60 78 101 131 170

The RGB dimmer uses a timer with ~32ms internally. The result is that you get an instant change of the color without fading when using time value 1. You can use this by purpose when you want an immediate color change instead of a fade.

Color Animation Modes

The behavior of the animation depends mainly on two settings:

  • The repeat count is used to repeat the animation several times. An infinite playback is possible using the special value "0".
  • The autoreverse function plays the animated colors in reverse order after it finishes in the normal direction.

In all cases, the animation starts and ends with a separate color that is only played back one time. This allows that the color shown previously to the animation can be cleanly faded out and is not mixed with the first color you set in the animation. At the end of the animation, it allows to fade out to a separate color (e.g. black = off), which is otherwise not used in the (repeated) animation.

For the animation, you have to decide how many colors you want to play back. The last color of the animation is where the next one has a time value of 0.

For better understanding, have a look at the following examples:

one-time playback of animation

If you set repeat to 1, the color animation is played back once in the given order. The first color is faded in from the color which is visible before the animation started (black in this example). The last color remains visible after the animation is completed. You may want to use black as last color to switch the RGB dimmer off. The time value 0 as t3 marks the end of the animation.


repeated animation with limited cycles, without autoreverse

If you set repeat to a positive number greater than 1, the colors are played back several times. The first color (c0) is used only once at the beginning. After the first cycle is complete, c3 is directly faded to c1. Note that the last color (c4) is used only at the end when all animation cycles are finished. This is used to fade out to black (= off).


endless animation without autoreverse

This example shows a color animation which is also looped only in one direction. The number of cycles is set to 0, which means infinite repeat. Because there is no need for a separate color which is used at the end of the animation, every cycle ends with c4. After a cycle is complete, c4 is directly faded to c1 again.


autoreverse animation with odd number of cycles

When autoreverse is selected, the animation is played back in reverse order after the last color of a cycle is reached. Playback in the reverse direction ends not at c0, but at c1 to let c0 only be visible once at the start of the animation.


autoreverse animation with even number of cycles

When an even number of cycles is selected for an animation with autoreverse, the last cycle is "skipped" and c1 is directly faded to the last color defined.


autoreverse animation with endless cycles

When endless cycles are selected, the color with the highest number is used in every cycle, because there is no need for a separate "last" color.


E2P Device Configuration

OffsetBlockContentTypeSizeDescription
0Hardware
Values for hardware setup, which have no special meaning to SHC device concepts + the DeviceType, which decides about the existence of further blocks.
DeviceTypeEnumValue1 BytesThe device can check with this value if the EEPROM data is meant for the actual type of device. If not, the device goes into an error mode.
Values: 0 = BaseStation, 20 = EnvSensor, 40 = PowerSwitch, 50 = RGBDimmer, 60 = Dimmer, 70 = SoilMoistureMeter, 80 = Thermostat, 90 = TeaMaker
8OsccalModeIntValue1 BytesThis value is used to change the speed of the internal oscillator. 0 = don't use OSCCAL calibration (e.g. external crystal oszillator is used). -128 = OSCCAL measure mode: the LED blinks every 60s, so the user can measure the original speed. -127..+127 = The speed is adjusted by the given amount in per mill (e.g. 10 means to speed up the device by +1%).
MinVal: -128, MaxVal: 127, Default: 0
16Reserved6 Bytesn/a
64Generic
This block contains SHC configuration data which every device has.
DeviceIDUIntValue12 BitsThe DeviceID identifies the specific unit in the SHC network. It is used to address the device and in messages the device sends. Every device has to have a different DeviceID.
MinVal: 0, MaxVal: 4095
76Reserved4 Bitsn/a
80PacketCounterUIntValue3 BytesThe PacketCounter is counted up throughout the whole lifetime of the device and is used to make the encrypted packets differently from each other every time.
MinVal: 0, MaxVal: 16777215
104Reserved19 Bytesn/a
256AesKeyByteArray32 BytesThis key is used to encrypt packets before sending and also used as primary key to decrypt packets. Special devices may have additional keys in their device specific block.
512RGBDimmer
This block contains the specific configuration data that only RGB Dimmer devices need.
BaseStationPacketCounterUIntValue3 BytesThis is the last remembered packet counter of a command from the base station. Packets with the same or lower number are ignored.
MinVal: 0, MaxVal: 16777215
536BrightnessFactorUIntValue1 BytesThis value reduces the overall brightness. This is to easily adjust it to your needs without changing the LED series resistors. WARNING: It is recommended to use this only for testing, because it reduces the amount of different brightness levels. Changing the resistors is to be preferred.
MinVal: 1, MaxVal: 100, Default: 100
544TransceiverWatchdogTimeoutUIntValue1 BytesReset RFM12B module if no data is received until timeout is reached. Use this function if your specific transceiver hangs sometimes. Value is in deca seconds. Suggested setting is 48 (for 8 minutes). Set 0 to disable (default).
MinVal: 0, MaxVal: 255, Default: 0
552Reserved955 Bytesn/a

Hardware Overview

PCBRGB Dimmer 1 PCB (Conventional THTThrough hole technology This is the conventional technique to stick pins of components through the PCB and solder them. This is easy to build up, unlinke using SMD components., non-SMD)
47 x 44 mm
MicrocontrollerATMega 328A-PU (28-pin PDIP)
Clock Source8 MHz internal R/C oscillator
Special Components Voltage regulator 3,3V (TS 2950)
RFM Transceiver ModeTX + RX
UARTonly debug TX
Power5-12V with internal 3.3V regulator

Schematic

Layout

Download

Assembly Instructions

Look into the Wiki for assembly instructions for this device. It would be appreciated if you correct or enhance the description whenever you find potential for improvement.