nRF5 SDK for Thread and Zigbee v1.0.0
BLE UART and Zigbee Light Switch Example with touchlink commissioning
This example requires the following SoftDevice: S140

Important: Before you run this example, make sure to program the SoftDevice.

This dynamic multiprotocol example application is based on the ble_app_uart example available in nRF5 SDK v15.0.0. It has been extended to support dynamic switching between two protocols, BLE and Zigbee, at the same time (concurrently). From the Zigbee protocol perspective, this example implements touchlink initiator with dimmable light switch, as described in the Touchlink Initiator example.

In order to support both protocols at the same time, the Zigbee stack uses the 802.15.4 radio during Bluetooth low energy radio's inactive time (using Timeslot API). Depending on the Bluetooth low energy connection interval, the nRF52840 SoC may spend up to 99% of the radio time on the Zigbee protocol. This is the same mechanism as the one used inside Thread Dynamic multiprotocol examples. For more information on multiprotocol operation please refer to Multiprotocol support support section.

Note
Transmitting and receiving data does not break connections from any of the used radio protocols (BLE or Zigbee).

This BLE-Zigbee multiprotocol example requires running one of the examples containing Zigbee Touchlink Target role. You can find this example in the Zigbee Light Control with touchlink commissioning example.

LED assignments:

Button assignments:

Pressing BSP_BUTTON_1 after successful commissioning (BSP_LED_3 state) will turn off the Zigbee light bulb. Pressing BSP_BUTTON_0 will turn it back on. Using a long press adjusts the brightness level of the light bulb. BSP_BUTTON_1 decreases the brightness and BSP_BUTTON_0 increases the brightness.

Note
If the user reduces the brightness level to the minimum, the effect of turning on the light bulb might not be noticeable. Pressing BSP_BUTTON_2 will restart the touchlink commissioning procedure.

BLE UART command assignments:

Remarks

Setup

You can find the source code in the following folder: <InstallFolder>\examples\multiprotocol\experimental\ble_zigbee_dynamic_touchlink_switch_nus

Testing

  1. Prepare two nRF52840 Preview Development Kits and an Android or iOS smartphone.
  2. On the smartphone, install nRF Toolbox for BLE.
  3. Run the following commands to flash the Zigbee touchlink target example to one of the boards:
    $ cd <InstallFolder>/examples/zigbee/experimental/touchlink/target/hex
    $ nrfjprog -f nrf52 -r --program nrf52840_xxaa.hex --chiperase
  4. Build the example according to the instructions in Building examples.
  5. Flash SoftDevice and the example according to the instructions in Running examples.
  6. Start all boards as described in Zigbee Light Control with touchlink commissioning example.
  7. Press BSP_BUTTON_2 on the light switch to start the touchlink procedure. The BSP_LED_3 should turn on.
  8. Wait until BSP_LED_2 on both boards turns on. If that does not happen, and BSP_LED_3 on the switch is turned off, restart commissioning procedure by pressing BSP_BUTTON_2.
  9. After successful commissioning you can control BSP_LED_3 on the light bulb node by pressing BSP_BUTTON_0 and BSP_BUTTON_1 on the light switch node.
  10. Open nRF Toolbox and choose the UART application.
    nrftoolbox_dynamic_zigbee_uart_1.png
    nRF Toolbox - UART application
  11. Tap EDIT and configure five application buttons.
    • Enter command "n" (EOL = LF)
    • Enter command "f" (EOL = LF)
    • Enter command "t" (EOL = LF)
    • Enter command "i" (EOL = LF)
    • Enter command "d" (EOL = LF)
      nrftoolbox_dynamic_zigbee_uart_2.png
      nRF Toolbox - UART application - Configure button
  12. After all buttons are configured, tap DONE.
  13. Tap CONNECT and select the Zigbee_touchlink_UART device.
    nrftoolbox_dynamic_zigbee_uart_3.png
    nRF Toolbox - UART application after establishing the connection
  14. Observe that BSP_LED_0 on the multiprotocol light switch board is turned on, indicating that the BLE connection has been established.
  15. You can control BSP_LED_3 on the Zigbee light bulb node by pressing the left ("n" - command), middle ("t" - command) and right ("f" - command) button from your smartphone.
  16. You can also adjust the brightness level by pressing the top ("i" - command) and bottom ("d" - command) button from your smartphone.
  17. If you want to test delayed toggle command, you may add another button with numeric command or create a separate configuration (screen).
    nrftoolbox_dynamic_zigbee_uart_4.png
    nRF Toolbox - Add configuration
  18. For example, you may add buttons to toggle the light bulb after 1 ("1" - command), 3 ("3" - command), and 9 ("9" - command) seconds.
    nrftoolbox_dynamic_zigbee_uart_5.png
    nRF Toolbox - Delayed toggle commands

Documentation feedback | Developer Zone | Subscribe | Updated