Zigbee: Template¶
This sample is a minimal implementation of the Zigbee Router role.
You can use this sample as the starting point for developing your own Zigbee device.
Requirements¶
The sample supports the following development kit:
Hardware platforms |
PCA |
Board name |
Board target |
---|---|---|---|
PCA10156 |
|
To test this sample, you also need to program the Zigbee Network coordinator sample on one separate device.
Overview¶
The Zigbee Template sample takes the Zigbee Router role and implements two clusters (Basic and Identify) that used to be required by the Zigbee Home Automation profile. The Basic cluster provides attributes and commands for determining basic information about the node. The Identify cluster allows to set the device into the identification mode, which provides a way to locate the device.
Configuration¶
See Configuring and building in the nRF Connect SDK documentation for information about how to permanently or temporarily change the configuration.
User interface¶
- LED 2:
Turns on when the device joins the network.
- LED 3:
Blinks to indicate that the identification mode is on.
- Button 3:
Depending on how long the button is pressed:
If pressed for less than five seconds, it starts or cancels the Identify mode.
If pressed for five seconds, it initiates the factory reset of the device. The length of the button press can be edited using the
CONFIG_FACTORY_RESET_PRESS_TIME_SECONDS
Kconfig option from Zigbee application utilities. Releasing the button within this time does not trigger the factory reset procedure.
Building and running¶
Make sure to configure the Zigbee stack before building and testing this sample. See Configuring Zigbee add-on for more information.
This sample can be found under samples/template
in the Zigbee add-on folder structure.
To build the sample, follow the instructions in Building an application in the nRF Connect SDK documentation for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.
Note
When building repository applications in the Zigbee add-on which is an SDK repository, building with sysbuild is enabled by default.
If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild
parameter to every build command or configure west to always use it.
Testing¶
After programming the sample to your development kit, complete the following steps to test it:
Turn on the development kit that runs the Network coordinator sample.
When LED 2 turns on, this development kit has become the Coordinator of the Zigbee network and the network is established.
Turn on the development kit that runs the Template sample.
When LED 2 turns on, the light bulb has become a Router inside the network.
Note
If LED 2 does not turn on, press Button 0 on the Coordinator to reopen the network.
The device running the Template sample is now part of the Zigbee network as a Router. As a result, the network range is extended by the template application radio range.
Dependencies¶
This sample uses the following nRF Connect SDK libraries:
Zigbee subsystem:
zb_nrf_platform.h
It uses the following sdk-nrfxlib libraries:
ZBOSS Zigbee stack 4.1.4.2 (API documentation)
In addition, it uses the following Zephyr libraries:
include/zephyr.h
include/device.h