Support / Knowledge Base / Sending Serial Data via Device Cloud, X2e and an Xbee

Sending Serial Data via Device Cloud, X2e and an Xbee

Periodically, one wants to send data from the device cloud to an XBee module connected
to a device via the XBee modules Serial port or COM port.

This can be done using the default application that comes with an XBee X2e or Connect port X2e Gateway.
The application is called XBGW.py.

The items used for this example are:
    1) XBee Gateway X2e (I am using the XBee WIFI X2e for Zigbee)
    2) One XBee ZB S2C module
    3) One XBIB-U-DEV Development board (Any USB or RS232 interface board for the XBee can be used
    4) A Device Cloud Account that has your X2e provisioned
    5) XCTU or some other terminal emulator software in which to receive the incoming serial data

In this article, it is presumed that you already have your X2e provisioned on your account, that the correct drivers
are installed on your PC for your interface board, and that you have a PC application such as XCTU in order to access
the COM port.

Step 1. Power up your gateway and make sure it has a connection to the device cloud.  You can verify this by logging into
    your device cloud account and checking the devices tab.  You should have a blue connection icon next to the device in question.

Step 2. Connect the XBee module to the board and your PC.

Step 3. Launch your terminal emulator software. In this case I am using the XCTU.

Step 4. If you are using XCTU, make sure you are able to see your local XBee module and are on the terminal screen and it is connected.

Step 5. In the device Cloud, under the Documentation tab, select the API Explorer.

Step 6. Select POST.

Step 7. The script you want to use is as follows:

<sci_request version="1.0">
  <send_message cache="false">
    <targets>
      <device id="00000000-00000000-Enter your devices ID here"/>
    </targets>
    <rci_request version="1.1">
      <do_command target="xbgw">
        <send_serial addr="Enter the MAC address of target XBee here "
                encoding="base64"> Using Base64, enter the ASCII text you want to send here, I am using SGVsbG8gWEJlZSBXb3JsZA==
        </send_serial>
      </do_command>
    </rci_request>
  </send_message>
</sci_request>
 


The response will look something like:
<sci_reply version="1.0">
  <send_message>
    <device id="00000000-00000000-00409DFF-FF814667">
      <rci_reply version="1.1">
        <do_command target="xbgw">
          <responses command="send_serial">
            <response/>
          </responses>
        </do_command>
      </rci_reply>
    </device>
  </send_message>
</sci_reply>

Out the radio you will see: Hello XBee World

 
Last updated: Aug 23, 2017

Recently Viewed Articles

No recently viewed articles
Contact a Digi expert and get started today! Contact Us