Friday, June 10, 2016

How to use API Packets to Control Remote I/O Lines

Book:  The Hands-On XBee Lab Manual

Experiment 12  Using XBEE connected to the USB-XBEE connector plugged into the computer, turned LEDS on and off on the remote XBEE.

Configuration setting on the xbee:
End Device - coordinator (RCVR)
Serial High - SH 0013A200
Serial Low - SL  408A47F9
Scan channels - SC 1FFE

End Device (XMTR)
SH 0013A200
SL  408A47E5
Scan channels SC 1FFE



Coordinator - RCVR
Step 1:  Plug in receiver (coordinator) and click on default to reset xbee settings
Step 2:  Change these settings
DL-1234
MY - 5678
AP - API enabled-1
IA-I/O settings - FFFF

XMTR - end device
Step 1:  Plug in receiver (coordinator) and click on default to reset xbee settings
Step 2:  Change these settings
DL-5678
MY - 1234
AP - API enabled-1
IA-I/O settings - FFFF

Note that both xbees are in API mode

AT commands
D2 turn on
7E 00 10 17 01 00 13 A2 00 40 8A 47 E5 FF FE 02 44 32 05 C2
D3 turn on

To send an AT remote command from the receiver, click on the first xbee and then click on Open.
Your window should look like this:


Create API frames by clicking on the plus sign to the right of the Send Frames window.

You can paste an API packet into the space or create one by clicking on edit frame.  You can paste an API frame into the window and then edit or start from scratch.


To create a frame, select the type of frame that you want.  In this case we want to create a Remote AT command.  


This is what my receiver (connected to computer) frames will send to my remote transmitter to turn on the LED and then turn it off.  If we want to run on two LEDs, we need to send the same API frame to a different pin.  To turn on pin D3, change D2 to D3 for the on and off API frames.  Note that the parameter value is 05 for on (pin HIGH) and 04 for off (pin LOW) and that this needs to be in HEX!!!
                                     LED connected to pin D2 is on                           LED connected to pin D2 is off
        


If the LEDs are not turning on and off as expected, look at the remote command response frame that you get back from the remote transmitter by clicking on it in the console.  On the right, scroll down and you'll see that you'll get an error that says that the parameter that you send (the value for the pin) is invalid.  I created the error by writing a parameter of "05" is ascii instead of hex.









No comments:

Post a Comment