XBee mesh networking, using ATMega168

Hi, I’m using XBee series 2 modules, ATMega168 microprocessor and a maxstream board to make a network. I’m using coordinator and routers modules, as well as AVR Studio software to create the code. I’m with some problems to create all the C code to create the mesh network.

Can someone tell me if exists some code made in this area? How can I create clusters using this tecnology?

Thanks.[/img]

Xbee Series 1 are based on FreeScale’s 802.15.4 chip. No ZigBee meshing.

XBee Series 2 are based on Ember’s chip with ZigBee meshing.

Most student/hobby apps don’t need meshing.

Don’t do meshing unless you must. Instead, use a star topology.

Meshing is needed only if RF conditions and your choice of antenna types and TX power (e.g., XBee PRO) plus obstructions lead to a need for meshing. I say this because meshing is 100 times more difficult than non-ZigBee protocol / firmware configurations.

XBee series 1 is not viable for ZigBee type of meshing. You can do your own “mesh” with static routing if the nodes don’t move.

Xbee series 2 is all about ZigBee. Beware that ZigBee mesh routers cannot be battery powered; end nodes can.

Thanks for your answer Stevech.

What I’m trying to implement is this: install a ZigBee coordinator (The most capable device, the coordinator forms the root of the network tree and might bridge to other networks. There is exactly one ZigBee coordinator in each network), a ZigBee Router (to passing data from other devices) and ZigBee End Device (Contains just enough functionality to talk to the parent node that cannot relay data from other devices). I need to create a network (star topology its a good idea), where its possible to send/receive data from any XBee (making some hops if necessary) to the main computer, where will get all the information. To do this, I need to make a code in C language. Do you have any idea if exist some code made for this situation? I remember you that all the code is “installed” in a atmega168 micro.

Thanks for your help, best regards.

is the routing static, i.e., the nodes don’t move?

Did you consider using Digi’s proprietary routing firmware? I don’t recall if it’s free. If you have series 2, you can use ZigBee with a cluster tree topology.

Otherwise, you’ll need to write your own code to forward all incoming packets to a given address. This code could reside in the XBee but to do so you have to go into a very complex development environment. If you connect a micro, say, a small AVR, to the XBee via a UART 3.3v connection, you can have the AVR forward the data using the AT commands or binary API of the XBee series 1.

Hi, is routing static, the modules are in a static position, maybe in the future I consider put them in a mobile situation.

You write about “Digi’s proprietary routing firmware”. This firmware can forward the packets, in a mesh (or cluster) network?

Thanks.

Yes their protocol can do everything you want to do. It’s very well documented, and basically just involved a lot of bit twiddling to form the proper hex packets. Digi’s website has all kinds of documentation and examples of how to do this. Since you are using a Series 2 module, I would start here: http://www.digi.com/products/wireless/z … module.jsp

I did read somewhere that Digi has C libraries to help make it easier to code in their protocol. I’m not sure if these are free, and they were developed for a different processor. But, you could probably port these to AVR without too much effort (it is C after all).

Good luck on your project.

Ok, thanks.

Best Regards.

claudioalves:
Thanks for your answer Stevech.

What I’m trying to implement is this: install a ZigBee coordinator (The most capable device, the coordinator forms the root of the network tree and might bridge to other networks. There is exactly one ZigBee coordinator in each network), a ZigBee Router (to passing data from other devices) and ZigBee End Device (Contains just enough functionality to talk to the parent node that cannot relay data from other devices). I need to create a network (star topology its a good idea), where its possible to send/receive data from any XBee (making some hops if necessary) to the main computer, where will get all the information. To do this, I need to make a code in C language. Do you have any idea if exist some code made for this situation? I remember you that all the code is “installed” in a atmega168 micro.

First of all I’m assuming your going to be using AT mode rather than API mode to pass serial(?) data to/from the Xbees

I don’t know why you want to make life difficult for yourself. Install the coordinator firmware on the xbee connected to the PC then install the Router firmware on the other Xbees. Set the network and channel for all of them to be the same. The meshing happens automatically, ie if a node can’t see the coordinator directly it’ll use one of the nodes it can see to hop from.

Then in its simplest form this is what will happen:

  1. if the coordinator sends data, each of the xbee nodes will receive it

  2. if an xbee node sends data the coordinator will receive it.

You don’t need to code any of this yourself.

You can configure the coordinator to address each xbee node individually if you want in which case all you need to do is concentrate on your PC application/code.

I use the default mechanism to retrieve sensor data from 1-wire devices around my home. The command is issued from the coordinator and the xbee nodes reply with all the 1-wire devices they have + the data reading. There are a couple of nodes that can’t see the coordinator directly but their data gets through via one of the other nodes.

ScaredyCat

stevech:
XBee series 1 is not viable for ZigBee type of meshing. You can do your own “mesh” with static routing if the nodes don’t move.

Series 1 can use DigiMesh ( http://www.digi.com/technology/digimesh/ )

stevech:
Xbee series 2 is all about ZigBee. Beware that ZigBee mesh routers cannot be battery powered; end nodes can.

Series 2 can use ZigBee mesh.

Comparison whitepaper

http://www.digi.com/pdf/wp_zigbeevsdigimesh.pdf

SC

ScaredyCat:
I don’t know why you want to make life difficult for yourself.

I have used the series 2 modules before both in transparent and API mode. But now I cannot get them to work together. I am not sure if I have defective units or missing something. I can reprogram all of them using x-ctu with the function sets listed for xb24-b modules. Could you give me the setup instructions for one module to connect to many modules mainly to send data but if possible to receive from them as well?

What firmware version is in your Series 2 modules?

Hello,

The meshing is perform automatically by XBee. All you need to do is pass the serial data to it and it will send out the data. Same goes to receiving mode. Just bear in mind, the depth limitation which is stated in the XBee data sheet. One important note on end device, make sure you use the “pin hibernate & cyclic sleep” mode instead of “cyclic sleep” or else when your MCU sends data to it, it won’t receive them as it would most probably in sleeping mode. Always use the CTS pin to check whether it’s ready to receive the data from MCU before sending serial data to it. I used this setup in a jungle and it works. Hope this helps. :slight_smile: