Shelf mounted XBee shields are including an XBee board that can be controlled using different commands as described in the XBee manual.
These devices have a list of commands based on a handshake between them and a microprocessor sending information via serial port. The later is configured with the factory setting: 9600:8:n:1. We may want to change it to a faster/slower speed for any of the applications we use. However, if willing to give the board the functionality of reprogramming other boards wirelessly, we will have to accommodate the serial communication speed to the bootloader's (19200).
Therefore, the first thing we have to do with our XBee modules is to reprogram the speed they work with.
1) take an Arduino board, extract the processor, and plug the shield. We call this configuration "USB-XBee gateway" and it is used to transfer data between your computer and a wireless network using XBee modules.
This setup allows direct control of maxstream's module through serial commands. It will require to configure the jumpers on the XBee board to USB mode. In order to do this, you should make sure that jumpers in the shield are placed like the ones in the photo (USB mode). This allows direct serial communication between USB and XBee.
2) use a serial terminal to send commands to the board. In windows, Bray++ terminal is a really good one (though the hyperterminal will also work). In Ubuntu I use Gtkterm because I run Dapper, but there are better tools for later OS versions. MAC users can use Zterm as a basic tool for sending/receiving data to/from any serial port. You could, of course, use Arduino's IDE to send all this commands. But it is not supporting macros, what becomes a very handy tool when sending standard commands.
3) To reprogram the serial speed of your XBee module, configure your terminal to work at 9600, which is -remember- the factory default setting.
4) As mentioned earlier, the communication between XBee and any device happens through an exchange of strings of text. Whenever we send something to the system, we have to wait until we get a response from it.
To enter command mode, we have to send
+++
(note that there can't be a carriage return or newline after this, so your terminal needs to be configured to send each character as you type it)
if the communication speed is the right one, you will get the message
OK
back from the XBee module. From that moment you have some seconds to send the next command.
To read the current speed send:
ATBD<CR>
where <CR> is enter on the keyboard.
You will get a number as an answer: 3 means 9600bps, 4 19200bps...
The same command but adding one of those numbers in the end will setup the speed for the module. Note that, once you have changed the speed, your serial terminal will literally stop speaking to the module, because they will be working at different speeds.
5) Let's then configure the right speed
Enter command mode
+++
you should get the message
OK
Change the current speed to 19200
ATBD4<CR>
(note that at this point you will likely have to change your terminal program to the new 19200 speed!)
Write the data to memory
ATWR<CR>
Leave command mode
ATCN<CR>
6) The next step is to configure the address for the node, you should give different numbers to each one
Enter command mode
+++
you should get the message
OK
Change the node's address (substitute the * for a number)
ATMY*<CR>
I am configuring 0 for the master node, 1 for the first node, etc
Write the data to memory
ATWR<CR>
Leave command mode (...or just wait a few seconds and command mode will time out)
ATCN<CR>
7) Having addressable nodes allows you to use different ways to communicate between them. The way to address the nodes will be as follows:
Enter command mode
+++
you should get the message
OK
The address to the other node is the * next command
ATDL*<CR>
Write the data to memory
ATWR<CR>
Leave command mode (...or just wait a few seconds and command mode will time out)
ATCN<CR>
References:
- Mesh Networking from ITP