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 switch or a toggle button.
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.
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.
Optional Physical Switch
With an additional switch which is connected to an IO pin, the relais state can be calculated as a combination of the state requested by one of the supported messages (e.g. DigitalPin) and the status of the switch. The behaviour can be configured in the e2p.
Currently, only one switch is supported on PB7. If you need more, let me know. I'll extend the functionality then.
- Override the normally automatic switching of a relais (by your SHC control logic) with a physical switch temporarily ("forced on" / "forced off").
- Intelligent kitchen hood control that switches it off in case a wood-burning stove is on and the window in the kitchen is not open. This is needed in Germany when the kitchen hood extracts the air to the outside. An environment sensor can be used to detect the temperature and therefore status of the stove. A window sensor connected to the power switch can detect if the window is open.
In general, the status according digital pin/port command (CMD) and the switch (SW) can be combined by 'and', 'or' or 'xor'. Additionally the switch can be active open or active close and therefore can be inverted ('not'). The resulting settings are as follows:
- CMD (default): Relais is set according received messages, switch is ignored / not connected.
- SW: Relais is set according the connected switch only.
- not SW: Relais is set according the connected switch only (with inverted logic).
- CMD and SW: Relais is on only if requested by command and the switch is on.
- CMD and not SW: Relais is on only if requested by command and the switch is off (inverted logic).
- CMD or SW: Relais is on if requested by command or when switch is on.
- CMD or not SW: Relais is on if requested by command or when switch is off (inverted logic).
- CMD xor SW: Relais is on if request by command and switch state differ.
- CMD xor not SW: Relais is on if request by command and switch state differ (inverted logic).
The other theoretically possible combinations don't make sense, because the relais would never be switched or the status as requested by a message would be inverted only.
E2P Device Configuration
Values for hardware setup, which have no special meaning to SHC device concepts + the DeviceType, which decides about the existence of further blocks.
|DeviceType||EnumValue||1 Bytes||The 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
|8||OsccalMode||IntValue||1 Bytes||This 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
This block contains SHC configuration data which every device has.
|DeviceID||UIntValue||12 Bits||The 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
|80||PacketCounter||UIntValue||3 Bytes||The 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
|256||AesKey||ByteArray||32 Bytes||This 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.|
This block contains the specific configuration data that only Power Switch devices need.
|SupportedSwitches||UIntValue||1 Bytes||This is a bit field about the connected switches.|
MinVal: 1, MaxVal: 3
|520||BaseStationPacketCounter||UIntValue||3 Bytes||This 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
|544||CMDState||BoolValue||1 Bytes x 8||This field stores the switch state(s) which were requested by one of the supported 'set'/'setget' commands for eight switches to allow restoring the same state after power loss. Fill this with zeros when creating a e2p file!|
|608||CMDTimeout||UIntValue||2 Bytes x 8||This field stores the timeout value(s) which were requested by one of the supported 'set'/'setget' commands for eight switches to allow restoring the same state after power loss. Fill this with zeros when creating a e2p file!|
MinVal: 0, MaxVal: 65767
|736||TransceiverWatchdogTimeout||UIntValue||1 Bytes||Reset 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
|744||SwitchMode||EnumValue||1 Bytes x 8||The mode decides how the optional manual switches are used in combination to the digital pin/port commands to set the relais status. In general, the status according digital pin/port command (CMD) and the switch (SW) can be combined by 'and', 'or' or 'xor'. Additionally the switch can be active open or active close and therefore can be inverted ('not'). 'CMD' and '(not) SW' mean that only the command or switch are considered. The default value is to ignore the optional manual switch.|
Values: 0 = CMD, 1 = SW, 2 = not SW, 3 = CMD and SW, 4 = CMD and not SW, 5 = CMD or SW, 6 = CMD or not SW, 7 = CMD xor SW, 8 = CMD xor not SW, Default: 0
|PCB||Power 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
|Microcontroller||ATMega 328A-PU (28-pin PDIP)|
|Clock Source||8 MHz internal R/C oscillator|
Voltage regulator: voltage regulator 3,3V (TS 2950)|
Relay: to connect to the device you want to switch.
|RFM Transceiver Mode||TX + RX|
|UART||only debug TX|
|Power||5V with internal 3.3V regulator|
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.|