5.6.1.2 Zigbee Application Demo: Light Control and Monitoring using Alexa Echo Plus
WBZ351 Curiosity Board
Devices (Device): | PIC32CX5109BZ31048(MCU) on WBZ351 Module |
Peripherals (Used, On-Board): | RGB LED | User Button| UART-USB Converter|
Introduction
This page describes the demo steps for WBZ351 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 |
---|---|
WBZ351 Curiosity Boards | 1 |
Micro USB cable | 1 |
Amazon Echo Plus (Built-in Zigbee smart home hub) | 1 |
Smart Phone with Alexa app installed | 1 |
Personal Computer | 1 |
Hardware Modification
A simple hardware modification is needed to run this demo. WBZ351 Curiosity boards has on-board RGB LED on PB0, PB3, PB5 pins. But, these pins are multiplexed with CVD Touch functionality. Hence the connection to R and B LED's are disconnected by default on the board. Mount 0 ohm resistor or make the solder connection on R92 and R95 resistor position as shown below.
SDK Setup
Software Requirement
Programming the precompiled hex file or Application Example
Programming the hex file using MPLABX IPE
-
Precompiled Hex file is located in
<Harmony Content Path>\wireless_apps_pic32cxbz3_wbz35\apps\zigbee\ext_light\hex
folder. -
For more details on the steps, go to Programming A Device Programming A Device.
Programming the Application using MPLABX IDE
-
Follow steps mentioned in of Running a Precompiled Example document.
-
Open and program the Application Example “ext_light.x” located in
<Harmony Content Path>\wireless_apps_pic32cxbz3_wbz35\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 Plus | Coordinator | Device capable of controlling and monitoring other devices. |
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 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:
- Supply power to WBZ351 Curiosity Board consisting of Extended light application by connecting a USB cable. Power Supply (PS) Green LED will turn on when connected to PC.
- 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
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.
-
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:
-
On board button actions:
-
When the on board “User Button (SW3)” 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.
-
-
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.
- Create a new MCC Harmony Project. For more details, refer to 2.5 Creating a New MCC Harmony Project.
- 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. - Option 2: Follow the remaining steps.
- Click + symbol on the Extended
Color Light Device Type component from “Device Resources”.
- Accept dependencies or satisfiers, select Yes to all.
- Configure Extended Color Light as shown:
- 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.
- Add TCC2 to the project graph.
- Add TCC0 to the project graph and verify the configuration options.
- Add TC2 and TC3 to the project graph and verify the configuration options.
- Add EIC to the project graph and verify the configuration options.
- Add Bootloader Services to the project graph.
- Verify if the Project Graph window has all the expected MCC configurations.
- Configure the following pins in the Pin Configuration.
- Add the
bootloader_timer.X.production.hex file
as a loadable in the project properties. The hex file can be found in
folder.<Harmony Content Path>\wireless_apps_pic32cxbz2_wbz45\apps\zigbee\ext_light\firmware\ext_light.X