4.7.2 Zigbee Application Demo: Light Control and Monitoring using Alexa Echo Plus

WBZ451 Curiosity Board

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

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

Introduction

This page describes the demo steps for WBZ451 Curiosity board Extended Light control and Monitoring using Amazon Echo Plus (Zigbee gateway).

An overview of the demo is shown below.

GitHub Repository

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

Hardware Requirement

Tool Quantity
WBZ451 Curiosity Boards1
Micro USB cable1
Amazon Echo Plus (Built-in Zigbee smart home hub)1
Smart Phone with Alexa app installed1
Personal Computer1

SDK Setup

Software Requirement

Programming the precompiled hex file or Application Example

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\hex folder.

  2. For more details on the steps, go to Programming A Device Programming A Device.

Note: Ensure to 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
Amazon Echo PlusCoordinatorDevice capable of controlling and monitoring other devices.
Extended LightsRouterIs 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 gateway i.e. Amazon Echo Plus 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:

Hardware & Software Setup
  1. Supply power to WBZ451 Curiosity Board consisting of Extended light application by connecting a USB cable. Power Supply (PS) Green LED will turn on when connected to PC.
  2. The application activity is shown as “Console Log” through on board UART-USB converter:
  • Open Terminal(Example: 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.

Commissioning (Router - Extended Light)

Light can be added to Alexa's Zigbee network by voice commands or by using Alexa mobile app.
  • Voice Commands: Open Alexa to discover the Light device. Say “Discover my devices”. or

  • Alexa App:

    • Launch Alexa app, from the menu, select the Add Device.
    • Select the type of smart home device “Light” and select “Other”.
    • Initiate Discover Devices.
    • Input command : resetToFN on light device.The Light will be discovered and shown as light in Alexa app as shown below.
      Figure 4-20. .

Note: Echo Plus is in discovery mode for 45 secs. Devices wanting to join Echo Plus should initiate joining/connecting procedure within this time limit for a successful join RGB color control from Alexa.
  • Either through voice commands like “Alexa, Turn on my first light”, “Alexa, Change color of my first light to “GREEN””, “Alexa, increase the brightness of my first light” or from Alexa app the RGB LED can be controlled through Zigbee network.

---->

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, color 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 and brightness values retrieved from previous transaction.

Creating Application Device Types From Scratch Using MCC

This section intended to showcase the complete application development from scratch including the individual component and its dependency inclusion.

Note: It is recommended that new users of MPLAB Code Configurator go through the Overview.
  1. Create a new MCC Harmony Project. For more details, refer to 2.5 Creating a New MCC Harmony Project.
  2. Option 1: Import component configuration: This step helps users’ setup the basic components and configuration required to develop this application. The imported file is of format .mc3 and is located in the path <Harmony Content Path>\wireless_apps_pic32cxbz2_wbz45\apps\zigbee\ext_light\firmware\ext_light.X. For more details on how to import the component configuration , refer to14.3 Importing Existing App Example Configuration.

    Verify the project graph and configuration options shown in the below steps.

    Note: Import and export functionality of the Harmony component configuration will help users to start from a known working setup of the MCC configuration.
  3. Option 2: Follow the remaining steps.
  4. Click + symbol on the Extended Color Light Device Type component from “Device Resources”.
    1. Accept dependencies or satisfiers, select Yes to all.
    2. Configure Extended Color Light as shown:
  5. Add UART components needed for console logs and commands. Right click on the yellow triangle to add satisfiers as shown below. Verify the UART SERCOM configuration as in Zigbee Console Commands.
  6. Add TCC2 to the project graph.
  7. Add TCC0 to the project graph and verify the configuration options.
  8. Add TC2 and TC3 to the project graph and verify the configuration options.
  9. Add EIC to the project graph and verify the configuration options.
  10. Add Bootloader Services to the project graph.
  11. Verify if the Project Graph window has all the expected MCC configurations.
  12. Configure the following pins in the Pin Configuration.
  13. Add the bootloader_timer.X.production.hex file as a loadable in the project properties. The hex file can be found in
    <Harmony
            Content Path>\wireless_apps_pic32cxbz2_wbz45\apps\zigbee\ext_light\firmware\ext_light.X
            
    folder.