Arduino + XBee + XBee Explorer Regulated

For the discussion of Arduino related topics.

Moderator: phalanx

Arduino + XBee + XBee Explorer Regulated

Postby nsa4ever » Sun Jan 16, 2011 12:00 pm

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.
Attachments
Img_2155.jpg
my receiver arduino..
Img_2149.jpg
both XBee Explorer Regulated are well solder
Last edited by nsa4ever on Sun Jan 16, 2011 3:15 pm, edited 1 time in total.
nsa4ever
 
Posts: 7
Joined: Sun Jan 16, 2011 11:28 am

Re: Arduino + XBee + XBee Explorer Regulated

Postby waltr » Sun Jan 16, 2011 12:17 pm

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.
waltr
 
Posts: 2651
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: Arduino + XBee + XBee Explorer Regulated

Postby nsa4ever » Sun Jan 16, 2011 12:35 pm

Hello waltr :)

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
Attachments
from_the_book.jpg
Image form the book: Building Wireless Sensor Networks: With ZigBee, XBee, Arduino, and Processing from Robert Faludi
nsa4ever
 
Posts: 7
Joined: Sun Jan 16, 2011 11:28 am

Re: Arduino + XBee + XBee Explorer Regulated

Postby waltr » Sun Jan 16, 2011 2:29 pm

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.
waltr
 
Posts: 2651
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: Arduino + XBee + XBee Explorer Regulated

Postby nsa4ever » Sun Jan 16, 2011 6:31 pm

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));
}
}
Attachments
imagem1.jpg
connect two arduinos, rx tx, tx rx
nsa4ever
 
Posts: 7
Joined: Sun Jan 16, 2011 11:28 am

Re: Arduino + XBee + XBee Explorer Regulated

Postby waltr » Mon Jan 17, 2011 7:09 am

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
 
Posts: 2651
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: Arduino + XBee + XBee Explorer Regulated

Postby follower » Mon Jan 17, 2011 7:17 am

waltr wrote:Yes, connect them as in the picture.
I think there's a shared ground connection missing...

--Philip;
follower
 
Posts: 280
Joined: Sun Mar 14, 2010 11:58 pm

Re: Arduino + XBee + XBee Explorer Regulated

Postby waltr » Mon Jan 17, 2011 9:00 am

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).
waltr
 
Posts: 2651
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: Arduino + XBee + XBee Explorer Regulated

Postby nsa4ever » Mon Jan 17, 2011 9:09 am

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.
Attachments
imagem2.jpg
correct connection between two arduinos, tx -> rx and rx -> tx
nsa4ever
 
Posts: 7
Joined: Sun Jan 16, 2011 11:28 am

Re: Arduino + XBee + XBee Explorer Regulated

Postby nsa4ever » Wed Jan 19, 2011 6:21 am

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
nsa4ever
 
Posts: 7
Joined: Sun Jan 16, 2011 11:28 am

Re: Arduino + XBee + XBee Explorer Regulated

Postby waltr » Wed Jan 19, 2011 8:09 am

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.
waltr
 
Posts: 2651
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: Arduino + XBee + XBee Explorer Regulated

Postby nsa4ever » Wed Jan 19, 2011 9:36 pm

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?
nsa4ever
 
Posts: 7
Joined: Sun Jan 16, 2011 11:28 am

Re: Arduino + XBee + XBee Explorer Regulated

Postby waltr » Thu Jan 20, 2011 7:16 am

Those connections are correct.
waltr
 
Posts: 2651
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: Arduino + XBee + XBee Explorer Regulated

Postby nsa4ever » Thu Jan 20, 2011 4:53 pm

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?
nsa4ever
 
Posts: 7
Joined: Sun Jan 16, 2011 11:28 am

Re: Arduino + XBee + XBee Explorer Regulated

Postby waltr » Thu Jan 20, 2011 6:13 pm

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/
waltr
 
Posts: 2651
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA


Return to Arduino

Who is online

Users browsing this forum: No registered users and 4 guests

cron