User manual

www.sainsmart.com
Copyright © 2013 SainSmart All Rights Reserved
modules on its network and channel will receive the data it transmits. This can happen in a few
ways:
If a module's DH is 0 and its DL is less than 0xFFFF (i.e. 16 bits), data transmitted by that
module will be received by any module whose 16-bit address MY parameter equals DL.
If DH is 0 and DL equals 0xFFFF, the module's transmissions will be received by all modules.
If DH is non-zero or DL is greater than 0xFFFF, the transmission will only be received by the
module whose serial number equals the transmitting module's destination address (i.e.
whose SH equals the transmitting module's DH and whose SL equals its DL).
Again, this address matching will only happen between modules on the same network and
channel. If two modules are on different networks or channels, they can't communicate
regardless of their addresses.
Configuring the XBee module
You can configure the XBee module from code running on the SainSmart board or from software
on the computer. To configure it from the SainSmart board, you'll need to have the jumpers in the
Xbee position. To configure it from the computer, you'll need to have the jumpers in the USB
configuration and have removed the microncontroller from your SainSmart board.
To get the module into configuration mode, you need to send it three plus signs: +++ and there
needs to be at least one second before and after during which you send no other character to the
module. Note that this includes newlines or carriage return characters. Thus, if you're trying to
configure the module from the computer, you need to make sure your terminal software is
configured to send characters as you type them, without waiting for you to press enter.
Otherwise, it will send the plus signs immediately followed by a newline (i.e. you won't get the
needed one second delay after the +++). If you successfully enter configuration mode, the
module will send back the two characters 'OK', followed by a carriage return.
Send Command
Expected Response
+++
OK<CR>
Once in configuration mode, you can send AT commands to the module. Command strings have
the form ATxx (where xx is the name of a setting). To read the current value of the setting, send
the command string followed by a carriage return. To write a new value to the setting, send the
command string, immediately followed by the new setting (with no spaces or newlines
in-between), followed by a carriage return. For example, to read the network ID of the module
(which determines which other XBee modules it will communicate with), use the 'ATID command:
Send Command
Expected Response
ATID<enter>
3332<CR>
To change the network ID of the module:
Send Command
Expected Response
ATID3331<enter>
OK<CR>
Now, check that the setting has taken effect:
Send Command
Expected Response
ATID<enter>
3331<CR>
Unless you tell the module to write the changes to non-volatile (long-term) memory, they will
only be in effect until the module loses power. To save the changes permanently (until you
explicitly modify them again), use the ATWR command: