Home
Zigbee Mesh routing - Interactive Tutorial | Print |
Written by Akiba   
Tuesday, 08 April 2008

Man. I spent the last three days learning how to use Flash so I could create this simple tutorial. You'd think that it would be easy to create a simple interactive thing like this, but it was actually extremely painful. You can't just draw the symbols and move things around. You actually need to program in a language that Adobe (MacroMedia) made called ActionScript. The programming part is no problem, but searching the massive documentation to find the right method to do what I wanted caused me to pound a large hole in the wall with my head. I still don't know why it requires a zillion languages just to do some stuff on the web.

Anyways, this is something that I've been wanting to do for a long time. Trying to explain Zigbee mesh routing using just words is very difficult, and has the tendency to cause people's eyes to glaze over. With an interactive simulation, you can do a play-by-play analysis of what's going on which hopefully will make it easier to see the flow of events that makes up the AODV routing algorithm. I originally had the idea when I was studying the routing algorithm myself. It's almost impossible to understand what's going on by reading the Zigbee spec. That's like trying to understand how to use Linux by reading the source code. You need to be a real masochist. 

There weren't many good tutorials on the web for AODV mesh routing, either. So to save the people the same pain I had to go through in studying it, I created this little applet. To move forward one frame, just click anywhere on the graphic. To move back, press the space bar. Flash doesn't have a handler for the right-click button, because Apple users usually only have one mouse button. You can't tell who will be using the Flash file since it's accessed inside a web browser. You'll need to have Adobe Flash v9 installed (or higher depending on when you're reading this) in order to use it. Otherwise, it will probably just give you a bad graphic, no graphic, or it will cause your computer to explode.

I'm also planning to try and make other tutorials similar to this for tree routing, source routing, and possibly some other aspects of Zigbee. I think its much easier to learn visually than reading that monster document. Without further ado, here's the tutorial. Hope you like it. If there are any problems, leave a comment for me...especially if you find bugs. 

Once you understand how the Zigbee routing works, then you can see that the terms that are being thrown around like "self-healing" are more a property of the routing algorithm. If a node goes down, then it won't participate in the route discovery process and so a different route will automatically be discovered. Okay, in my scenario, there were no redundant routers to the destination so that doesn't count. 

Also, there are other subtleties associated with the algorithm used in Zigbee such as the use of "link cost" to determine the best route. This is the probability that the link may successfully transmit the frame and is a factor of interference, remaining battery life, and a gazillion other things. Its mainly subjective and depends on the company that does the implementation. There's no agreed upon way of calculating this so the spec just kind of leaves it as a ranking between 1 and 7 on how confident you think the frame will get transmitted. In my initial implementation, I'm just going to leave it as a static value. The path cost will then just reflect the number of hops from the source to the destination and the path with the least amount of hops will be chosen. Yes, its not very academic, but hey, I just want to get it to work. I'll let other people tinker with optimizing the routing depending on their needs.

Well, that just about does it for this post. Unfortunately, the research behind it took much longer than actually writing it, but at least future simulations will be much easier to make. Hope you enjoy. 

Edited 2008-04-09: I just found out that Internet Explorer 7 disabled Javascript and Active X by default which seems like its required in order to run the Flash applet. Sorry about that. 

 

Hits: 10108
Trackback(0)
Comments (9)Add Comment
...
written by ward, December 07, 2008
very clear, thanks !
report abuse
vote down
vote up
Votes: +3
...
written by geoff, February 24, 2009
cheers for this overview, very helpful! smilies/smiley.gif
report abuse
vote down
vote up
Votes: +0
...
written by Geoff, March 11, 2009
By the way, are the source and destination sequence numbers being shown in the animation? Did you remove them because they aren't really required for understanding? Just wondering how important they are. Wikipedia's article on AODV mentions a few issues with AODV concerning intermediate nodes holding recent but not up to date DestSeqNum's. They mention that it can cause intermediate nodes to hold inconsistent routes.

I'm not quite sure if I fully understand how the sequence numbers can cause inconsistent routes to be created, do you reckon you could add some explanation about it to this article? Wikipedia touches on that issue very briefly but doesn't explain it properly. Sorry to be such a nagging grandma! smilies/cheesy.gif
report abuse
vote down
vote up
Votes: +0
...
written by Akiba, March 11, 2009
The src/dest seq numbers aren't being shown. Actually, the Zigbee version of AODV uses what's called route request IDs (RREQ ID) that are stored in the route discovery tables when you are looking for a new route. Those entries are purged after a certain amount of time, which I believe is to handle the issue of stale discovery entries that you mentioned.

As for an explanation of how a stale entry can mess things up, in AODV, when you are discovering the route, you need to send a route discovery frame (route request). These get broadcast to the network and are tagged with an identifier (RREQ ID). If you don't purge these, then it's possible that some time later, a route request from a different node with the same ID comes through. Needless to say that this is not a good situation. Here's the gory details of what can happen: if the route discovery frame has a path cost less than the old discovery entry with the same RREQ ID, then the new discovery frame will be dropped and the old one will be kept. The old entry however is irrelevant to the current route discovery process that is going on so it can seriously screw up the algorithm.
report abuse
vote down
vote up
Votes: +0
...
written by Geoff, March 12, 2009
"if the route discovery frame has a path cost less than the old discovery entry with the same RREQ ID"

Hey is this supposed to be less than or more than?
report abuse
vote down
vote up
Votes: +0
...
written by Akiba, March 12, 2009
sorry. temporary brain freeze. it should be "more than", which would trigger the frame to get dropped and the old entry to be kept.
report abuse
vote down
vote up
Votes: +0
about AODV implementation
written by upasna, March 24, 2009
hello sir i want to implement this AODV algo in C#.NET. Sir, PLZ help me.
report abuse
vote down
vote up
Votes: +0
AODV implementaion in C#
written by upasna, March 24, 2009
sir can u give me idea how we implement it in C#
report abuse
vote down
vote up
Votes: +1
...
written by Akiba, March 24, 2009
I assume you want to write a simulator in C# for AODV. I think the only way to do it is to translate an existing implementation to C# or write one from scratch. I had to write a small sim in C using the Zigbee spec to test out the algorithm before I implemented it.
report abuse
vote down
vote up
Votes: +0

Write comment

busy
 

Discuss (29 posts)

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 09 2009 12:58:41
Thanks for the clarification. i was trying to implement a single route table and a single entry for a route which was causing all sorts of doubts. now i am planning to implement a discovery table that will fix my RREP forwarding problem.

the rfc for adov is a bit confusing. can you tell me if i have covered every thing to take care of forwarding a RREQ.this is what im doin:
1. check if the node which got the RREQ is the destination if so send RREP to precursor
2. if the nde is not destination then,
2.1 decrement TTL
2.2 check if the destination sequence number in the RREQ packet is lesser than what is there at the node.which ever bigger update in packet only not route table
2.3 update discovery table f required
2.4 increase hop count
2.5 broadcast new RREQ packet.

is this fine..?
#999

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 09 2009 23:18:38
If it works, do it...
#1003

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 10 2009 04:18:17
i have this doubt about hello msg. Are hello msgs sent to all the neighbors of the node or only to the nodes in the active path?
#1007

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 10 2009 12:51:02
Zigbee uses link status messages to ping the links at a specified period. The links are pinged as a one-hop broadcast with no retries hence, they go to everyone within listening range, ie: all neighbors.
#1015

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 10 2009 14:03:11
Hi
what all would be the entries for a reverse path route entry?
#1018

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 10 2009 15:35:00
can i maintain discovery table ie precursor address, originator address and RREQ id at every node instead of reverse path entry in the route table?

i will do this while im sending RREQ, and when i reach the destination node, i will start creating route table entry for the destination. is this alright?
#1019

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 10 2009 23:57:19
Discovery table is implemented on every node and holds a temporary entry for the particular route request. It does not just exist on the reverse path. It is used to find the reverse path and keep track of the path cost.
#1022

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 11 2009 04:01:22
Im not clear with the what should i update in the route table while dealing with RREQ packets.
my route table has following entries:
dest address
dest seq num
next hop
hop count
lifetime
list of precursors
valid dest seq flag
state flags....

but while i do a path discovery i don't have values for all the entries. what am i suppose to do then. is it enough that i maintain only discovery table while i propagate RREQ and make entries to route table while i create and send back RREP...?

I will be waiting for a reply before i start this implementation....
#1023

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 11 2009 06:12:44
can i maintain a discovery table and avoid using a reverse path entry in the route table...if im sure that i will always have a single source.
#1024

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 12 2009 01:29:43
You're going about this the wrong way. When I was first designing the AODV portion of the routing, I wrote a very small application on the PC that would simulate portions of AODV so that I could observe their behavior. It's especially useful to observe through GDB so you can see how your variables are affected.

If you can get AODV working on a small sim/app and actually find your target nodes, then you should move on to implementing full AODV on whatever device you're trying to do it on. If you're trying to do a full implementation without understanding what you're implementing, it's doomed to failure.
#1029

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 13 2009 05:46:00
hi
Actually we are using a similar style for AODV implementation (first on the PC and then on the board) only thing is that 5 of us are taking up different parts of the algorithm and trying to implement their own part. once that is done then would come the testing part. Only after the testing would the integration start.

Im involved in the path discovery part which takes care of the forward and reverse path setup.

So is it necessary to maintain the reverse path or can i omit that entry in the route table and maintain a discovery table. The RREP packet would take help of the discovery table to get back to the source.

and discovery table would exist as long as the path exists.

can you help me find some flaw in this implementation.?
#1035

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 13 2009 06:18:41
Yowzah...an AODV implementation divided into five separate efforts. That's going to be a nightmare...
#1036

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 13 2009 06:31:32

Lets take that as a compliment. The initial coding is over. and testing is yet to start. I have used the idea which i mentioned before to take care of the reverse path. just wanted to clarify if thats gonna be alright. cause if not the i will have to re work the whole thing and would halt the others progress too...
#1037

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 14 2009 07:45:23
What all wud be the fields i need to save at the intermediate node while rreq is being propagated.?
rite now im having
RREQid
Source address
the address of node which send the RREQ..
shud i save the dest seq num too.?
#1040

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 15 2009 02:01:03
Since you mentioned that its a multi-person effort, it wouldn't be much challenge if I gave you all the answers now would it
#1045

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 17 2009 06:18:54
ok...
by the way we have finished the individual coding and the individual unit testing....so we are two steps closer to the "nightmare" becoming a dream...
thanks for the tips you have given....
#1061

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jul 31 2009 08:55:13
Hey
Guess wat...?
The nightmare is soon gonna become a dream.....
But we are stuck i a small part...we are using hello message for maintaining a route..so suppose i have a master(position (0,0)), one intermediate node(0,2) and a destination(0,4)
Im able to establish a path between master and destination through intermediate node..and hello messages are being send between the neighbours...now im making the destination fail..so the intermediate node generates a RERR and sends it to the master..
Problem starts after this...master and intermediate invalidates the route to destination....but they dont stop sending hello message between each other...my doubt is that should i stop this behaviour...because now there is no node and henceforth no active nodes...rite?
Why this occurs is because the intermediate node has a entry for master in its discovery table...and master resets the timer to delete the route entry cause it receives hello from the intermediate node....
#1149

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Aug 02 2009 01:37:17
Sounds like you're making good progress. In regards to your question, I think that if a node ceases to be on the network, you should probably stop pinging it.
#1152

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Aug 07 2009 06:16:59
Hi
I found now concept which has not been mentioned(or which i have missed) in the AODV algorithm....
suppose a intermediate node fails...RERR is send to all the sources informing about all the affected destinations......but the nodes which are present between the destination and the node that failed...what happens to them....Right now in our algorithm we haven't taken care of that so they maintain a "hello msg" connectivity among them as if nothing has happened.
i wonder if this is gonna be of any use. cause that path is maintained and will not be deleted until the nodes there fail even if there is no communication between them...isn't this a flaw..but i cant figure out how to fix this...?
can u give me some idea how to fix this...? or is this wat the algorithm expects...?
#1175

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Aug 07 2009 12:09:22
Can't help you much with your issue. I haven't implemented periodic network status messages yet so I don't have much experience with this problem.
#1179

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Sep 09 2009 10:29:15
Im back...and yes i have not disappointed anyone....AODV simulator implemented and now totally into implementing it on xbee pro module...and once successful will be moving onto the microchip board...
#1280

Akiba
Re:Zigbee Mesh routing - Interactive Tutorial
Sep 09 2009 12:43:05
Congratulations. Getting the AODV working is not a simple task and is the heart of a WSN stack. Good luck on the rest of your project!
#1281
AODV completed
Re:Zigbee Mesh routing - Interactive Tutorial
Nov 06 2009 09:13:36
Sorry for the delayed reply....we have successfully implemented and tested AODV algorithm(in mid October) on xbee-pro modules and is perfect...testing took place with two fixed nodes and a mobile node which keeps moving between the nodes. Each time the node reaches the vicinity of a fixed node, it is detected and as it moves out its lost...

Thanks for the support....

next step porting it to microchip boards...


Deepak
#1425
jason
Re:Zigbee Mesh routing - Interactive Tutorial
Jan 07 2010 20:46:34
Zigbee is supposed to be battery powered? Did you implement power-save AODV? Can you share any details?
#1587

Deepak Gopalakrishnan
Re:Zigbee Mesh routing - Interactive Tutorial
Jan 08 2010 11:28:29
Though zigbee is suppose to be battery powered, we had xbee modules which drew power from the laptops to which they were connected.

Yes, one concept we did include to reduce the power consumption. We removed the repeated transmission of hello msgs and used the concept of link layer acknowledgements instead.

this actually wasnt for power reduction. it was to reduce the number of msgs sent on air...which in turn will help in reducing power.

hope this was of any help
#1590
There are too many comments to list them all here. See the forum for the full discussion.

Discuss...
< Prev   Next >