How to set XBee parameters
From SquidBee
Before start working, XBee parameters have to be set. XBee parameters are set trough its serial port, this means that you have to stabilize a serial connection between the XBee board and any other device. This device can be an Arduino board, a PC or any other device with serial communication (UART).
The easiest way to start working is connect the XBee in a gateway board (see gateway node ) that lets you to communicate the PC and the XBee. Once the XBee is attached to the computer the serial communication is able to start. For this communication you need a serial port terminal (Serial Port Terminal) to send/receive data to/from XBee.
There are some AT commands we use to configure the XBee module parameters. To send these commands to XBee your terminal program has to be set to send ASCII data.
Basic configuration of XBee module when you get it:
speed: 9600 baud rate bits: 8 parity: none stop bits: 1 flow control: none
So your terminal has to be set with these parameters
- Basic configuration
The basic configuration on the XBee consists in:
- - baud rate for serial communication
- - network identifier
- - node address
- - destination node address
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 (bold letters).
To enter command mode, we send
- +++
- if the speed is right,you'll get
- OK
- to read the current speed send BD command
- ATBD<CR>
- (<CR> is carriage return - enter on the keyboard)
- you'll get
- 3
- the number you get means a certain speed:
- 0 - 1200
- 1 - 2400
- 2 - 4800
- 3 - 9600
- 4 - 19200
- 5 - 38400
- 6 - 57600
- 7 - 115200
- to configure the speed you want send (example)
- ATBD4<CR>
- you'll get
- OK
- write data to memory
- ATWR<CR>
- OK
- to leave command mode
- ATCN<CR>
- OK
- Serial cable replacement
for the serial cable replacement we have to configure some parameters on the XBee's we are going to use, these parameters are:
- - serial port speed - ATBD
- - network identifier - ATID
- - node identifier - ATMY
- - destination node identifier - ATDL
Example:
- An SquidBee gate way - network ID 3332 - speed 19200 - address 0 - destination 1
- An SquidBee - network ID 3332 - speed 19200 - address 1 - destination 0
The command sequence to send would be:
- In the gateway node XBee module
- +++
- Ok
- ATID<CR>
- 3332
- (it's ok so I don't change it)
- ATBD<CR>
- 3
- (this means 9600, so I change it to 19200)
- ATBD4<CR>
- OK
- ATMY0<CR>
- OK
- ATDL1<CR>
- OK
- ATWR<CR>
- (to write the configuration to memory)
- OK
- ATCN<CR>
- In the SquidBee XBee module
- +++
- Ok
- ATID<CR>
- 3332
- (it's ok so I don't change it)
- ATBD<CR>
- 3
- (this means 9600, so I change it to 19200)
- ATBD4<CR>
- OK
- ATMY1<CR>
- OK
- ATDL0<CR>
- OK
- ATWR<CR>
- (to write the configuration to memory)
- OK
- ATCN<CR>
We have both the SquidBee and the gateway ready to communicate wirelessly (a wireless serial port).
The full AT command list is available in the XBee Data-Sheet



