Wireless XBee Modules

So have purr-chased a pair of XBee Pro Si modules for mounting onto Arduino Wireless Proto boards.  Although I’m still trying to decide what I might use them for ultimately I decided today to get them talking to each other.

1) Setting up the remote RECEIVER.

To set up the receiver, first check that the Serial Select switch is set to USB as this will allow the unit to communicate with the computer.  The following script was uploaded to the unit

int sentDat;

void setup() {
  Serial.begin(9600);
  pinMode(2,OUTPUT);
}

void loop() {

  if(Serial.available() > 0) {
      sentDat = Serial.read();

      if (sentDat == 'h') {
        digitalWrite(2,HIGH);
        delay(1000);
        digitalWrite(2, LOW);
      }
  }
}

Before disconnecting the unit from the computer and switching it back to Micro.  With a LED and 220Ohm resistor connected across Pin 2 and a power source it was ready for the sender.

2) Setting up the sender

Repeating the process with the second unit. The following script was uploaded to the Sender.

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

void loop() {
  Serial.println('h');
  delay(1000);
}

The sender unit should then start sending the h command via wifi every second. If it has worked the receiver should start to flash.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.