Search code examples
xbee

XBee command to transmit or receive Dn status


I have two XBee chips - one of them is connected to a relay switch, the other one - to my computer via USB cable.

I can configure the locally connected XBee to send its D0 value to the remote XBee, so that when I toggle the D0 line of the local XBee the remote relay switch toggles as well.

What I want to do is be able to send a command to the local XBee over its serial connection and have the local XBee send a command to the remote XBee that would toggle the relay switch without having to physically interact with the D0 line on my local XBee.

The XBees are S1, so they don't (seem to?) support ATIO command, at least my tests didn't show that working. I also tried using ATAP 1 with API command 83 as shown here but that didn't work.

The hardware setup works - attaching a button to D0 transmits its status to the remote XBee, so how do I get the same to happen with software alone?


Solution

  • Finally figured it out, thanks for steering me in the right direction @tomlogic

    The problem was that Digi's website doesn't tell you to set IA to 0xFFFF (allow all source addresses to change pin state), which by default is 0xFFFF FFFF FFFF FFFF (disable remote pin changes)

    Found a better tip on this site.

    This is what it looks like in XCTU for Mac: XCTU MAC

    Here are all the settings that differ from defaults one I got it to work.

    Transmitter: MY=7 AP=1 (API enabled) D0=3 (Pin 0 Input) IC=FF (Change detect all)

    Receiver: MY=2 D0=5 (Pin 0 High Output) IU=0 (UART IO Disable) IA=0xFFFF (Allow all to change pins)

    The commands I used:

    7E 00 10 17 01 00 13 A2 00 AA BB CC DD FF FE 02 49 4F 00 8D - Send remote ATIO 0

    7E 00 10 17 01 00 13 A2 00 AA BB CC DD FF FE 02 49 4F 01 8C - Send remote ATIO 1