User Tools

Site Tools


xbee:configuring_a_node

Configuring a node

The direct way to configure a XBee radio module (Series 1) is to use AT commands over serial.

* Install the XBee in an Arduino XBee shield, removes the microcontroller and set the jumpers to USB. Alternatively, you can use a XBee Explorer.

* Open your serial console/terminal (Zterm, goSerial, screen on OSX, Putty or HyperTerminal on Windows). If you use the modules from the Interaction Workshop, the baud rate is 19200. If you use brand new modules, the default value is 9600.


+++ is instruction to enter command mode. Note that all AT commands with be confirmed with the string OK sent back by the module. If you don't get an acknowledge, you have to wait a couple of seconds and start again from the beginning with +++

+++


Restore configuration to defaults, not necessary but advisable as older configuration could conflict.

ATRE


Set the Personal Area Network (PAN) ID. Change ID if you want to create your own network. (16 bit, 0 - 65535 in decimal)

ATID0


Set the module ID address. Must be unique (16 bit, 0 - 65535 in decimal).I use 18 for this example, use your own unique ID

ATMY18


Sets the destination address to broadcast to the whole PAN network.

ATDL0


Set the interface data rate to 19200. BD3 is the default with 9600.

ATBD4


Write the changes/settings to memory

ATWR


Exit command mode

ATCN

Arduino Code

Arduino code to read analog sensor and send the value over serial (wired/xbee) in a specific format id:value*. You can read all the values with Processing (example file) or anything that can read serial data.

You have to remove the Xbee shield to program the Arduino. Remember to set the jumpers to Xbee on the shield.

int sensorPin = 0;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor
int myID = 7;  // id for xBee network

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);  
  Serial.begin(19200);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  
  // send it over to serial - xBee in the format of id:value*
  Serial.print(myID);
  Serial.print(":");
  Serial.print(sensorValue);
  Serial.print("*\r");
  delay(200);
}
xbee/configuring_a_node.txt · Last modified: 2011/08/29 12:14 by camille