Zigbee: Template

This Zigbee 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 kits:

Hardware platforms

PCA

Board name

Build target

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52833 DK

PCA10100

nrf52833dk_nrf52833

nrf52833dk_nrf52833

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nRF21540 DK

PCA10112

nrf21540dk_nrf52840

nrf21540dk_nrf52840

You can use one or more of the development kits listed above and mix different development kits.

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 your application for information about how to permanently or temporarily change the configuration.

FEM support

You can add support for the nRF21540 front-end module to this sample by using one of the following options, depending on your hardware:

  • Build the sample for one board that contains the nRF21540 FEM, such as nrf21540dk_nrf52840.

  • Manually create a devicetree overlay file that describes how FEM is connected to the nRF5 SoC in your device. See Set devicetree overlays for different ways of adding the overlay file.

  • Provide nRF21540 FEM capabilities by using a shield, for example the nRF21540 EK shield that is available in the nRF Connect SDK. In this case, build the project for a board connected to the shield you are using with an appropriate variable included in the build command. This variable instructs the build system to append the appropriate devicetree overlay file. For example, to build the sample from the command line for an nRF52833 DK with the nRF21540 EK attached, use the following command within the sample directory:

    west build -b nrf52833dk_nrf52833 -- -DSHIELD=nrf21540_ek
    

    This command builds the application firmware. See Programming nRF21540 EK for information about how to program when you are using a board with a network core, for example nRF5340 DK.

Each of these options adds the description of the nRF21540 FEM to the devicetree. See Working with RF front-end modules for more information about FEM in the nRF Connect SDK.

To add support for other front-end modules, add the respective devicetree file entries to the board devicetree file or the devicetree overlay file.

User interface

LED 3:

Turns on when the device joins the network.

LED 4:

Blinks to indicate that the identification mode is on.

Button 4:

Depending on how long the button is pressed:

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/template in the nRF Connect SDK folder structure.

See Building and programming an application for information about how to build and program the application.

Testing

After programming the sample to your development kit, complete the following steps to test it:

  1. Turn on the development kit that runs the Network coordinator sample.

    When LED 3 turns on, this development kit has become the Coordinator of the Zigbee network and the network is established.

  2. Turn on the development kit that runs the Template sample.

    When LED 3 turns on, the light bulb has become a Router inside the network.

    Note

    If LED 3 does not turn on, press Button 1 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:

It uses the following sdk-nrfxlib libraries:

In addition, it uses the following Zephyr libraries:

  • include/zephyr.h

  • include/device.h

  • Logging