Pages: [1]   Go Down
Author Topic: Configuring Xbees?  (Read 1330 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi. I'm trying to make an Arduino UNO and a Pro Mini communicate wirelessly via Xbee. I think I have configured the Xbees correctly using X-CTU. I am using an Xbee Explorer to connect the transmitter to the UNO. More specifically, I have connected the GNDs and 5Vs and the Explorer's DOUT to pin 0 and DIN to pin 1. In the code I just used Serial.print(i++); where i is simply an integer that is increments every time the loop is run with a 1-second delay. The UNO is not connected to a computer while this is running, but running off a 9V battery. I haven't used the Mini yet, but have connected the other Xbee to a funky board (X-CTU communicates with it, so that's not the problem). However, nothing shows up on X-CTU's terminal. Has anyone any ideas as to what's going on?
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 936
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There's about a zillion things that could be wrong.  Different channels, one of them isn't a coordinator.  While we're at it, are these series 1 or 2.  Have you followed any particular tutorial on setting them up and getting them to work?  etc, a little more information is needed.
Logged

Trying to keep my house under control http://www.desert-home.com/

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's about a zillion things that could be wrong.  Different channels, one of them isn't a coordinator.  While we're at it, are these series 1 or 2.  Have you followed any particular tutorial on setting them up and getting them to work?  etc, a little more information is needed.

I basically followed Tom Igoe's tutorial from "Making Things Talk" (an excerpt I found a while ago) and another one that I cannot find at the moment that just had some up-to-date details the first one is missing. Also, they are both series 2 (they have an "S2" printed on them). I have no idea how to make one a coordinator or why this is important (they are just two, but I suppose you know better; I'm totally new to this stuff). I THINK I have set the channels up correctly (they have the same ID (1111). Is there any other important detail you might need? Thanks in advance.
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4095
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Every XBee S2 network needs exactly one coordinator. Use Digi's X-CTU program to load the coordinator firmware on one of the modules. See my blog post for an explanation of the simplest way to make two S2 modules talk. Best not to mess with channels or any other settings; as draythomp says, there are many things that can go wrong. XBees have lots of settings. Resist the temptation to fiddle with the knobs until you know what you are doing. The default settings will be fine almost always. While you're using X-CTU, reset both modules to factory default status and start again at square one.
« Last Edit: January 18, 2013, 01:33:07 pm by Jack Christensen » Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Every XBee S2 network needs exactly one coordinator. Use Digi's X-CTU program to load the coordinator firmware on one of the modules. See my blog post for an explanation of the simplest way to make two S2 modules talk. Best not to mess with channels or any other settings; as draythomp says, there are many things that can go wrong. XBees have lots of settings. Resist the temptation to fiddle with the knobs until you know what you are doing. The default settings will be fine almost always. While you're using X-CTU, reset both modules to factory default status and start again at square one.

Oh, ok. But if one is a coordinator, it will still be able to exchange other kinds of information with the other Xbee (such as sensor readings). I won't need a third Xbee, right?
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 936
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A coordinator can do anything the other one can do, sort of.  See, the coordinator has to be on all the time (to coordinate), so it can't be put to sleep and awake to send something.  It can still transmit serial data, read its i/o pins, that kind of stuff, but it can't be turned off or bad things will happen to your network.

Everything you ever wanted to know about XBees: http://ftp1.digi.com/support/documentation/90000976_G.pdf
Logged

Trying to keep my house under control http://www.desert-home.com/

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4095
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, ok. But if one is a coordinator, it will still be able to exchange other kinds of information with the other Xbee (such as sensor readings). I won't need a third Xbee, right?

Correct, a coordinator can do anything that a router can do. There really is almost no difference in using the two, from an application standpoint, default destination addresses are different and that's about it. There are six different firmware options for S2 modules: Coordinator, Router, and End Device, each in AT (transparent) mode or API mode. End Devices are the only ones that can sleep. Get your feet wet with routers first before attempting end devices.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, ok. But if one is a coordinator, it will still be able to exchange other kinds of information with the other Xbee (such as sensor readings). I won't need a third Xbee, right?

Correct, a coordinator can do anything that a router can do. There really is almost no difference in using the two, from an application standpoint, default destination addresses are different and that's about it. There are six different firmware options for S2 modules: Coordinator, Router, and End Device, each in AT (transparent) mode or API mode. End Devices are the only ones that can sleep. Get your feet wet with routers first before attempting end devices.

Thank you very much. I followed the instructions in your blog post and supposedly have set the Xbees up correctly. However, when I try a range test, it always fails miserably. For the moment, I have merely connected the coordinator to my computer with this http://imall.iteadstudio.com/im120525005.html board. The router is connected to an Arduino via an Xbee explorer https://www.sparkfun.com/products/9132. At the moment, I am merely powering the Xbee, and the DIN and DOUT are essentially floating. I don't know wether I should ground them or connect them to pins 0, 1 and re-upload the program with the Serial communication test.
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4095
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much. I followed the instructions in your blog post and supposedly have set the Xbees up correctly. However, when I try a range test, it always fails miserably. For the moment, I have merely connected the coordinator to my computer with this http://imall.iteadstudio.com/im120525005.html board. The router is connected to an Arduino via an Xbee explorer https://www.sparkfun.com/products/9132. At the moment, I am merely powering the Xbee, and the DIN and DOUT are essentially floating. I don't know wether I should ground them or connect them to pins 0, 1 and re-upload the program with the Serial communication test.

Aside from the range test, is data getting through OK?

Range test is a little tricky, it doesn't just work. On the sending module, set the ZigBee cluster ID to the loopback cluster (0x12). See "Link Testing" in section 6 in the product manual. Don't forget to reset the cluster ID once you're done with the range test.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you all. It now seems to be working. Since I am a total newbie, when I tried to read the manual, I got lost. Your help was valuable. I only have one question left. When I use Serial.print(sensor_reading), and sensor_input=Serial.read() on the transmitting and receiving Arduinos respectively, I only get some values roughly between 40 and 60. Is there a problem with the communication of the two Xbees, or is it that I'm just not reading the data correctly (as I said earlier, I am using Serial.print, not Serial.write). Also, can I just use Serial.read(), and store its value in a variable, or do I need some other kind of processing after that?
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4095
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Serial.print() converts a value to ASCII text (human-readable). Depending on the type of data we give it (byte, int, long, etc.) and the actual value, it may produce one or more bytes, one byte (character) for each digit in the value.

Serial.read() reads a single byte.

Sounds like the two ends are operating inconsistently, yes? I'd look at that before I'd suspect the XBees.

As ever, post your code, some days we are not so good at debugging what we cannot see. smiley-wink

As an example, if on the sending end I do

Code:
byte myValue = 42;
Serial.print(myValue, DEC);

That will convert the binary value of 42 (which in data memory is contained in a single byte) to ASCII characters, namely '4' and '2', each of which is a byte and which actually have values of 52 and 50 respectively (see your ASCII code chart).

Now if the receiving end does

Code:
byte myReceivedValue;
myReceivedValue = Serial.read();

I will end up with the value 52 in the myReceivedValue variable, not what I was perhaps expecting.

The more complete answer to the question is that it can be done either way, but the conversion (if any) on one end has to be undone at the other end. I can send binary values and read binary values, or I can send ASCII text, but then on the receiving end I need to convert a string of characters back to a binary value in memory.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Pages: [1]   Go Up
Jump to: