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. You can play a series of tones (melody), similar to requesting the RGB LED animation.

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
  • Set a fixed tone
  • Request to play a melody

Supported Messages

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

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 = 000Color 1 = 005Color 2 = 00AColor 3 = 00F Color 4 = 050Color 5 = 055Color 6 = 05AColor 7 = 05F
Color 8 = 0A0Color 9 = 0A5Color 10 = 0AAColor 11 = 0AF Color 12 = 0F0Color 13 = 0F5Color 14 = 0FAColor 15 = 0FF
Color 16 = 500Color 17 = 505Color 18 = 50AColor 19 = 50F Color 20 = 550Color 21 = 555Color 22 = 55AColor 23 = 55F
Color 24 = 5A0Color 25 = 5A5Color 26 = 5AAColor 27 = 5AF Color 28 = 5F0Color 29 = 5F5Color 30 = 5FAColor 31 = 5FF
Color 32 = A00Color 33 = A05Color 34 = A0AColor 35 = A0F Color 36 = A50Color 37 = A55Color 38 = A5AColor 39 = A5F
Color 40 = AA0Color 41 = AA5Color 42 = AAAColor 43 = AAF Color 44 = AF0Color 45 = AF5Color 46 = AFAColor 47 = AFF
Color 48 = F00Color 49 = F05Color 50 = F0AColor 51 = F0F Color 52 = F50Color 53 = F55Color 54 = F5AColor 55 = F5F
Color 56 = FA0Color 57 = FA5Color 58 = FAAColor 59 = FAF Color 60 = FF0Color 61 = FF5Color 62 = FFAColor 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 value0123456789101112131415
fading time [s]end marker0.030.070.10.130.200.260.330.390.520.690.881.21.52.02.6
time value16171819202122232425262728293031
fading time [s]3.24.35.67.39.512.416212735466078101131170

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.


Tones

Similar to the color palette for the LEDs, a set of tones (mostly notes) is defined to allow playing melodies or just a single high or low tone.

The following tones used in the supported messages Tone and Melody can be used providing the listed index number. To play a melody in a usual pitch, use index around 25-36.

The accuracy for the listed target frequency is limited by the 16 bit timer value, but has a maximum deviation of 0.28% for some high notes (index ≤ 84), which is not audible. The tones above index 84 are only for special cases, not to play notes/melodies (e.g. create noises with special speakers to scare off animals).

index0123456789101112
tonesilenceCDesDEsEFGesGAsABH
frequency [Hz]065.4169.3073.4277.7882.4187.3192.5098.00103.83110.00116.54123.48
index131415161718192021222324
tonecdesdesefgesgasabh
frequency [Hz]130.81138.60146.84155.56164.81174.61185.00196.00207.65220.00233.08246.94
index252627282930313233343536
tonec'des'd'es'e'f'ges'g'as'a'b'h'
frequency [Hz]261.63277.18293.66311.13329.63349.23369.99392.00415.30440.00466.16493.88
index373839404142434445464748
tonec''des''d''es''e''f''ges''g''as''a''b''h''
frequency [Hz]523.25554.37587.33622.25659.26698.46739.99783.99830.61880.00932.33987.77
index495051525354555657585960
tonec'''des'''d'''es'''e'''f'''ges'''g'''as'''a'''b'''h'''
frequency [Hz]1046.501108.731174.661244.511318.511396.911479.981567.981661.221760.001864.661975.53
index616263646566676869707172
tonec''''des''''d''''es''''e''''f''''ges''''g''''as''''a''''b''''h''''
frequency [Hz]2093.002217.462349.322489.022637.022793.832959.963135.963322.443520.003729.313951.07
index737475767778798081828384
tonec''''‘des''''‘d''''‘es''''‘e''''‘f''''‘ges''''‘g''''‘as''''‘a''''‘b''''‘h''''‘
frequency [Hz]4186.014434.924698.634978.035274.045587.655919.916271.936644.887040.007458.627902.13
index858687888990919293949596979899100
frequency [Hz]9000100001100012000130001400015000160001700018000190002000021000220002300024000
index101102103104105106107108109110111112113114115116
frequency [Hz]25000260002700028000290003000031000320003300034000350003600037000380003900040000

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, 45 = Controller, 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.
MinVal: 0, MaxVal: 255, Default: 48
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.