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

WBZ451 Curiosity Board

Devices (Device): | PIC32CX1012BZ25048(MCU) on WBZ451 Module |

Peripherals (Used, On-Board): | RGB LED | User Button| UART-USB Converter|

Introduction

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

Hardware Requirement

Tool Quantity
WBZ451 Curiosity Boards 2
Micro USB cable 2
Personal Computer 1

SDK Setup

Software Requirement

  • TeraTerm

Programming the Precompiled hex file or Application Example

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

  1. One of the WBZ451Curiosity boards is programmed with Combined Interface which can act as Zigbee Gateway/Coordinator. Program the CI pre-compiled hex image by following steps 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 MPLABX IPE

  1. Precompiled Hex file is located in "<Harmony Content Path>\wireless_apps_pic32cxbz2_wbz45\apps\zigbee\ext_light" 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 MPLABX IDE

  1. Follow steps mentioned in of Running a Precompiled Example document

  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 MPLABX IDE

For more details on how to find the Harmony Content Path, refer to Installing the MCC Plugin

Demo Description

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

Application Zigbee Logical Device Type Functionality
Combined Interface Coordinator Device capable of controlling and monitoring other devices. It is typically a mains-powered device like a personal computer
Extended Lights Router Is a lighting device that can be switched on/off , brightness & color of the light can be adjusted via the color commands.

Zigbee device commissioning:

  • The Zigbee router i.e. Extended Lights can be commissioned and brought to the existing zigbee network formed by Zigbee coordinator i.e. 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 WBZ451 Combined Interface (CI) Coordinator

Hardware & Software Setup
  1. Supply power to WBZ451 Curiosity Board consisting of Combined Interface application by connecting a USB cable. Power Supply (PS) Green LED will turn on when connect to PC.
  2. The application activity is shown as "Console Log" through on board UART-USB converter
  • Open Terminal(eg: Tera Term) with the setup as shown below to look for these logs

  • On the PC side virtual COM port connection that corresponds to the board shall have following settings:

    BAUD RATE: 115200 (as configured in SERCOM configuration)
    PARITY: None
    DATA BITS: 8
    STOP BITS: 1
    FLOW CONTROL: None
Additionally, local echo and sending line ends with line feeds shall be enabled in the PC serial terminal application.

Network Formation (Coordinator - (Combined Interface))

Follow the steps explained in Network Formation (Coordinator - (Combined Interface)) 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 WBZ451 Curiosity Board in the previous step).
  • Supply power to another WBZ451 Curiosity Board programmed with "Extended Light" by connecting a USB cable. Power Supply (PS) Green LED will turn on when connect to PC.

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

  • Input command : resetToFN and look for the below logs for successful joining with CI.

  • Success logs : When extended light successfully commissioned with Combined Interface below log will be seen.

Light Control

RGB LED on WBZ451curiosity 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 got from Combined interface console log while commissioning was done. Refer to the above success log for light 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 shows few commands for light control(on /off, brightness, hue & saturation). Refer to doc Serial Console Commands to get to know the different parameters of the commands.

Command Type Commands Parameter Details
RGB LED ON onOff 0x0 0xf088 0x23 -on 0x23 zigbee end-point number used for Light
RGB LED OFF onOff 0x0 0xf088 0x23 -off 0x23 zigbee end-point number used for Light
RGB LED brightness change moveToLevel 0x0 0xf088 0x23 0x45 0x0 0x1 0x0 0x0 0x45 is the configurable brightness value
RGB LED color change moveToHueAndSaturation 0x0 0xf088 0x23 0x45 0x67 0x0 0x0 0x0 0x45 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 can delete all the networking information and will bring 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

All the supported device types including this Extended Colour light projects can be generated by following the steps in Generating project from MCC.