• Github Project

    The project uses Programmable XBee connected to a relay. When appropriate signal is received, the relay is operated for 125ms signaling the connected device to operate. To control this device through iPhone "Home" app the following full setup is used:

    graph LR iPhone --> Apple[Apple Servers] Apple --> Home[Home Router] Home --> AppleTV AppleTV -->RaspberryPi RaspberryPi --> XBee[XBee Coordinator] XBee --> XBee-Trigger

    Potentially with SmartThings:

    graph LR iPhone --> STServers[SmartThings Servers] STServers --> Home[Home Router] Home --> SmartThings SmartThings --> XBee-Trigger

    For the latter flow to work, the XBee-Trigger would need to operate as a standard ZigBee HA device so that it would successfully pair with SmartThings Hub. Some additional discovery work is needed to understand what is needed to make this work.

  • 4 channel relay circuit driven by pxbee-trigger


    Component Manufacturer Quantity SKU / Part nr. Specification Option
    Programmable XBee (with RPSMA) Digi 1 XBP24CZ7SITB003 PDF
    Bridge Rectifier DF005M ON Semiconductor 1 Mouser No: 512-DF005M PDF
    DC/DC Isolated Converter Cosel MGFS1R5243R3 Cosel 1 Mouser No: 436-MGFS1R5243R3 PDF
    Bipolar Transistor BC548BTA ON Semiconductor 4 Mouser No: 512-BC548BTA PDF
    Diode 1N4004 ON Semiconductor 4 Mouser No: 863-1N4004RLG PDF
    General Purpose Relay (APAN3103) Panasonic 4 Mouser No: 769-APAN3103 PDF
    Resistor RN55D1801FB14 Vishay 4 Mouser No: 71-RN55D1801FB14 PDF
    10 pin header for XBee Harwin 2 Mouser No: 855-M22-7131042 PDF
    2 pin Terminal Block (PCB) Molex 1 Mouser No: 538-39501-1002 PDF A
    2 pin Terminal Plug Molex 1 Mouser No: 538-39500-0002 PDF A
    9 pin Terminal Block (PCB) Molex 1 Mouser No: 538-39501-1009 PDF A
    9 pin Terminal Plug Molex 1 Mouser No: 651-1908101 PDF A
    2 pin Fixed Terminal Block (PCB) Molex 1 Mouser No: 538-39357-0002 PDF B
    9 pin Fixed Terminal Block (PCB) Molex 1 Mouser No: 538-39357-0009 PDF B
    Antenna with RP-SMA Connector Linx Technologies 1 Mouser No: 712-ANT-2.4-CW-RAH PDF

    Standard 3.5 width headers are used. Option A) uses pluggable termination; B) Fixed screw termination; Components can be easily switched with other termination blocks or use direct wire soldering.

    Power consumption / characteristics

    • Relay 110mW
    • XBee ~ 400mW +14mA ~= 450mW
    • DI / DO 4mA with total of 40mA
    • Output 13mW @ 3.3V

    Switching transistor circuit

    The digital output pin power of XBee will be insufficient to drive the general purpose relay. A switching transistor circuit will be used to drive the relay.\(\raisebox{0.25em}{1}\)

    • \(V_s =\) Load Supply Voltage
    • \(R_L =\) Load Resistance (APAN03 Coil resistance)
    • \(I_c =\) Load Current \(= V_s / R_L\)
    • \(I_{IC} =\) Maximum Output current from Integrated Circuit - 4mA

    Due to the fact that the switched load consists a coil, a protection diode is required in the circuit.

    Transistor properties

    • Transistor's maximum collector current \(I_{c_{max}}\) must be greater than Load current:
    $$I_{c_{max}} > \frac{\text{Supply Voltage } V_s}{\text{Load Resistance } R_L}\Longrightarrow 100mA > \frac{3.3V}{82\Omega} \approxeq 40.24mA \Longrightarrow 100mA > 40.24mA \Longrightarrow \textcolor{#228B22}{OK!} $$
    • Transistor's minimum current gain \(h_{FE{min}}\) must be at least 5 times the load current \(I_c\) divided by the maximum output urrent from the Integrated Circuit:
    $$h_{FE{min}} > 5 \cdot \frac{I_c}{I_{IC}} \Longrightarrow 110 > 5 \cdot \frac{0.040243902}{0.004} \Longrightarrow 110 > 50.3048775 \Longrightarrow \textcolor{#228B22}{OK!} $$

    Resistor properties

    The transistor switch circuit relies on a single resistor which is sized as follows.

    $$R_B = 0.2 \cdot R_L \cdot h_{FE} \Longrightarrow0.2 \cdot 82 \cdot 110 = 1804 \Omega \Longrightarrow \textcolor{#228B22}{1k8} $$

    User interfaces - Door opener

    Altough the trigger hardware is generic to drive different use-cases, the userland should have more precise functionality. As main use case, the trigger will be used to drive swing and sliding gates.

    BFT Thalia P controller

    AUX 2 (Pins 24 & 25) - Free Contact; NO; Gate open light as default.

    Assumption is here, that when gate is closed, the contact remains open and closes when the gate is opened.

    For our project, it means that the STATUS GPIO acts as:

    • Closed state = GPIO pin = 1
    • Opened state = GPIO pin = 0


    General reference

    Icon library reference: http://scripts.3dgo.net/smartthings/icons/

    Door opener DH

    SmartThings does not work nicely with different endpoints. A custom Device Handler (DH) must be written to have proper functioning tiles but operate as a single device:

    1. Main toggle switch (endpoint 0xEA, 0x0006)
    2. Open gate (endpoint 0xEB, cluster 0x0006)
    3. Close gate (endpoint 0xEC, cluster 0x0006)
    4. Open pedestrian (endpoint 0xED, cluster 0x0006)
    Binary Input Cluster (0x000F)

    On endpoints 0xEA and 0EB, a status indicator can be queried (XBee in 18 and Pin 19), default state is OPEN

    On state change send the: 0x0055 (Present value attribute), bool
    Report Attributes (0x0A) command to target cluster 0x0001

    Pin layout

    PIN Assignment Notes
    1 GND Common for Input pins
    2 STATUS_1 Input
    3 STATUS_2 Input
    4 COMMON 1 Relays 1 & 2
    5 ACT 1 Relay 1
    6 ACT 2 Relay 2
    7 COMMON 2 Relays 3 & 4
    8 ACT 3 Relay 3
    9 ACT 4 Relay 4


    1: Transistor Circuits - https://electronicsclub.info/transistorcircuits.htm
    2: SmartThings Classic - ZigBee Reference - https://docs.smartthings.com/en/latest/ref-docs/zigbee-ref.html#zigbee-ref
    3: Undocumented SmartThings Classic ZigBee Reference - https://community.smartthings.com/t/zigbee-something-commands-reference/110615/5

  • Useful Eagle commands:

    • grid mm
    • grid mil
    • run length
    • via 'gnd'
    • ratsnest
    • ripup @; - Changes routed wires back to airwires for all polygons (Usually GND plane)

  • Apparently the 24VAC to DC circuit does not work correctly because the DC/DC conversion to 3.3V doesn't seem to properly work. Is the full bridge rectifier with wrong specs? https://rayshobby.net/wordpress/24vac-to-5vdc-conversion/

Log in to reply