Arduino Uno, Xbee Chip, Xbee Arduino Shield Pair

I'm trying to get a pair of arduino Uno using Xbee Chip with Xbee arduino shields communicating.

I am new to Arudinos and their development environment..
but basically what I'm trying to accomplish is:

One Side:
Arduino-->Xbee/Arduino Sheild--->Xbee
transmit something

Other Side:
Arduino-->Xbee/Arduino Sheild--->Xbee
receive something

its sounds pretty straight forward, but i'm struggling with this a little.
I want to make sure the hardware is setup correct then I can deal with the software and how to get a basic tx/rx program downloaded on the boards.

Thanks!

This should get you started down the right path: Tutorial 9 for Arduino: Wireless Communication – JeremyBlum.com

Why would you buy a shield and not buy the 50 cents worth of headers and use it as a shield?

what are headers?

DeathByToast:
This should get you started down the right path: Tutorial 9 for Arduino: Wireless Communication – JeremyBlum.com

Thanks for the link, I will try it now

I was using X-CTU to change the PAN ID and the Destination Address Low which are changable.
But for some reason the "MY - 16-bit Network Address" is read only. It won't let me change it..
Any ideas?

I was using X-CTU to change the PAN ID and the Destination Address Low which are changable.
But for some reason the "MY - 16-bit Network Address" is read only. It won't let me change it..
Any ideas?

If you want the XBees to talk to each other just exchanging serial data, you have the wrong Function Set selected. The Function Set defines what settings are used/alterable.

which function set should be selected?

I changed the Function Set to all the different ones, but not able to change/configure the " MY - 16-bit Network Address"

??

Are you sure it's supposed to be using the XB24 ZB set? I have series 1's with antennas and I am using just XB24 and the default function set.

This is the transciever that I'm using. I think its series 2.

I'm not sure which one i'm supposed to be using. But I left it on XB24 ZB then tried chaing all the function sets, but none of them let me change the MY network address field

According to this page if you scroll down a ways, it should be set to XB24-B.

the XB24-B doesn't do anything either.
If I put it on the XB24, I can change the MY Network Address field. But then when I hit "Write" it gives me a checksum failed.

what settings should these be on?

I'm following the Tutorial 9 for Arduino: Wireless Communication – JeremyBlum.com tutorial. The ATMY command does changes this "MY - 16-bit Network Address" field, right?
or is it another field?

You've perhaps noticed that the XBees in that video do not look like yours. His are Series 1 models. Yours are not. Using Series 2 models to do point to point communication, which is not what they are designed for, requires quite different configuration.

surfer007:
the XB24-B doesn't do anything either.
If I put it on the XB24, I can change the MY Network Address field. But then when I hit "Write" it gives me a checksum failed.

what settings should these be on?

I overlooked this detail but are you reading in first? If not, you should probably do that. I'm not sure if the series 2 come preloaded with firmware but my guess is it should. Since that is probably the case you should be able to read in and get the exact firmware/function set that it is using and be able to go from there to some extent. At the very least this would confirm what firmware it should be using.

Yes the ATMY command would send the AT command to the xbee modem requesting the value stored in MY. Does +++ return OK when typed in the terminal? Make sure that works first. Look up specifics on how to configure series 2 for point to point. Ideally you probably should have gotten series 1 for simplicity but series 2 will just be slightly more complicated to do the same job.

From my understanding, series 2 create a more network-like infrastructure for data communication whereas series 1 merely repeats the data everywhere like a hub.

okok, thanks guys! :slight_smile: This is the kinda information I was looking for. SO yes, I have series 2 and i'm trying to do point to point. And yes looks like those tutorials are using series1.

I'm going to try this one: XBee Series 2 Point to Point Communication

I'm stuck again...on my receive side arduino/xbee

I think the transmitting is working, I see the DOUT led on the shield blinking, but i don't think the receiving end is working correctly. This is the code for that...

//Define Pins
int ledPin = 7;
int val = 0;
int data = 0;

void setup()
{

Serial.begin(9600);
// sets the pin as output
pinMode(ledPin, OUTPUT);

}

void loop()
{

if (Serial.available()) {

//read serial as ascii integer
int ser = Serial.read();

if(ser >= 48 && ser <= 57){
//The ascii equivilent of numbers 0 - 9 are 48 - 57
// so subtracting 46 from the ascii gives us 2 - 12 (the pins we want to use)
data = ser - 46;
if(data == 0){
analogWrite(ledPin, 0);
delay(2000);
}
else{
analogWrite(ledPin, 255);
delay(2000);
analogWrite(ledPin, 0);
delay(2000);
}

}
Serial.flush();
}

delay(500);

}

How can i confirm that it is receving anything from the serial?

if(ser >= 48 && ser <= 57){
        //The ascii equivilent of numbers 0 - 9 are 48 - 57

Then why not just use those values?

if(ser >= '0' && ser <= '9'){
        //No comment needed since it's obvious what's being checked
        // so subtracting 46 from the ascii gives us 2 - 12 (the pins we want to use)
        data  = ser - 46;
        if(data == 0){
          analogWrite(ledPin, 0);
          delay(2000);

So, data is supposed to be 2 to 12, huh? Not too many values in that range are 0, too.

          analogWrite(ledPin, 255);
          delay(2000);
          analogWrite(ledPin, 0);
          delay(2000);

The analogWrite function is for PWM pins, which does not include pin 7.

      Serial.flush();

Why? Do you know what this does? If so, why do you think you need it? If not, why did you put random function calls in your code?