IAN LANG ELECTRONICS

Your series 2 modules are in fact modems. They carry on board a tiny computer that, using the explorer and XCTU, we can program to behave in certain ways. This is how we configure them.

 

So, carefully (I mean carefully, if there is one word that can be applied to these modules without question that word is "delicate" so treat them like your auntie's fine china plates) push your module into the explorer the right way up. Mine is the cabled explorer from Sparkfun, as shown below.

 XBee Radio Modules

Go Back Previous Page

The pointy end of the module goes to the opposite end from where the mini USB socket sits, and you can just see the two white lines directing you to do it this way. Once it's in and seated correctly, attach to the USB port.

 

Before you use this, you'll need to install the driver for it. I hate doing that and fortunately it did it when I plugged it in (without a module) all by itself. If you aren't so lucky, you need an FTDI driver which you can get from here:

www.ftdichip.com/FTDrivers.htm

When you're up and running, you can open XCTU. It'll look like this:

Don't worry if your COM is not 12; the computer sets a new random virtual port whenever it finds a new device. My Arduino R2 is on 8, R3 on 11 and USB mouse on 3. I've no idea what's on 4,5,6,7, 9 and 10.

Click on that tab above that says "Modem Configuration" and it'll come up with a screen that looks like this except the window inside will be blank:

The text box above the main window that's labelled "Modem" (where the red highlight is) will probably say "unknown". Click on the Read button and it'll contact your XBee and read it. Now we need to do a bit of setting.  Set all the stuff highlighted red as it is there. If this version does not appear, click the download new versions button, wait or a minute or two, and eventually it will.

This is the module we are going to set as the co-ordinator. We need a bit of tweaking. Set the yellow highlights to the values shown. The PAN address is the Private Area Network - only modules on this PAN can talk to the coordinator. Setting scan channels to FFFF means it will find other modules addressing it automatically. When you're done, click the button marked "Write" to upload the new parameters to your module, and gently take it out of the explorer. Then put a new module in. This is the one we're going to set as the end device or we could set it as a router if we liked. Incidentally put a small piece of coloured tape on the co-ordinator so you know which it is later. We set our second one up like this:

The red and yellow ones reflect what we did on the co-ordinator; we've set the PAN ID to the same as the co-ordinator and all channels. The green highlight is very important because if you don't do it it won't work.

The destination address is the serial number of the co-ordinator and it looks for that to receive and send data from and to.

Every module has a unique serial number. The high part is the same for them all, the low is unique. My co-ordinator's number is 4061B72 and so this cell and any I subsequently add will have to point here too as well as being on the same PAN. If not, they can't talk.

 

This is how we set them up for simple data communication. There are more complicated ways. These we can explore at a later date and add them as an addendum later.

 

The big problem with XBees is that they do not have any logic capabilities. For this, we need to mate them to a microcontroller. I'm using Arduino- here's a project to get started.

Doorbell Project

If you've done that project you'll have noticed that the pair can function as a TX/RX pair almost out of the box.

Configuring for a pair is a little more tricky as not only must the pair be on the same PAN ID and scanning all channels, but each must be referenced to the other exclusively.

 

The way to do this is to give the co-ordinator the serial number of the router and the router the serial number of the co-ordinator  as destination addresses. For the series 2, the destination address high as shaded in the green above is always 13A200. The destination address low is the unique serial number of the other device, which is printed underneath the module and below the 0013A200.

There is another way..........

XBees are designed to be built in networks. The PAN ID keeps that network exclusive and ensures that one PAN ID doesn't interfere with another. Pairing them up together like we did above keeps the pair exclusive, and no other XBees can communicate unless they get the serial numbers of either. Even then they can't do it both ways, unless there's two XBees.

 

BUT......if we set the co-ordinator to have a destination address low of 0, and high of FFFF, and set the router to have a destination address high and low of 0, then the two will act as a mesh. The PAN ID is still keeping your network exclusive to any on the same PAN ID, but if another router or end device is on the same PAN ID it will join your network and send to and receive from your co-ordinator or router. For a network, the latter is ideal. For a singular remote control device, or a simplex multi-device, it's the former.

 

How far will it transmit/receive signals? XBee say in indoor or urban areas the range should be 40 metres, and that's over 130 ft. Not bad. Under ideal line of sight conditions it can be 120 metres. That's 400 ft. Spiffing. More than enough for what we currently need.

 

It's time to introduce some maths. The intensity of the signal is a measure of how much energy is left in it by the time it gets from where it started to the point at which you pick it up. It does this because as it moves it spreads out spherically and so power is dissipated over a wider area. We'd measure it in dBm (or deciBel metres) most probably, though other units can be involved. As the decibel is a logarithmic unit, a halving of power is said to be a loss of 3dB or -3dB.

 

The formula:

 

Intensity = Psource / 4      r

                                                                                                   

2

Put simply, the doubling of the distance from the initial measuring point (1m from the antenna, say) divides  the intensity (thus the power) of the signal by 4 pi r squared- so at 2m you'd get a loss of ~6dB.

In theory. I've said this before and I'll say it many times again after this: RF engineering is not so much a science as it is a black art. So treat the above as a useful guideline, and not as a gospel, because it's based on an ideal antenna known as the isotropic- these do not exist outside of mathematical modelling.

Most technicians take the view that if you stick about the right amount of power in, and it doesn't get where it's supposed to, do some more. If it gets too far, do a bit less. We don't go overboard on maths when we've got spanners.

More>