Arduino + XBee + XBee Explorer Regulated

Hello to all,

i’m trying to set up the communication between two arduinos, using the XBee.

I have:

_ 2x Arduinos Duemilanove (http://www.sparkfun.com/products/666)

_ 2x XBee serie 1 (http://www.sparkfun.com/products/8664)

_ 2x XBee Explorer Regulated (http://www.sparkfun.com/products/9132)

_ 1x XBee Explorer USB (http://www.sparkfun.com/products/8687)

i have already updated the XBee to the version 10E8. Both are XB24, with the functionset XBEE 802.15.4, values read from X-CTU.

booth at X_CTU have the same configurations:

CH: E

PAN ID: 4242

DL: 0

MY: 0

serial interface data rate: 9600

i would like to put one arduino sending messages (serial) to the other…

my code in arduino A (sender)

//sender

int data = 7;

int led = 13;

void setup()

{

Serial.begin(9600);

pinMode(data, INPUT);

pinMode(led, OUTPUT);

}

void loop()

{

if (Serial.available() > 0) {

data= Serial.read();

if (data== ‘H’){

Serial.print(data, BYTE);

digitalWrite(led, HIGH);

}

}

else{

digitalWrite(led, LOW);

}

}

my code in arduino B (receiver)

int led = 13;

void setup() {

Serial.begin(9600);

pinMode(led, OUTPUT);

}

void loop() {

Serial.print(“H”);

delay(5000);

}

can anyone help me with the connections with the XBee Explorer and Arduino… please, i’ve already read a lot of web sites and with no luck…

thank you.

First get the two arduinos to communicate without the XBees by connecting the TX on one to the RX on the other (plus a ground). This eliminates all of the XBee issues while you straighten out the arduino code.

Once this is working then connect the XBees.

Also there have been many, many threads on this subject so search the forums.

Hello waltr :slight_smile:

thank you, yes i know, i’ve reading here also … and trying to find the correct tutorial.

So, you said that i should not to connect both of XBees… i was going to try to ignore the explorers regulate and follow the instruction from this book: Building Wireless Sensor Networks: With ZigBee, XBee, Arduino, and Processing

To start do not use the XBee. Just connect the two arduno’s together.

There are some links to using Xbee tutorials. One place to look is in the “Better XBee Docs” in the RF/wireless forum.

Hello waltr

do you mean connect like this? (see image please)

Questions:

do i connect both arduinos to the USB ?

and i’m going tu use this…

//sender

int value, aux;

void setup() {

Serial.begin(9600);

}

void loop() {

value = analogRead(5);

aux = map( value, 0, 1023, 0, 255);

Serial.println(aux, BYTE);

}

//receiver

byte recebe;

int led = 9;

void setup() {

Serial.begin(9600);

pinMode (led, OUTPUT);

}

void loop() {

if (Serial.available()) {

recebe = Serial.read();

analogWrite(13, int(recebe));

}

}

Yes, connect them as in the picture.

I don’t know much about the code. What does analogWrite(13, int(recebe)); do?

Once you have communication between the Arduios working then insert the XBees.

waltr:
Yes, connect them as in the picture.

I think there’s a shared ground connection missing…

–Philip;

You are correct follower. Thanks for catching that.

nsa4ever,

You do need to connect a ground between the two arduio boards as I did state in my first post above.

by connecting the TX on one to the RX on the other (plus a ground).

Hello waltr and follower,

i attach a new picture with the correct connections. If i have only one common ground for both, should i only connect one of them to the USB? or both arduinos to the USB?

when int he code is:

analogWrite(13, int(recebe));

its because i’m trying to put a variable value do the PWM pin on the arduino. and recebe is a variable that i get form the serial connection.

Hello,

i connected and they communicate, with or without the receiver USB connect … and know what should i do to use the xbee?

thank you

Great, development test #1 complete.

Now connect in the XBees as in your first diagrams. Do not change any code in the Arduinos as you know this is working.

Use one of the XBee tutorials and set to addressing on the XBees to point at each other. Try it and you should get the same result as the test without the XBees.

Hello,

but when i’m using the XBee with the Xbee Explorer Regulated i have four conectores:

_ GND

_ 5V

_ DOUT

_ DIN

wich one i’m going to connect with the RX and TX?

can i connect in the sender:

GND → GND

5V → 5V

DOUT → RX

DIN → TX

and in the receiver:

GND → GND

5V → 5V

DOUT → RX

DIN → TX (no need, no sending messages from the receiver)

Is this correct?

Those connections are correct.

Using the X-TCU, i config the following settings:

networking & security

CH (channel): E

ID (pan id): 4242

DL (destination address low): 0

MY (16-bit source address): 0

serial interfacing

BD (interface data rate): 3- 9600

I’ve tryed this settings with booth of the XBee and no luck…

Must i config something else?

Try setting each XBee’s MY address to different values.

XBee #1

MY = 0x0012

DL = 0x0011

DH = 0x0000

XBee #2

MY = 0x0011

DL = 0x0012

DH = 0x0000

Did you go through the threads in the RF/Wireless forum to find link?

Here are some that should be helpful:

http://www.jsjf.demon.co.uk/xbee/xbee.html

& click on the PDF doc link

http://www.faludi.com/projects/common-xbee-mistakes/

http://selmaware.com/appbee/index.htm

Some from google searches:

http://www.ladyada.net/make/xbee/index.html

There may be another issue that concerns the SparkFun Explorer boards circuit design. There have been a number of threads about this issue so search the forums for more.

This issue is due to the use of a series diode on the XBee’s DIN line to protect the XBee from the voltage levels of a processor running from 5V. The common fix that seems to work is removing the diode and inserting a pair of resistors in a “voltage divider” to get 3.3V from the 5V output of the Arduino’s TX pin.

Check this tutorial for a voltage divider and XBee parameter set-up:

http://forums.trossenrobotics.com/tutor … sics-3259/