Zigbee: Network coordinator¶
This Zigbee network coordinator sample establishes the Zigbee network and commissions Zigbee devices that want to join the network.
You can use this sample together with the Zigbee light bulb and the Zigbee light switch to set up a basic Zigbee network.
Requirements¶
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Build target |
---|---|---|---|
PCA10056 |
|
||
PCA10100 |
|
||
PCA10095 |
|
||
nRF21540 DK |
PCA10112 |
|
You can use one of the development kits listed above.
Optionally, you can use this sample with one or both of the following samples:
The Zigbee light bulb sample programmed on one or more separate devices.
The Zigbee light switch sample programmed on one or more separate devices.
You can mix different development kits.
Overview¶
This Zigbee network coordinator sample demonstrates the Zigbee Coordinator role. It is a minimal implementation that supports only the network steering commissioning mechanism.
Configuration¶
See Configuring your application for information about how to permanently or temporarily change the configuration.
FEM support¶
Note
Software FEM support is not present on nRF53 Series devices yet. For now, it also cannot be combined with multiprotocol operation.
You can add support for the nRF21540 front-end module to the sample. See Radio front-end module (FEM) support for more information.
To add support for the nRF21540 FEM, add the provided dts-nrf21540-fem.overlay
devicetree overlay file when building.
The file is located in the samples/zigbee/common
folder.
Make sure that the GPIOs in the file correspond to those in which your front-end module is connected.
Note
You must add the provided overlay file if you use the nRF21540 EK. If you use the nRF21540 DK, build your application for the nrf21540dk_nrf52840 board. The devicetree for the nRF21540 DK already contains the required FEM configuration, so you do not need to add the overlay file.
See Set devicetree overlays for different ways of adding the overlay file.
The easiest way to add the file when building is to set it in the DTC_OVERLAY_FILE
variable.
However, doing so will override the default settings.
For some boards, this sample requires additional overlay files, which are automatically included when building with the default settings.
When you set the DTC_OVERLAY_FILE
variable, you must specify all overlay files that are needed for building.
Check the boards
folder to see the additional overlay files.
Follow the instructions in Providing CMake options to specify the DTC_OVERLAY_FILE
variable.
For example, to build the sample from the command line for an nRF52833 DK with an attached nRF21540 EK, invoke the following command within the sample directory:
west build -b nrf52833dk_nrf52833 -- -DDTC_OVERLAY_FILE="boards/nrf52833dk_nrf52833.overlay;../common/dts-nrf21540-fem.overlay"
Alternatively, you can copy the contents of dts-nrf21540-fem.overlay
to the board’s overlay file.
To add support for other front-end modules, add the respective overlay files in the same way.
User interface¶
- LED 3:
Indicates whether the network is open or closed:
On - The network is open.
Off - The network is closed.
- Button 1:
Reopens the network for 180 seconds.
Note
The network is also opened after start-up.
Building and running¶
Make sure to configure the Zigbee stack before building and testing this sample. See Configuring Zigbee in nRF Connect SDK for more information.
This sample can be found under samples/zigbee/network_coordinator
in the nRF Connect SDK folder structure.
See Building and programming a sample application for information about how to build and program the application.
Testing¶
After programming the sample to your development kit, test it by performing the following steps:
Turn on the development kit that runs the coordinator sample. When LED 3 turns on, this development kit has become the Coordinator of the Zigbee network and the network is established.
Turn on the other development kits that you programmed.
When LED 3 turns on the development kit that runs the light bulb sample, it has become a Router inside the network.
When LED 3 turns on the development kit that runs the light switch sample, it has become an End Device, connected directly to the Coordinator.
Tip
If LED 3 on the development kits does not turn on, press Button 1 on the Coordinator to reopen the network.
Optionally, if you are testing with both the light bulb and the light switch samples, complete the following additional steps:
Wait until LED 4 on the development kit that runs the light switch sample turns on. This LED indicates that the switch found a light bulb to control.
Use buttons on the development kit that runs the light switch sample to control the light bulb, as described in the light switch sample’s user interface section. The result of using the buttons is reflected on the light bulb’s LED 4.
You can now use buttons on the light switch to control the light bulb, as described in the User interface section of the light switch sample page.
Dependencies¶
This sample uses the following nRF Connect SDK libraries:
include/zigbee/zigbee_error_handler.h
Zigbee subsystem:
zb_nrf_platform.h
This sample uses the following sdk-nrfxlib libraries:
ZBOSS Zigbee stack 3.6.0.0 (API documentation)
In addition, it uses the following Zephyr libraries:
include/zephyr.h
include/device.h