4.7.1 Zigbee Application Demo: Light Control and Monitoring Using Combined Interface

WBZ451 Curiosity Board

Device: PIC32CX1012BZ25048 (MCU) on WBZ451 Module

On-Board: RGB LED, User Button and UART-USB Converter

Introduction

This section describes the demo steps for Light control and Monitoring using Combined Interface on the WBZ451 Curiosity boards.
Figure 4-16. Overview of the Demo

GitHub Repository

The firmware, .hex, and accompanying readme.md file for the application can be found in the GitHub repository

Hardware Requirement

Table 4-12. Hardware Requirement
Tool Quantity
WBZ451 Curiosity Boards2
Micro USB cable2
Personal Computer1

SDK Setup

Software Requirement

Programming the Precompiled Hex File or Application Example

This demo needs two devices. One is the Combined Interface and the other is extended color light.

  1. One of the WBZ451 Curiosity boards is programmed with Combined Interface which can act as Zigbee Gateway/Coordinator. Program the CI pre-compiled hex image by following the steps mentioned in the “Programming the precompiled hex file or Application Example” section of the Zigbee Centralized Network Formation by Combined Interface application on one curiosity board.

  2. Another WBZ451 Curiosity board is programmed with Extended Lights application which can act as Zigbee Router. Follow the below step for programming Extended Lights application on another curiosity board.

Programming the .hex File using MPLAB X IPE

  1. Import and program the Precompiled .hex file is located in "<Harmony Content Path>\wireless_apps_pic32cxbz2_wbz45\apps\zigbee\ext_light\hex" folder
  2. For more details on the steps, go to Programming a Device
    Note: Users must choose the correct device and tool information

Programming the Application using MPLAB X IDE

  1. Follow steps mentioned in the Running a Precompiled Example section

  2. Open and program the application example “ext_light.X” located in “<Harmony Content Path>\wireless_apps_pic32cxbz2_wbz45\apps\zigbee\ext_light\firmware" using MPLAB X IDE

    For more details on finding the Harmony content path, refer to Installing the MCC Plugin

Demo Description

The demo application demonstrates the Zigbee protocol functionality of the PIC32CXBZ/WBZ family of devices and modules. It consists of a ZigBee 3.0 Coordinator and Router implemented as shown below :

Table 4-13. Application Functionality
Application Zigbee Logical Device TypeFunctionality
Combined InterfaceCoordinatorDevice capable of controlling and monitoring other devices. It is typically a mains-powered device like a personal computer
Extended LightsRouterIs a lighting device that can be switched ON/OFF, brightness and color of the light can be adjusted via the color commands.

Zigbee Device Commissioning:

  • The Zigbee router, in other words, Extended Lights can be commissioned and brought to the existing Zigbee network formed by Zigbee coordinator in other words, Combined Interface or can create new Zigbee Distributed network (if there is no nearby network).

Zigbee Light Control:

  • Extended light RGB LED can be controlled from Zigbee Gateway of the same network.

  • When the light status is changed the light change report will be sent to Zigbee Gateway through Zigbee communication.

Demo Steps:

The Zigbee light can be connected to any Zigbee network.

Joining Light with the WBZ451 Combined Interface (CI) Coordinator

Hardware and Software Setup

  1. Supply power to the WBZ451 Curiosity board consisting of the Combined Interface application by connecting a USB cable. Power Supply (PS) Green LED will turn ON when connected to the PC.
  2. The application activity is shown in "Console Log" through on board UART-USB converter
    1. Open TeraTerm and configure as mentioned below:
      Terminal Settings
      • Baud Rate/Speed – 115200 (as configured in SERCOM configuration)
      • Parity – None
      • Data Bits – 8
      • Stop Bits – 1
      • Flow Control – None

      For more details on how to set the “Serial Port” and “Speed”, refer to COM Port Setup

    2. Additionally, local echo and sending line ends with line feeds can be enabled in the PC serial terminal application.
      Figure 4-17. Tera Term Terminal Setup

Network Formation (Coordinator - Combined Interface)

Follow the steps explained in the Network Formation (Coordinator - (Combined Interface)) section to open up the network in CI.

Commissioning (Router - Extended Light)

The Extended Lights can be connected to any Zigbee Gateway (Combined interface running on the WBZ451 Curiosity Board in the previous step).
  1. Supply power to another WBZ451 Curiosity board programmed with “Extended Light.X” by connecting a USB cable. Power Supply (PS) Green LED will turn ON when connected to PC.

  2. Follow step 2 in "Hardware and Software Setup" for UART terminal Setup.

  3. Input command: resetToFN and look for the below logs for successful joining with CI
  4. Success logs : When extended light is successfully commissioned with Combined Interface below log will be seen.
    Figure 4-18. Tera Term

Light Control

RGB LED on the WBZ451 Curiosity board is tied with Zigbee functionality. The LED color and brightness can be changed through Zigbee network.
  • The RGB color can be controlled from Combined Interface through console commands.
  • RGB color is changed from Combined Interface, will be reflected in next received light attribute report in combined Interface
  • The network address of the light is needed to send light control commands to light.
  • This network address can be obtained from Combined Interface console log while commissioning is done. Refer to the above success log for light network address.
Figure 4-19. Network Address
  • Another way to get the network address from light is executing the below command in light side.
     Command: getNetworkAddress 
     Response: f088
  • The table below describes few commands for light control (ON/OFF, brightness, hue and saturation). For more details on the different parameters of the commands, refer to the Zigbee Console Commands section.

    Table 4-14. Control Command
    Command TypeCommandsParameter Details
    RGB LED ONonOff 0x0 0xf088 0x23 -on0x23 Zigbee end-point number used for Light
    RGB LED OFFonOff 0x0 0xf088 0x23 -off0x23 Zigbee end-point number used for Light
    RGB LED brightness changemoveToLevel 0x0 0xf088 0x23 0x45 0x0 0x1 0x0 0x00x45 is the configurable brightness value
    RGB LED color changemoveToHueAndSaturation 0x0 0xf088 0x23 0x45 0x67 0x0 0x0 0x00x45 and 0x67 are the configurable Hue and Saturation values
Other Functionalities
  1. On-board button actions:

    • When the on-board "User Button (SW2)" is pressed for more than 10sec, it deletes all the networking information and brings the device to factory default state. This functionality is available in both Combined Interface and Light devices.

  2. Persistent Data Storage (PDS):
    • The RGB light status (ON/OFF) and brightness values are stored in non-volatile memory called PDS. So, power OFF/ON of extended light, these values persist and RGB LED will reflect accordingly. This PDS storage is tied to Zigbee network.
    • The light ON/OFF status, colour and light brightness is being stored in non-volatile memory in this case. So, power OFF/ON, the LED will be updated with light ON/OFF, color and brightness values retrieved from previous transaction.

Creating Application Device Types From Scratch using MCC

For developing Combined Interface from scratch, refer to the “Creating Application Device Types From Scratch Using MCC” section of Zigbee Centralized Network Formation by Combined Interface

For developing extended light from scratch, refer to the “Creating Application Device Types From Scratch Using MCC” section of Zigbee Application Demo: Light Control and Monitoring using Alexa Echo Plus