Zigbee AODV protocol basics
This page on zigbee tutorial describes Zigbee AODV protocol basics. The AODV protocol is used as routing protocol in zigbee network.
The 802.15.4 Zigbee protocol specifies two address types
viz. 16 bit network addresses and 64 bit addresses.
16 bit address network address is assigned to a node when it joins the network. It is unique to each node in the zigbee network. These addresses are not static and will change. Hence node requires a new network address under following conditions:
• If there is communication issue between END device and its parent, then end device will leave the zigbee network and rejoin to findout new parent.
• If the device type changes from end device to router and vice versa, then device will leave the network and rejoin as new device type.
Zigbee requires that data to be transmitted is sent to 16 bit network address of the destination node or device. Hence it is important to know 16 bit address of the destination before transmission of the data.
Each node contains 64 bit address which is unique and permanent.
The ZigBee application layers define endpoints and cluster identifiers (cluster IDs) that are used to address individual services or applications on a device. An endpoint is a distinct task or application that runs on a ZigBee device, similar to a TCP port. Each ZigBee device may support one or more endpoints. Cluster IDs define a particular function or action on a device. Cluster IDs in the ZigBee home controls lighting profile, for example, would include actions such as "TurnLightOn","TurnLightOff", "DimLight", etc.
All data packets are addressed using both device and application layer addressing fields. Data can be sent as a broadcast, or unicast transmission.
Broadcast transmissions within the ZigBee protocol are intended to be propagated throughout the entire network such that all nodes receive the transmission. To accomplish this, all devices that receive a broadcast transmission will retransmit the packet 3 times.
Each node that transmits the broadcast will also create an entry in a local broadcast transmission table. This entry is used to keep track of each received broadcast packet to ensure the packets are not endlessly transmitted. Each entry persists for 8 seconds. The broadcast transmission table holds 8 entries. For each broadcast transmission, the ZigBee stack must reserve buffer space for a copy of the data packet. This copy is used to retransmit the packet as needed.Large broadcast packets will require more buffer space. Since broadcast transmissions are retransmitted by each device in the network, broadcast messages should be used sparingly.
As zigbee communication in unicast mode rely upon 16 bit destination address and this address is not permanent. It is required to identify 16 bit address from known 64bit address before the transmission begins. This identification is done using network address discovery protocol. Route discovery is done using AODV routing protocol.
Network Address Discovery:
Data transmissions are always sent to the 16-bit network address of the destination device. However, since the 64-bit address is unique to each device and is generally known, ZigBee devices must discover the network address that was assigned to a particular device when it joined the PAN before they can transmit data.
To do this, the device initiating a transmission sends a broadcast network address discovery transmission throughout the network. This packet contains the 64-bit address of the device the initiator needs to send data to. Devices that receive this broadcast transmission check to see if their 64-bit address matches the 64-bit address contained in the broadcast transmission. If the addresses match, the device sends a response packet back to the initiator, providing the network address of the device with the matching 64-bit address. When this response is received, the initiator can then transmit data.
ZigBee employs mesh routing to establish a route between the source device and the destination. Mesh routing allows data packets to traverse multiple nodes (hops) in a network to route data from a source to a destination. Routers and coordinators can participate in establishing routes between source and destination devices using a process called route discovery. The Route discovery process is based on the AODV (Ad-hoc On-demand Distance Vector routing) protocol.
AODV (Ad-hoc On-demand Distance Vector) Routing Algorithm
Routing under the AODV protocol is accomplished using tables in each node that store the next hop (intermediary node between source and destination nodes) for a destination node. If a next hop is not known, route discovery must take place in order to find a path. Since only a limited number of routes can be stored on a Router, route discovery will take place more often on a large network with communication between many different nodes.
|Node||Destination Address||Next Hop Address|
|C||Router 6||Router 5|
|R5||Router 6||Router 6|
When a source node must discover a route to a destination node, it sends a broadcast route request command. The route request command contains the source network address, the destination network address and a path cost field (a metric for measuring route quality). As the route request command is propagated through the network (refer to the Broadcast Transmission), each node that re-broadcasts the message updates the path cost field and creates a temporary entry in its route discovery table.
fig-1: Sample Route Request (Broadcast) Transmission Where R3 is Trying to Discover a Route to R6
When the destination node receives a route request, it compares the 'path cost' field against previously received route request commands. If the path cost stored in the route request is better than any previously received, the destination node will transmit a route reply packet to the node that originated the route request. Intermediate nodes receive and forward the route reply packet to the source node (the node that originated route request).fig-2:
Retries and Acknowledgments: Here R6 can send multiple replies if it identifies a better route. ZigBee includes acknowledgment packets at both the Mac and Application Support (APS) layers. When data is transmitted to remote device, it may traverse multiple hops to reach the destination. As data is transmitted from one node to its neighbor, an acknowledgment packet (Ack) is transmitted in the opposite direction to indicate that the transmission was successfully received. If the Ack is not received, the transmitting device will retransmit the data, up to 4 times. This Ack is called the Mac layer acknowledgment.fig.3:
In addition, the device that originated the transmission expects to receive an acknowledgment packet (Ack) from the destination device. This Ack will traverse the same path that the data traversed, but in the opposite direction. If the originator fails to receive this Ack, it will retransmit the data, up to 2 times until an Ack is received. This Ack is called the ZigBee APS layer acknowledgment.