Pages: [1] 2 3   Go Down
Author Topic: Configuring XBee ZB S2 modules?  (Read 6178 times)
0 Members and 1 Guest are viewing this topic.
CT
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello All,

After purchasing two XBee ZB S2 modules, to use with Arduino XBee Shields, I found out that the XB S2s are not the best choice for point-to-point communication. However, I also read in a post that it is possible to configure them to do so, although I have not been able to find instructions on how to do so.

Could someone please help a struggling newb?

Thanks much!
Rob

Note: I'll be using Putty and a SparkFun USB-to-XBee Adapter.
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 92
Posts: 3942
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

That's an ugly rumor smiley-lol they work great for P-T-P. There are just a few parameters to set. You have the X-CTU program? Do you intend to use them in AT (transparent) mode or in API mode? One will need to have the coordinator firmware loaded, and probably the router firmware in the other, unless you intend to use sleep mode.

Give us a little more on how you'll use them, and what for.
Logged

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

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

Thanks for the reply.

I'm not really sure which "mode" to use. What I want to do is put each module on one Uno, using XBee shields. One Uno will have a Pot which will control a Servo on the other.

I did install the X-CTU program last night and, using the USB-to-XBee Adapter, was able to read the config values on one of the modules. However, the other module is not found by the X-CTU program. :o I'm guessing it may be faulty?

Thanks again!

Rob
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 92
Posts: 3942
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

I wouldn't assume a faulty module unless I had a very good reason to, especially if they are new. I assume you tried it more than once, i.e. unplug the cable to power it off, reseat it, then try again? I wouldn't hot-swap the modules, disconnect the power (USB) first.

If you're not clear on AT mode vs. API mode, then you need to do some reading. But briefly, in AT mode, two XBees just pass serial data between each other. Think of it as a wireless modem set-up. What goes in the TX pin on one, comes out the RX pin on the other, and vice versa. I believe that this is how a lot of people use the S1 modules. To set this up with S2 modules, one needs the AT Coordinator firmware loaded, and the other needs AT Router firmware. Then three AT commands need to be sent to each module to set its destination address to be the other module (ATDH, ATDL, ATWR). The address is a 64-bit number (16 hex digits) that is on the bottom of the module, and will start with 0013A200.

API mode is more structured, and communicating with the XBee is more demanding from a software standpoint, the sketch has to use well-defined frames to communicate with the XBee. There are some very good libraries out there that help tremendously with API mode. If you haven't already, download the product manual from the Digi web site, as this has all the technical details needed to make XBees jump through hoops. I also highly recommend Robert Faludi's book, Building Wireless Sensor Networks.

So, while easier to set up, AT mode in my mind is actually more difficult in one sense, in that we basically have to deal with a continuous stream of characters, and create our own protocol to send structured data from "A" to "B". If we're not careful to cover all the bases, it will be more error-prone as well. I don't recommend that a person new to XBees should jump right into API mode, although I think that is almost always the better solution.

My recommendations for you:

1. Start with AT mode, set the two XBees up to "chat" back and forth as described above. This can be done with two computers or with two terminal programs running on one computer.

2. Get your project with the pot and servo working on a single Uno. I would hope that you've already done this, and are not attempting to eat the whole elephant in a single bite.

3. Now introduce the second Uno, and devise a way to send and receive the data using AT mode. Send data on some fixed interval. Start slow, maybe once a second, maybe even slower. Once that works, speed it up to every 100ms.

4. Lather, rinse, repeat with API mode smiley-lol

XBees, S1 or S2, are fairly complex little beasts. The product manual for the S2 is about 150 pages, and even that for the S1 is about 70 (S1 also has API mode). Nevertheless, they work very well, will do a lot for you, and they aren't hard to use if you will take the time to understand them first. For my money, the S2 is a better deal. It has mesh networking which works really well if you add more modules, the transmitter and receiver have slightly better specs, and it actually costs a couple bucks less when bought direct from Digi (which is the best price I've found). Hope you have fun and enjoy learning about these very cool and powerful modules. Let us know how it goes!




Logged

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

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

Thanks for the very detailed response!

I do have the sketch working on one Uno. No way I'd bite off trying to do that and wireless in the first go. smiley-wink

I tried the modules, in both X-CTU and PUTTY, several times, disconnecting the USB cable each time. I've also rebooted the machine several times. I am consistently able to read the settings on one module, and consistently not able to read the other (it simply doesn't find this module in X-CTU or Putty).

I contacted the supplier I purchased them from and am sending them back. I'll look into purchasing a pair of S1s from Digi.

Question: Do you know if the S1s work out-of-the-box or if they require configuration as well?

Thanks again,
Rob

BTW: I'll download the S1 manual and give that a read.

Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 92
Posts: 3942
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

Sorry, never worked with S1, I'm a known S2 bigot ;-)
Logged

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Question: Do you know if the S1s work out-of-the-box or if they require configuration as well?
Digi says they work out-of-the-box, but that simply is not true. Configuration is minimal, just setting PAN ID (the default one is OK), MY and DL (the defaults are not OK).
Logged

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

Hey, I have the same modules (xbee pro s2)  and I am having problems connecting through my shield using x-ctu.  I can connect to either board when using the explorer board but when I put it on the shield on the arduino, nothing.  the "assoc" led is flashing steadily.  I checked ground, power, DIN, DOUT.  DIN = pin 0, DOUT = pin 1.  is there setup on the arduino that i am missing?  I havent done anything yet to tell the arduino to tx and rx from pins 0 and 1. 
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 92
Posts: 3942
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

Hey, I have the same modules (xbee pro s2)  and I am having problems connecting through my shield using x-ctu.  I can connect to either board when using the explorer board but when I put it on the shield on the arduino, nothing.  the "assoc" led is flashing steadily.  I checked ground, power, DIN, DOUT.  DIN = pin 0, DOUT = pin 1.  is there setup on the arduino that i am missing?  I havent done anything yet to tell the arduino to tx and rx from pins 0 and 1. 

Not sure I understand. The XBee is plugged into a shield, which is plugged into an Arduino, and you're trying to use X-CTU? Not sure that makes sense. Which shield do you have? Given that you haven't done anything to get the Arduino to talk to the XBee, why do you expect something other than "nothing"?
Logged

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The XBee is plugged into a shield, which is plugged into an Arduino, and you're trying to use X-CTU? Not sure that makes sense.
Actually, you can program an XBee this way, if you have first removed the ATMega chip from the Arduino. Since you have an explorer board, it is so much simpler to program the XBees using that.
Logged

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

I've found a tutorial in youtube "Tutorial: How to Setup configurate Xbee Devices (Hard and Software) with an Arduino". Follow that one, I've successful configured Xbee. Perhaps it will help.
Logged

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

First of all keep in mind that im still pretty new to this. 

so, when i'm using xctu you said to first do this:

Quote
To set this up with S2 modules, one needs the AT Coordinator firmware loaded, and the other needs AT Router firmware.


when i select coordinator or router it actually says "coordinator API" and "Router API", is that ok?  I am assuming it is since there is nothing else similar.  It's confusing because I thought i was specifically setting it up for AT. 

Also, im not sure how exactly to do this:

Quote
Then three AT commands need to be sent to each module to set its destination address to be the other module (ATDH, ATDL, ATWR). The address is a 64-bit number (16 hex digits) that is on the bottom of the module, and will start with 0013A200.

Although if you tell me where exactly i send those commands from (terminal?) i might be able to figure it out.

Quote
Actually, you can program an XBee this way, if you have first removed the ATMega chip from the Arduino. Since you have an explorer board, it is so much simpler to program the XBees using that.

I have programmed the xbees using the explorer, i just cant get the one on the shield on the arduino to work when i take it off the explorer and put it on the shield.

this is the shield i'm using:
http://www.geeetech.com/arduino-mega-io-expansionxbeeshield-v5-p-230.html

I thought i had found the problem when i discovered that the voltage on pin 3 on the xbee, on the shield, is low (1.1v).  i tried to follow the printed circuit on the shield without success.  That still may be the problem, if it is then i should be able to sever whatever connection IS there and solder in a jumper to pin 1.  Right?  smiley 

Anyway, i have lots more questions but i dont want to piss you guys off right away
Logged

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

Actually i havent "programmed" them yet.  I have only selected the router and coordinator firmware and wrote it to the xbees.  I have not been able to send the commands setting up the ID's of the boards yet.
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 92
Posts: 3942
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

when i select coordinator or router it actually says "coordinator API" and "Router API", is that ok?  I am assuming it is since there is nothing else similar.  It's confusing because I thought i was specifically setting it up for AT.

That's the firmware for API mode, you want the firmware for AT mode. In X-CTU, start on the PC Settings tab. Click the Test/Query button, it should come back with a confirmation that it can talk to the modem OK. Now go to the Modem Configuration tab and click the Read button. Under Modem it should say XB24-ZB, under Function Set it should say either ZIGBEE ROUTER AT or ZIGBEE COORDINATOR AT (I forget which is installed at the factory).

So one module should be ok, and one should need firmware updated, because you want one Coordinator and one Router.  So select the Function Set you want to write to the module, check the "Always Update Firmware" box and click the Write button.

Quote
Also, im not sure how exactly to do this:

Quote
Then three AT commands need to be sent to each module to set its destination address to be the other module (ATDH, ATDL, ATWR). The address is a 64-bit number (16 hex digits) that is on the bottom of the module, and will start with 0013A200.

Two choices here. (1) On the Modem Config tab, under addressing, click the DH parameter, enter the desired address. Repeat for DL. Then click the Write button (clear the Always Update Firmware because that's already been done).

(2) On the Terminal tab, enter the commands directly. To get into command mode, type "+++", command mode times out in 10 seconds I believe.
Logged

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

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

ok thanks.  I was able to do all that.  I was confused because I thought when you select the modem type you had to put in the model that you have.  I guess you can pick whatever you want.  anyway, I think I have to go through the "unbrick" process because when I finished the second programming and "wrote" when it reset I lost ability to communicate with it.  suck.  Am I right about unbricking it?  i havent tried again today but last night i tried everything i knew.  unplugged, tried different baud rates, actually that's all i know to try.  smiley

thanks for the help, this is great stuff
Logged

Pages: [1] 2 3   Go Up
Jump to: