Sample ZigBee or Digi Mesh network using XBee radios

In this example, a total of three XBee radios will be networked. There are some network limitations involved, but the network can support up to thousands of nodes. Adding additional nodes can be done by repeating the steps outlined in this article.

To begin, load one of the XBee modules with the ZigBee AT Coordinator firmware (Note: This same process can be used on a Digi Mesh network but there is no Coordinator or Router options as they are all routers in digi Mesh) and the remaining radios with the ZigBee AT Router firmware. Upgrading firmware can be done using XCTU.

In this example we will assign each radio with a unique Network Identifier using the NI command. Identifiers of "coordinator", "router1", and "router2" will be assigned to the modules. Nodes can be individually identified via a unique Network Identifier, or each node's unique IEEE 64 bit MAC address.

Note: In the example below, sequences in blue are information sent to the RF module as seen from an X-CTU Terminal screen. Sequences in red are representative of the RF module''''s responses as shown from X-CTU.

Example:

+++  
OK  
ATNIcoordinator  
OK  
ATWR  
OK  
ATCN  
OK  
 

This should be repeated for each radio in the network. Load the radios that are to be Routers with the ZigBee AT Router firmware, and repeat the process for each Router. Assign a Network Identifier of "router1" and "router2" to the two remaining ZigBee nodes.

Start a network by first powering up "coordinator". By default, the radio has a PAN ID (ID) = 0.  When ID=0 the radio will self select an Operating Pan ID (OI).  A Pan ID can be assigned by the user by setting a value to the ID parameter.  For channel selection, the radio will select an available channel as dictated by the Scan Channel (SC) parameter.

Once the Coordinator is configured, the Routers will automatically associate themselves to the Coordinator as long as it is the only network in range. The Channel, Operating PAN ID, and the 16 bit Network Address (MY) will be automatically assigned upon successful association.

Several ways to identify successful association are, through the ATAI command, and the association pin, which will pulse approximately two times per second upon successful association.

Once Router1 and Router2 have associated to the network, send the ATND command to coordinator to see the association information of the associated nodes. An example of the ND response can be seen listed under the ND command in the product manual.

To establish a one way connection form one XBee to another within the PAN, we will use the Destination Node (DN) command. In this example, a one way connection from ''coordinator'' to ''router2'' will be formed.

From ''coordinator'' key the following:

+++  
OK  
ATDNrouter2  
0013A20040001AAE  
143E  
 

The above response indicated that ''coordinator'' was able to establish a network connection to ''router1''. Once the route has been discovered, ''coordinator'' will automatically exit command mode. Messages can now be sent from ''coordinator'' to ''router2''. Other network connections can be established by passing the desired node's Network Identifier in the DN command in the above sequence.

A modules network assigned addressing can be reset to a new state using the NR0 (Network Reset) command.  This will cause it to leave its current network and search for a new association.  This can be useful if a module has previously associated to a different network.

Note: This exercise involved a Coordinator and 2 Routers. The same network connection can be made between any two nodes in a network and may or may not involve the Coordinator node.

Last updated: Jan 01, 2024

Filed Under

GatewaysRFRF Dev kits

Recently Viewed

No recently viewed articles

Did you find this article helpful?