Pages

Thursday 27 March 2014

Communicate an Xbee Connected to Arduino to Xbee Connected to Xbee Explorer

Xbee communication using Arduino is an interesting task. Here is a demonstration of connecting XBee RF Modules to Arduino. Entire system can be pictorially represented as shown in figure.


XBees have to be configured, according to our purpose, before inserting to the breakout board. In this example, I configured RF Modules for Peer-to-Peer communication. Read this tutorial to configure XBee modules for Peer-to-Peer Communication.

Step 1: Complete the circuit as shown in figure given below.

Step 2: Insert one of the configured XBee to the breakout board (Xbee modules should be inserted       carefully. Improper placing will damage your Xbee module).
Step 3: Connect Arduino board to computer.
Step 4: Open Arduino IDE and paste the following program.

char letter;

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

void loop() {  
  Serial.write('a');
  delay(400); 

  if(Serial.available())
  {         
    letter=Serial.read();
    Serial.print(letter);
  }
}


Step 5: Upload the program to your Arduino board. For successfull uploading, don't forget to disconnect the wires connected to the RX and TX pins of Arduino.
Step 6: Connect the other Xbee module to your computer via a Xbee explorer USB or 
Step 7: Open X-CTU. Enter the Com Port Number. Then press Add button.


Step 8: Press Test / Query button.


Step 9: Open the terminal tab of X-CTU as well as the Serial monitor of Arduino. Letters typed in the terminal of X-CTU will be displayed in the Serial Monitor of the Arduino. Xbee connected to the Arduino will be always sending letter 'a' to the Xbee module connected via Xbee explorer USB or Xbee explorer dongle.

3 comments:

  1. hello sir, my xbees are communicating when i configure them on X-CTU,
    but when i disconnect and use on xbee mode with ardino connection then these don't communicate.by burning given above code.i had cofihured correctly.plz help

    ReplyDelete
  2. hello sir i want to use temperature sensor DHT11 or DHT22

    ReplyDelete
  3. Very valuable information, it's not like all the blogs that we find here, congratulations, I was looking for something like this and found it here. Thank you for sharing this blog here. roxtec

    ReplyDelete