Xbee Sheild

I just bought two new ATMEGA 328 Duemilanova(sp?) and two xbee 2.5's from sparkfun.

I tried the send H receive H playground on the main site.( http://arduino.cc/en/Guide/ArduinoXbeeShield) and it's not working

From what I'm able to tell. The xbee is still sending its commands to the serial port, even when i set the jumpers to xbee. I am unclear if it's suppoed to do this. But i connected my second xbee to the computer directly by popping out the microcontroler on my arduino and setting the jumpers to USB. i figured it should report the commands it receives directly to my screen window, but sadly it did not.

Does anyone have any idea how to troubleshoot this? or if anyone has had any experience with such a problem.

I have varified that the Xbee's ID,CH,DH,DL and MY are the same.

The DH is set to 0 the DL is set to FFFF The ID is set to 281, the CH is set to 0,and the My is FFFE

Please Help --Kevin

The DH | DL of one XBee needs to be set to the MY address of the other and vice versa.

I have software examples in the applications hints at http://tinyurl.com/5rfmrz

(* jcl *)

Does this mean that things don't actually work as explained in the Xbee tutorial?

"You should be able to get two Arduino boards with Xbee shields talking to each other without any configuration, using just the standard Arduino serial commands"

I followed the rules with two Arduino/Xbee Shield combos and it doesn't work. The second arduino apparently transmits but the first one doesn't receive anything.

Does this mean that things don't actually work as explained in the Xbee tutorial?

"You should be able to get two Arduino boards with Xbee shields talking to each other without any configuration, using just the standard Arduino serial commands"

That statement is correct. You use the standard Arduino serial commands to configure the XBee.

Did you look at my XBee transmit/receive application hint? The exact commands you need to get two XBees communicating are my application hint. You just need to change the baud rate in my example to match your board.

(* jcl *)

Thanks for the info. I’ve modified my code to set the addresses but they still don’t communicate.

What I’ve done exactly is to have to Duemilanove board each connected to an Xbee shield. I set the jumpers to USB and upload the following two sketches. I replace the jumpers to Xbee and the problem is that after the init sequence completes the sender keeps sending (I can see TX blink) but the receiver doesn’t receive anything (doesn’t blink the LED).

int outputPin = 13;
int val;

void setup()
{
  Serial.begin(9600);
  pinMode(outputPin, OUTPUT);
  blink(1000);
  set_xbee_destination_address();
  blink(1000);
  blink(1000);  
}

void set_xbee_destination_address() 
{
  long count = 0;
  // put the radio in command mode:
  Serial.print("+++");
  // wait for the radio to respond with "OK\r"
  char thisByte = 0;
  while (thisByte != '\r') 
  {
    if (Serial.available() > 0) 
    {
      thisByte = Serial.read(); 
    }
    if (count++ > 100000) break;
  }

  if (count <= 100000) {
     // set the destination address, using 16-bit addressing.
     // if you're using two radios, one radio's destination 
     // should be the other radio's MY address, and vice versa:
     Serial.print("ATDH0, DL1234\r");
     // set my address using 16-bit addressing:
     Serial.print("ATMY5678\r"); 
     // set the PAN ID. If you're working in a place where many people
     // are using XBees, you should set your own PAN ID distinct
     // from other projects.
     Serial.print("ATID1111\r");
     // put the radio in data mode:
     Serial.print("ATCN\r");
     
     blink(100);
     blink(500);
     blink(100);
     blink(500);
     blink(100);
     blink(500);
  } else {
     blink(5);
  }
}

void blink(int t) 
{
 digitalWrite(outputPin, HIGH);
 delay(t);
 digitalWrite(outputPin, LOW);
 delay(t);  
}
    

void loop()
{
  if (Serial.available()) {
    val = Serial.read();
    if (val == 'H') {
      digitalWrite(outputPin, HIGH);
    } 
    if (val == 'L') {
      digitalWrite(outputPin, LOW);
    }
  }
}
int outputPin = 13;

void setup()
{
  Serial.begin(9600);
  pinMode(outputPin, OUTPUT);  
  blink(1000);
  set_xbee_destination_address();
  blink(1000);
  blink(1000);
}

void set_xbee_destination_address() 
{
  long count = 0;
  // put the radio in command mode:
  Serial.print("+++");
  // wait for the radio to respond with "OK\r"
  char thisByte = 0;
  while (thisByte != '\r') 
  {
    if (Serial.available() > 0) 
    {
      thisByte = Serial.read(); 
    }
    if (count++ > 100000) break;
  }

  if (count <= 100000) {
     // set the destination address, using 16-bit addressing.
     // if you're using two radios, one radio's destination 
     // should be the other radio's MY address, and vice versa:
     Serial.print("ATDH0, DL5678\r");
     // set my address using 16-bit addressing:
     Serial.print("ATMY1234\r"); 
     // set the PAN ID. If you're working in a place where many people
     // are using XBees, you should set your own PAN ID distinct
     // from other projects.
     Serial.print("ATID1111\r");
     // put the radio in data mode:
     Serial.print("ATCN\r");
     
     blink(100);
     blink(500);
     blink(100);
     blink(500);
     blink(100);
     blink(500);
  } else {
     blink(5);
  }
}

void blink(int t) 
{
 digitalWrite(outputPin, HIGH);
 delay(t);
 digitalWrite(outputPin, LOW);
 delay(t);  
}
   
void loop()
{
  Serial.print('H');
  delay(1000);
  Serial.print('L');
  delay(1000);
}

It helps having the RSSI LED connected to pin 6 of the XBee module, like this XBee shield board has (http://www.nkcelectronics.com/freeduino-arduino-xbee-shield-v20-k21.html). You can either install a LED or measure the PWM0 activity using an oscilloscope (I think a multimeter can work too). If the 2 Xbee are next to each other and you don’t see strong RSSI signal, then the modules are not communicating. A loop test using X-CTU is also helpful.

Thanks, in my shield I've got PWM0 (6th pin from VCC) and PWM1 (7th pin) and pwm0 seems to be always down and pwm1 high (+3.3V). I checked it using a scope.

There seems to be no difference with having and not having another Xbee close.

Now trying the loopback test with X-CTU, the signal goes to the first XBee DIN pin nicely but nothing ever gets to the second XBee. The both Arduinos have their brain removed and the both modems are found with X-CTU Test / Query.

Please help :’(

Just reset both the xbees to defualt settings using XCTU and then set - channell, PAN Id, number of retries and serial communication baud rate. then run the loop test starting from the lowest number of bytes and keep increasing... the xbees seem to be weird working grt at times and completely down at other times. but if u keep the loop test running for some time they will establish communication.

Hi, thanks... Still no luck though

Does it have something to do with this that my XBee modem is of type XB24-B and not XB24 as mentioned in most of the tutorials. The function set doesn't contain XBee retries for example. I also tried to flash the modem with this type but it doesn't seem to be possible.

My problem is exactly the same as the mentioned in

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1222667801

I tried making the other modem coordinator and then it seemed to work better but I guess it should work without this as well as long as I set the MY and destination addresses correctly.