SHC IR Transceiver

Infrared Remote Transceiver

Purpose

An SHC IR transceiver can receive IR commands from an IR remote and send the codes to the base station, so the home automation can react on it. But it can also send out IR commands like an IR remote control, triggered by the according message. That means you can also control other devices via IR commands from your home automation. That means the IR transceiver is basically an IR gateway.

This device is based on the power switch PCB. The relais is not used. But the UART RX and TX pins are connected to an YS-IRTM board, which takes over the complex function to receive and send NEC IR codes in a very robust way. Please note that the IR transceiver only supports NEC remote control codes, not RC-5 or other protocols.

Functions, Behavior

Each NEC IR code consists of three bytes. These are depending on the remote control / device you use. To limit forwarding of IR codes to the base station, you can set up filters in the E2P. These consist of a code and a bitmask. Usually you want to match the first two bytes of the remote control you use and ignore the last byte, which results in a bitmask of FFFF00 (hex). You can set up several such filters to support more than one remote and still limit what is forwarded to the base station.

To send an IR command, you send a InfraredRemoteCode message to the IR transceiver with the given three bytes of the NEC code you want to send.

Battery Voltage Measurement

Usually the device is powered by a power supply and not with batteries, since the RFM12 is actively listening to receive commands and the device draws too much power. But in some cases (depending on what shall be controlled), it could be powered by batteries. With two LiIon 18650 batteries, it runs several weeks. By setting the E2P values accordingly, the battery voltage measurement is activated, and an according BatteryStatus status is sent with the remaining battery capacity percentage.

Note that the YS-IRTM module needs a fixed 5V voltage. Therefore you can connect the power switch PCB to the changing battery voltage to allow measurement (the ATMega and the RFM12 are both powered by the constant 3.3V from the LP2950 regulator), but the YS-IRTM needs to be connected to fixed 5V which you need to get from a voltage converter. Don't connect it to the battery with the changing voltage!

Supported Messages

  • Generic_DeviceInfo_Status
  • Generic_HardwareError_Status
  • Generic_BatteryStatus_Status
  • Controller_InfraredRemoteCode_Set

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, 10 = Proxy, 20 = EnvSensor, 40 = PowerSwitch, 43 = IRTransceiver, 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.
512IRTransceiver
This block contains the specific configuration data that only IR Transceiver devices need.
HardwareVersionEnumValue1 BytesThis is the hardware version of the Power Switch PCB (which is also used for the IR Transceiver device). The info is especially used to configure the RFM12 VCC pin behaviour (which changed in V1.3) and to report the version in the DeviceInfo message. The value 0 (unknown) is defined to allow new firmware to detect that the value was not set in an outdated E2P.
Values: 0 = unknown, 1 = V1_2, 2 = V1_3, 3 = V1_4, Default: 3
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
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
552BatteryTypeEnumValue1 BytesThe BatteryType decides if the input voltage is measured and a BatteryStatus message is sent periodically, considering the voltage curve of the selected battery type.
Values: 0 = None, 1 = Alkaline_4C_6V, 2 = LiIon_2C_8V, Default: 0
560BatteryScaleDivisorUIntValue2 BytesThis divisor is used to calculate the battery voltage correctly. The divisor is the one (in 1/100) to divide the measurement value of the ADC (between 0 at 0V and 1023 at 3.3V) to get the battery voltage in V. E.g. when a 2C LiIon battery is used and the resistors are chosen as R4 = 22kOhm and R5 = 39kOhm (to not exceed 3.3V at the ADC input pin with max. battery voltage of 8.4V), the divisor is 1023/((39000+22000)/22000*3.3) = 111.8, for better accuracy stored as 11180.
MinVal: 0, MaxVal: 65535, Default: 11180
576RXFilterCodeByteArray[16]3 Bytes x 16This field stores the NEC codes (each 3 bytes) to report to have received.
960RXFilterBitmaskByteArray[16]3 Bytes x 16This field stores the bitmasks applied to the codes in RXFilterCode to check if they shall be reported. E.g. FFFFFF means that only the exact code is accepted. FFFF00 means that the first two bytes need to match. If the first bitmask is 000000, all codes are accepted. Otherwise, the first bitmask 000000 will mark the end of the used filters and will not be considered itself.
1344Reserved855 Bytesn/a
8184ErrorCodeEnumValue1 BytesThis byte is set by the firmware to distinguish after the restart if a HW watchdog reset or a Transceiver Watchdog reset (SW reset, triggered on purpose by the firmware) occurred. It doesn't matter to which value you set it by e2p coding.
Values: 0 = ExternalReset, 1 = BrownOutReset, 2 = WatchdogReset, 3 = TransceiverWatchdogReset, 4 = TransceiverPowerCycle, Default: 0

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 Components Voltage regulator: voltage regulator 3.3V (TS 2950)
YS-IRTM: to receive and send IR commands.
RFM Transceiver ModeTX + RX
UART9600 Baud, used to control the YS-IRTM module. Possibility to send debug messages alternatively with compiler switch.
Power5V power supply

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.