Configuring XBee ZB S2 modules?

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.

That's an ugly rumor XD 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.

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

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 XD

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!

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. :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.

Sorry, never worked with S1, I'm a known S2 bigot :wink:

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).

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.

tt_tony:
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"?

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.

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.

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:

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:

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.

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? :slight_smile:

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

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.

tt_tony:
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.

Also, im not sure how exactly to do this:

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.

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. :slight_smile:

thanks for the help, this is great stuff

Ok, i have both modules with firmware installed and programmed. now i am checking to see how this shield is wired.

so according to the tutorial, the xbee manual:

3.3v positive -> pin 1 on Xbee
ground -> pin 10 on xbee
TX1 pin on shield/arduino -> pin 3 DIN on xbee
RX0 on arduino/shield to pin 2 on xbee

ignoring the rest of the pins on the xbee for now, this should allow for wireless serial comm, right?

Or do i have to tell the arduino (via the sketch) to look at these pins for data?

ignoring the rest of the pins on the xbee for now, this should allow for wireless serial comm, right?

Yes.

The rest of the pins are similar to the analog and digital pins on the Arduino. Sensors can be directly connected to the other pins, and, if the XBee is configured to read them, the pin states/values will be transmitted, too.

Wow, I wasnt aware of that ability to directly send data from other inputs, although i see it on the pinout now. I see there are 12 I/O's on the xbee, that is pretty cool. But you could potentially send even more signals than that by using the I/O's on the arduino too right? man that is sweet. so much potential, just have to come up with a project that uses all of it's capability.

one last question. :slight_smile:

I don't expect anyone to be familiar with this shield in particular, and I can't find a schematic for it, but is there supposed to be any resistors or diodes between the arduino tx, rx pins and the xbee?

Because there is actually NO connection from xbee pin 3 to arduino pin 1. xbee pin 3 is connected to ground by what looks like a resistor with a "103" written on it. Anyway, as of now i'm planning on soldering in a jumper and breaking that other connection unless someone can tell me why i shouldnt.

By "break the connection" i plan on scratching out the printed circuit in a place that is easily repairable, just in case it causes problems.

maybe one more question.

is there some reference that will help me identify these tiny components on the shield and arduino?

tt_tony:
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. :slight_smile:

thanks for the help, this is great stuff

Not sure about picking whatever you want. In X-CTU, the S2 modules are called XB24-ZB. XB24 is the first part of the model number. ZB for ZigBee. I've been lucky enough not to have to unbrick any, so cannot comment there, sorry. I think 9600 should be the default baud rate though.

Thanks, i was able to get that problem straightened out a couple hours ago. It seems i have at least one more obstacle to get past concerning the shield I bought. I mentioned it in an earlier post if you have any insight.

thanks