SHC Power Switch

Power Switch

Purpose

An SHC power switch circuit can be used to switch a low or high voltage. It can be controlled remotely by SHC commands via the base station as well as manually by a button press.

A special feature is its timer function. Using the function, the switch changes its state (e.g. from Off to On) after reception and automatically changes it back after the given amount of time, independent from an existing connection to the base station. This makes sure it switches again even if radio transmission is not possible from whatever reason. As a use case, think about a water pump for plants which automatically switches off after 30 seconds.

Besides a power socket, you could also use the circuit to control other home appliances by connecting their buttons to the relay.

Functions, Behavior

The status can be retrieved with a "Get" or changed with a "Set" or "SetGet". The current state is broadcasted every 30 minutes and some seconds after a change with a "Status". The firmware version is sent about once a day.

Supported Messages

  • Generic_Version_Status
  • PowerSwitch_SwitchState_Get
  • PowerSwitch_SwitchState_Set
  • PowerSwitch_SwitchState_SetGet
  • PowerSwitch_SwitchState_Status
  • PowerSwitch_SwitchState_Ack
  • PowerSwitch_SwitchState_AckStatus

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.
512PowerSwitch
This block contains the specific configuration data that only Power Switch devices need.
SupportedSwitchesUIntValue1 BytesThis is a bit field about the connected switches.
MinVal: 1, MaxVal: 6
520BaseStationPacketCounterUIntValue3 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
544SwitchStateBoolValue[8]1 Bytes x 8This field stores the last known switch state(s) for eight switches to allow restoring the same state after power loss. It contains also the remaining timeout value. Fill this with zeros when creating a e2p file!
608SwitchTimeoutUIntValue[8]2 Bytes x 8This field stores the last known switch state(s) for eight switches to allow restoring the same state after power loss. It contains also the remaining timeout value. Fill this with zeros when creating a e2p file!
MinVal: 0, MaxVal: 65767
736TransceiverWatchdogTimeoutUIntValue1 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
744Reserved931 Bytesn/a

Hardware Overview

PCBPower Switch 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)
50 x 50 mm
MicrocontrollerATMega 328A-PU (28-pin PDIP)
Clock Source8 MHz internal R/C oscillator
Special ComponentsVoltage regulator: voltage regulator 3,3V (TS 2950)
Relay: to connect to the device you want to switch.
RFM Transceiver ModeTX + RX
UARTonly debug TX
Power5V 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.

This device uses high voltage. Build and use it at your own risk! Be careful when applying the operating voltage! If you are not familiar with handling high voltages or not allowed to build or use this kind of devices, don't do so.