Digi Xbee S6B - Info

I am admittedly new to hardware and new to C/C++ish arduino code so this is all pretty new to me. I wanted to make a thread about this module as there is very little said about it on the forum. I struggled but managed to figure out how to do simple HTTP GET or HTTP POST requests using Transparent Mode which packetizes data sent over the UART interface. In my testing I found Software Serial to be unreliable using an 8MHz μC (Pro Mini 3v, FIO, etc.) so I suggest using Hardware Serial to communicate with the S6B if you intend to go that route. I will update this post as I learn more about the module. I hope this helps!

Most of my initial trial and error can be seen here in the discussion section of the SparkFun tutorial [Internet Datalogging With Arduino and XBee WiFi.

Configuration:

This is pretty straight forward if you read the [User Manual. Using XCTU you can sent any parameter necessary for the operation of the device. You can also set these parameters from inside code running on the μC by entering AT Command Mode (+++) and issuing the corresponding commands. The device can be communicated with either over the UART interface or its SPI interface. For reference an SPI arduino library by cjbearman here [xbee-wifi-spi-arduino. I have not yet experimented with the SPI interface. There are two main modes of operation: Transparent and API. Transparent Mode simply packetizes and transmits data sent over the UART. The limiting factors of this mode include usage of a single TCP or UDP port, generally a fixed destination IP (unless changed in the program by entering AT Command mode), and limited feedback. The API mode is much more complicated and requires a specific frame structure but allows for greater complexity and control. I also have yet to experiment with this mode but probably will be in the future.

This is what the user manual has to say about it:

Transparent:

When operating in transparent mode, the modules act as a serial line replacement. All

UART data received is queued up for RF transmission. When RF data is received, the

data is sent out through the UART. The module configuration parameters are configured

using the AT command mode interface. Please note that transparent operation is not

an option when using SPI.

API:

As a general rule of thumb, API firmware is recommended when a module:

• sends RF data to multiple destinations

• sends remote configuration commands to manage modules in the network

• receives IO samples from remote modules

• receives RF data packets from multiple modules, and the application needs to

know which module sent which packet

• needs to use the send data request and device request features of Device Cloud

If the above conditions do not apply, (e.g. in a sensor node, or a simple application) then

transparent operation might be suitable. It is acceptable to use a mixture of modules

running API mode and transparent mode in a network.

Transparent Mode:

Transparent mode is a very basic mode but for many using this wireless module to log data to a web server of some sort (using a REST API for instance) it will be all you are really looking for. After setting the Destination IP and port of the server you simply have to print an HTTP GET or POST line by line over serial and have your data added (URL encoded) to the body of the request. Here is sample code I used to test sending a message to Pushover’s REST API. Their API IP is 184.154.74.158. Also note that the Xbee S6B is looking for the Destination port in HEX. (80 = 50)

void setup () {
  Serial.begin(9600);
}

void loop() {
  delay(4000);
  Serial.println("POST /1/messages.json HTTP/1.1");
  Serial.println("Host: api.pushover.net");
  Serial.println("Connection: close");
  Serial.println("Content-Type: application/x-www-form-urlencoded");
  Serial.println("Content-Length: 85");
  Serial.println("");
  Serial.println("token=APP_TOKEN&user=USER_KEY&message=Test");
}

](GitHub - cjbearman/xbee-wifi-spi-arduino: Arduino library to support Xbee Wifi modules, using SPI communication)](http://ftp1.digi.com/support/documentation/90002180_H.pdf)](Discuss Tutorial: Internet Datalogging With Arduino and XBee WiFi - SparkFun Learn)

The Digi Binary API for XBees has been implemented in many libraries for Arduino, Linux, and many others. I’ve implemented it in C for a bare metal project on a small ARM processor.

It differs of course, by XBee series 1, series 2, 900MHz, and the WiFi variant.

So some time searching will help you reduce reinvention.

stevech:
The Digi Binary API for XBees has been implemented in many libraries for Arduino, Linux, and many others. I’ve implemented it in C for a bare metal project on a small ARM processor.

It differs of course, by XBee series 1, series 2, 900MHz, and the WiFi variant.

So some time searching will help you reduce reinvention.

Thanks! I did see that. To my knowledge no arduino specific Xbee API library supports the S6B yet except for the one I mentioned in the post that offers easier access to SPI communication (which doesn’t allow Transparent Mode). I came across one other project that happened to be in python but it only offered experimental support for the S6B. I just really wanted to demonstrate how easy it can be to use Transparent Mode to send an HTTP POST request to a REST API for others that may have been as initially confused as I was when I first got the module about a week ago. Xbee’s can be a little intimidating to a noob and there isn’t much information outside of Device Cloud nonsense for the S6B. I may yet write a library for UART communication in API mode or add just add S6B support to an existing library if I end up needing it for the project I’m currently working on.