Go Down

Topic: Single XBee shield blues (Read 1 time) previous topic - next topic


Hello forum, got some really embarrassing questions. It seems everyone has trouble getting two xbees talking to each other, I have managed to mess up a monologue. Here goes.

I got an xbee shield & xbee similar to this one (not actually from that shop but it looks identical, got mine from a phyisical shop).

I downloaded X-CTU and after immense amounts of trouble managed to upload into it and set it up as ZIGBEE ROUTER/END DEVICE AT. In X-CTU's terminal, it responds to +++ and replies to AT commands.

So far so good.

Now, I thought I 'd take tiny little baby steps and try chatting between the Arduino and the shield (as opposed to between XBee-ed Arduinos) since I only have one Arduino (Duemilanove) right now.

So, the last section on Arduino's XBee shield reference page ("Configuring the Xbee Module") seems to imply that it's fairly easy for the Arduino to get the XBee into configuration mode and then have a talk via AT commands. Well...

First sign of trouble, shield on top, jumpers to "XBee", when trying to upload any sketch, the IDE reports that:

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding

Damn! I haven't seen anyone else reporting you have to have the shield off when uploading but maybe I haven't been looking. So, first question, do you?

Anyway, I can upload the damn thing and then stick the shield on so that kinda works, till I hit the next obstacle, with the shield on, weird chars appear in the IDE's monitor (baud rate is checked). Sometimes most of these go away with a few delay() statements thrown around the code but sometimes everything is gibberish. So, question number two, WTF?

Still, I have an LCD and I 'm not afraid to use it. The shield allows access to pins 8-13 so I requisitioned 12 and 13 for NewSoftSerial and fed the following sketch to my board:


#include <NewSoftSerial.h>

NewSoftSerial LCD(12, 13);

const int bufferSize = 10;
char ca[bufferSize];

void setup() {
 LCD.print(12, BYTE);
 delay(10000);                      // normally one second should be enough for XBee to answer but let it breathe
 int i = 0;
 while(Serial.available() > 0) {
   ca[i++] = Serial.read();
   LCD.print(".");                 // show if there's activity
 ca = '\0';
 LCD.print("end");                // if this prints alone, nothing got received

void loop()

Just a couple of comments,  LCD.print(12, BYTE); clears the LCD.  Serial.begin(19200); is just a value I got at some Arduino/XBee tutorial (can't find it now) since I didn't have a clue what kind of baud rate the Arduino/XBee chatter should be at. Is that an OK value?

Now, no prizes for guessing that the code prints a single "end" and that's it. So, I 'm out of ideas. Any help would be greatly appreciated.


I haven't seen anyone else reporting you have

There is a jumper on that shield. You have to have the jumper in the USB position to upload sketches, and in the Xbee position to have the Arduino talk to the XBee.

The xbee takes whatever appears on the TX pin of the Arduino and broadcasts it to any other radios on the XBee frequency along with some additional information (who it's from, who can decode it, etc.). If those other XBees are in the right PAN, and are the target of the message, they might do something with the data and reply.

The sending XBee listens for responses, and puts whatever it hears on the RX pin of the Arduino.

With just one XBee, you are listening to the sound of one hand clapping with the Serial Monitor.

You really do need two radios to do anything useful.

I won't tell anyone you were asking
really embarrassing questions.
The art of getting good answers lies in asking good questions.


Jan 10, 2010, 12:30 am Last Edit: Jan 10, 2010, 12:32 am by ardudillo Reason: 1
You have to have the jumper in the USB position to upload sketches, and in the Xbee position to have the Arduino talk to the XBee.

Duh, how stupid am I?  :P

And of course you 're right, I should be trying with two Arduinos but for the time being one is all I have (you 'll get some real gems when I get the second one, just you wait).

Still, the question remains, why don't I get an "OK<CR>" to my "+++"? I should be getting replies from the XBee right? The way I understand it, with the jumpers in the XBee position, Serial.print() statements go to both the XBee and the computer via USB with the only drawback being that the comp can only receive but not talk. So, my sketch should at least print some reply from the XBee (BTW, my 10 seconds delay is enough for the XBee to drop out of configuration mode. This value is just for extravagance, I have also tested with around 1.5 seconds. Also, the replies, if any, should be waiting around in the Arduino's buffer till Serial.read() fetches them).

Also, any idea why the garbled chars when printing to the IDE's serial monitor?


I haven't had any experience with Xbee yet, but normally in Serial monitor, when it's "garbage" coming through, either, you're reading too fast for the buffer to fill up, which is doubtful.... or it's at the wrong baud rate.

Like I said.. no experience with Xbee, so not sure what they're baud rates normally are, but try changing your baud rate and see if that makes a difference.

Go Up