A ZigBee mesh network is created by a coordinator. Once the network has been created, other nodes can join it. The default device type of the XBee modules is router, so you must configure an XBee to be the coordinator. Note that the rest of the modules should be switched on (or reset) once the network is created so that they can join it properly.
Configure the device type of an XBee
The device type of an XBee is determined by the value of two parameters: Coordinator Enable (CE) and Sleep Mode (SM). The first setting determines if an XBee module is coordinator or not, while the second one determines if the module is router or end device. Coordinators and routers cannot sleep, so the value for that setting must be always 0 (disabled).
Configuration | Description | |
Coordinator | CE = 1 SM = 0 |
An XBee module will be a coordinator if the CE setting is set to 1. When CE = 1, the value of the SM setting cannot be different than 0. |
Router | CE = 0 SM = 0 |
An XBee module will be a router if the CE setting is set to 0 and the sleep mode is disabled. |
End device | CE = 0 SM ≠ 0 |
An XBee module will be an end device if it has any sleep mode enabled. |
Startup operations
When an XBee module is powered on, it performs several operations depending on the role it has assigned. The following sections explain the operations and commands performed by coordinators, routers, and end devices to form or join a network.
Coordinator
The coordinator is the only device that can start a network, so each ZigBee network must have one coordinator. It is responsible for selecting an unused operating channel, PAN ID, security policy, and stack profile for a network. To ensure the coordinator starts on a good channel and unused PAN ID, it performs a series of scans to discover any RF activity on different channels (energy scan) and to discover any nearby operating PANs (active scan).
The following commands control the coordinator network formation process:
- PAN ID (ID). Determines the PAN ID. If set to 0 (default), a random PAN ID will be selected.
- Scan Channels (SC). Determines the scan channels bitmask the coordinator uses to form a network. The coordinator will perform an energy scan on all enabled SC channels.
- Scan Duration (SD). Sets the scan duration, which determines how long the coordinator performs an energy or active scan on a given channel.
After the coordinator has started the network, it can allow new devices to join it (up to 20 devices). The permit joining attribute is configurable with the Node Join Time (NJ) command. It can be configured to always allow joining (0xFF, default), or to allow joining for a short time. The coordinator can also route data packets and communicate with other devices on the network.
Router
Routers must discover and join a valid ZigBee network before they can participate in it. To discover nearby networks, the router performs an active scan, just like the coordinator does when it starts the network. When a router joins a network, it receives a randomly selected 16-bit address from the device that allowed the join.
Once a router joins a ZigBee network, it remains connected to the network on the same channel and PAN ID as long as it is not forced to leave. If the scan channels, PAN ID, and security settings do not change after a power cycle, it will remain connected to the network after a power cycle. There are two provisions to automatically detect the presence of a network, and leave if the check fails:
- Join Verification (JV). If enabled, the XBee will attempt to discover the address of the coordinator when it first joins a network.
- Network Watchdog Timeout (NW). Used for a powered router to periodically check for the presence of a coordinator to verify network connectivity.
After a router has joined a network, it can allow new devices to join the network (up to 20 devices each router) with the Node Join Time (NJ) setting. It can also route data packets and communicate with other devices on the network.
End device
Similar to routers, end devices must also discover and join a valid ZigBee network before they can participate in it. End devices also discover networks by issuing an active scan, and when they join a network they receive a randomly selected 16-bit address from the device that allowed the join.
Since an end device may enter low power sleep modes and not be immediately responsive, it relies on the device that allowed the join to receive and buffer incoming messages on its behalf until it is able to wake and receive those messages. The device that allowed an end device to join becomes the parent, and the end device becomes a child of that parent. The end device polls its parent when it is awake to query for any new received data packets.
Coordinators and routers maintain a table of all child devices that have joined. This table has a finite size and determines how many end devices can join. The Number of Remaining Children (NC) setting can be used to determine how many additional end devices can join a coordinator or router.
After an end device has joined a network, it can communicate with other devices on that network. Since end devices are intended to be battery powered and therefore support low power (sleep) modes, they cannot allow other devices to join, nor can they route data packets.
Explore the network
To better understand how a ZigBee mesh network is formed, you can use XCTU’s Network view to discover and visualize the topology and interconnections of the network.
To form a ZigBee mesh network, you must configure at least the following settings:
PAN ID (ID). Every node should have the same value.
Scan Channels (SC). Every node should have the same value.
Channel Verification (JV). This setting should be enabled to ensure there is a coordinator in the network.
Coordinator Enable (CE). This setting should be enabled in one module.
Sleep Mode (SM). If you want to have end devices, set their sleep mode to some other value than 0.
Note that there are other less critical settings under the Networking group in XCTU that also influence network creation.
How-to: Visualize your network
XCTU’s Network working mode allows you to discover and visualize the topology and interconnections of your network. Refer to the Manage your radio network section for more information.
Scan the network
To discover the network, follow these steps:
1. Once you have added the XBee module to XCTU, switch to Network working mode.
2. Click Scan the radio module network to start the network discovery process.
The modules are dynamically added as they are discovered, showing their connections and link quality.
The Network working mode of XCTU allows you to discover and see the topology of your radio module’s network. To do this, select the Network working mode in the toolbar
NOTE: The Network perspective only works in API operating mode. Radio modules in AT (transparent) mode do not support the network discovery process.
Scanning the network
Clicking the Start button scans the radio module’s network and returns a list of available modules. It might take some time to finish searching. As the radio modules are found, they are shown in the working area.
The discovery process automatically stops when the scans specified in the preferences finish, although you can stop it by clicking the Stop button.
At the bottom, XCTU shows the following:
On the left side:
- The number of network nodes (17 nodes)
- The PAN ID ([PAN ID: BAB05A])
- The Channel ([CH: 11])
- The status (<Scanning>) (it can be Getting information, Initializing scan, Scanning, Waiting for next scanor Stopped)
On the right:
- The current scan number (Scan 2)
- The estimated remaining time to finish the current scan (Remaining: 00:00:21)
- The total time passed since the network scan was started (Total: 00:00:39)
Switching the view
The Network perspective offers two modes for displaying the network of your local radio module:
Graph view
The radio modules are graphically displayed as nodes of the network, showing each module’s role (Coordinator, Router, or End Device) and MAC address, as well as the 16 bit Network Address for ZigBee networks and Node Identifier for the rest of protocols. Hover the mouse cursor over a node to see more information about its connections.
Nodes discovered in previous scans that have not already been found are displayed in lighter color; they will turn on as they are discovered. The connections that are not discovered yet have a dotted line, while a solid line represents an active connection. Selected nodes are marked in blue and connections in black.
Radio modules coloured in red represent devices that are in the network (or have been) but are unreachable now. When a radio module leaves the network, some devices continue to store information about their relationship. So, when a new discovery is performed, the module appears because of the preserved information, but the device is unreachable if you try to verify the connection.
If you double click a node, XCTU switches to the configuration mode displaying the settings of that node. If the node was not in the list of remote nodes, XCTU will add it before displaying its settings.
You can change the network layout by clicking Set layout. There are six types of layouts:
- Composite
- Spring
- Vertical tree
- Horizontal tree
- Grid (default)
- Radial
The graphic view includes a zoom level. You can set the zoom level of the network by entering a percentage between 10 and 400.
Table view
In this second view, the radio modules of the network are displayed as rows in a table. For ZigBee devices, the End Devices appear as children of their Coordinators or Routers. In other protocols, all nodes are at the same level.
The table has five columns:
- Role: Coordinator, Router, or End Device.
- MAC: The 64-bit address of the module.
- Network Address for ZigBee devices or Node Identifier for other networks.
- Last scan: the number of scan when the device was discovered for the last time.
- Connections: Click Show connections to see another table with information about its connections.
In this case, nodes discovered in previous scans that have not already been found are displayed in grey and italics. The connections that are not discovered yet are also in grey.
Radio modules colored in red represent devices that are in the network (or have been) but are unreachable now.
In both views, the node with a green background corresponds to the local radio module, whereas the one with a blue background is the selected module.
- For more information please visit: tenettech.com
- For technical query please send an e-mail: info@tenettech.com