Beginners XBee trouble.

I am new to the XBees and I have the following equipments:

On the sender side I have:

A PC connected via USB to a UartsBee V3.1 (from SeeedStudio) serial adapter. In the adapter slot there is an Xbee PRO series2 module.

On the receiver side I have an Arduino with a dual Bees Shield (also from SeeeStudio) and in the Bee2 slot I have another XBee PRO series2.

The two XBee PRO series2 has been programmed using X-CTU and the UartsBee V3.1 to have the same PAN ID and the same High and Low address. The one connected to the computer is programmed to “COORDINATOR API” and the XBee connected to the Arduino is programmed to “END DEVICE API”.

What I want to do is to send a character from the PC and set one of the pins on the Arduino to HIGH.

Reading various threads here and the datasheet for the Bees Shield I have first programmed the Aduino Xbee setting the switch to “USB” with the following code:

void setup() 

{ 

DDRD=0x00; 

}

void loop() 

{ 

}

(This will disable the Uart0 port of Atmega IC )

I do not know if this is necessary or not but it is done.

Then I switch the Bees Shield switch over to “Atmega” and load my code to the Arduino:

int ledPin = 13;

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pins:
  pinMode(ledPin, OUTPUT);
}


void loop() {
  // read the port:
  if (Serial.available() > 0) {
    int inByte = Serial.read();


    switch (inByte) {
    case 'H':    
      digitalWrite(ledPin, HIGH);
      break;
    case 'L':    
      digitalWrite(ledPin, LOW);
      break;
    default:
      // turn all the LEDs off:
      digitalWrite(ledPin, LOW);

    }
  }
}

Now I power up the receiver Arduino, the Bees Shield and the XBee PRO series2 with a 9V battery.

I plug the USB cable in the on the UartsBee V3.1 and on the PC I open the Arduino serial monitor and send the character “H” but the only response I get is that the TX led on the COORDINATOR Xbee will lit up just a fraction of a second and that's it. No response on the receiver side.

The Associated LED´s on both XBees are flashing all the time so that's a good sign I guess. And when I am resetting the END DEVICE XBee on the Shield the LEDs on the COORDINATOR Bee starts flashing for a while. I guess this also is a good sign that the XBee´s are talking to each other.

Maybe I have got the whole idea wrong and needs another Arduino on the sender side.

But I have a suspicion there is something missing in my sketch.

The way I just open the serial monitor window from the Arduino IDE on the PC feels a bit strange but by doing this with the USB cable plugged in the Arduino the sketch works fine.

Please advice.

You want us to google links you should have provided? I don't think so. Try again.

Sorry about that Paul, I thought you know everything ;)

On the sender side I have:

A PC connected via USB to a UartsBee V3.1 http://www.seeedstudio.com/depot/uartsbee-v31-p-688.html?cPath=104_109 serial adapter. In the adapter slot there is an Xbee PRO series2 module. http://www.seeedstudio.com/depot/xbee-pro-series2-rf-module-p-418.html?cPath=2

On the receiver side I have an Arduino http://www.seeedstudio.com/depot/seeeduino-v22-atmega-328p-p-669.html?cPath=79_80 with a dual Bees Shield http://www.seeedstudio.com/depot/bees-shield-p-672.html?cPath=104_109 and in the Bee2 slot I have another XBee PRO series2.

The two XBee PRO series2 has been programmed using X-CTU http://www.digi.com/support/kbase/kbaseresultdetl.jsp?kb=125 and the UartsBee V3.1 to have the same PAN ID and the same High and Low address. The one connected to the computer is programmed to “COORDINATOR API” and the XBee connected to the Arduino is programmed to “END DEVICE API”.

What I want to do is to send a character from the PC and set one of the pins on the Arduino to HIGH.

Reading various threads here and the datasheet for the Bees Shield I have first programmed the Aduino Xbee setting the switch to “USB” with the following code:

void setup()

{

DDRD=0x00;

}

void loop()

{

}

(This will disable the Uart0 port of Atmega IC )

I do not know if this is necessary or not but it is done.

Then I switch the Bees Shield switch over to “Atmega” and load my code to the Arduino:

void setup() {
 // initialize serial communication:
 Serial.begin(9600);
 // initialize the LED pins:
 pinMode(ledPin, OUTPUT);
}


void loop() {
 // read the port:
 if (Serial.available() > 0) {
   int inByte = Serial.read();


   switch (inByte) {
   case 'H':
     digitalWrite(ledPin, HIGH);
     break;
   case 'L':
     digitalWrite(ledPin, LOW);
     break;
   default:
     // turn all the LEDs off:
     digitalWrite(ledPin, LOW);

   }
 }
}

Now I power up the receiver Arduino, the Bees Shield and the XBee PRO series2 with a 9V battery.

I plug the USB cable in the on the UartsBee V3.1 and on the PC I open the Arduino serial monitor and send the character “H” but the only response I get is that the TX led on the COORDINATOR Xbee will lit up just a fraction of a second and that's it. No response on the receiver side.

The Associated LED´s on both XBees are flashing all the time so that's a good sign I guess. And when I am resetting the END DEVICE XBee on the Shield the LEDs on the COORDINATOR Bee starts flashing for a while. I guess this also is a good sign that the XBee´s are talking to each other.

Maybe I have got the whole idea wrong and needs another Arduino on the sender side.

But I have a suspicion there is something missing in my sketch.

The way I just open the serial monitor window from the Arduino IDE on the PC feels a bit strange but by doing this with the USB cable plugged in the Arduino the sketch works fine.

Any ideas what I am doing wrong over here?

The purpose of the dual XBee board is to allow two pairs of XBees to interact with a single Arduino, one on the hardware serial port, and one using a software serial port. So, two pairs of series one radios can be used to make 3 devices talk to each other (through the Arduino).

You will need to develop this one step at a time. Get the Arduino reading from the hardware serial port connected XBee, and writing to the hardware serial port.

When that works, forget about it. Get the Arduino reading from the software serial port connected XBee, and writing to it.

Then, you can take the data from the hardware port and send it to the software serial port, and vice versa.

Now, to your issues.

The one connected to the computer is programmed to “COORDINATOR API” and the XBee connected to the Arduino is programmed to “END DEVICE API”.

I think this is backwards, but it doesn't really matter. If you draw a picture, the XBee connected to the PC is at one END of the link.

Reading various threads here and the datasheet for the Bees Shield I have first programmed the Aduino Xbee setting the switch to “USB” with the following code:

This makes no sense. Arduinos are not XBees and XBees are not Arduinos. You can not "program" and XBee. If this is code you uploaded to the Arduino, it makes no sense, as it doesn't DO anything.

(This will disable the Uart0 port of Atmega IC )

Until the next (real) sketch is loaded, that is. And why do you want to disable the only means that the XBee has for talking to the Arduino?

I do not know if this is necessary or not but it is done.

I do. It wasn't.

On the receiver side I have an Arduino with a dual Bees Shield (also from SeeeStudio) and in the Bee2 slot I have another XBee PRO series2.

What do you have in the Bee1 slot?

I plug the USB cable in the on the UartsBee V3.1 and on the PC I open the Arduino serial monitor and send the character “H” but the only response I get is that the TX led on the COORDINATOR Xbee will lit up just a fraction of a second and that's it. No response on the receiver side.

That the TX light on the XBee flashes means that it is transmitting data. It is the second step in the process of getting the XBees to communicate. The first step is getting the ASSOC lights to come on, for both XBees, indicating that they are aware of each other, and able to communicate.

For point-to-point communication, you are using the wrong series XBees. You should have series 1 XBees for point-to-point stuff.

Alright, I need to find a pair of series one XBees then. Thanks for your reply Paul.

I'm not saying that you can't get series 2.5's to talk to each other. I was never able to, but others have been successful.

Do your ASSOC lights light up/flash?

Well, I got both ASSOC leds to flash when the XBees was using the X-CTU settings as COORDINATOR API and END DEVICE API. When using the settings as END DEVICE AT on both XBees the ASSOC led are steady lit. I think I need to do some more study on the XBees and figure out the difference between the different settings and the diffeance between series 1 and series 2. I just thought there were some simple way of testing the communications betweens the two XBees.

The ASSOC light lights up steady while the XBee is searching for something to talk to. It starts flashing when the XBee finds something to talk to.

So, it appears that COORDINATOR and END DEVICE are correct. I don't think you want to use API mode, though, so look for a different COORDINATOR type (and END DEVICE type) setting.

Paul! I got it working!! The only thing changed was the settings on the X-CTU. The XBee sender was set to ZNET 2.5 COORDINATOR AT and the receiver XBee was set to ZNET 2.5 ROUTER/END DEVICE AT.

:)

Perseverance pays off! :)