5.6.1.1 Dimmable Light control and Monitoring using Alexa Echo Plus (with Touch Control)

WBZ351 Curiosity Board

Devices (Device): | PIC32CX5109BZ31048(MCU) on WBZ351 module |

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

Introduction

This page describes the demo steps for WBZ351 Curiosity board Dimmable 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 – dim_light_touch

Hardware Requirement

Table 5-12. Hardware Requirement
Tool Qty
WBZ351 Curiosity Boards1

QT7 XPRO Extension Board

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

SDK Setup

Gettting Started with Software Development

Software

TeraTerm

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_pic32cxbz3_wbz35\apps\zigbee\dim_light_touch" folder

  2. Follow the steps mentioned here

Caution: Users should 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 "dim_light_touch.x" located in "<Harmony Content Path>\wireless_apps_pic32cxbz3_wbz35\apps\zigbee\dim_light_touch\firmware" using MPLABX IDE

<Harmony Content Path> how to find what is my Harmony Content Path

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.
Dimmable LightRouterIs a lighting device that can be switched on/off , brightness of the light can be adjusted via the level control commands. In addition the light can be controlled using Touch button on QT7 XPRO extention board

Zigbee device commissioning:

  • The Zigbee router i.e. Dimmable 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:

  • Dimmable light GREEN 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 WBZ351 Curiosity Board

    1. Connect the QT7 Xplained Pro Extention board on Curiosity board extention as shown.
    2. Supply power to WBZ351 Curiosity Board consisting of Dimmable light 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.

Commissioning (Router - Dimmable 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.
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 joinGREEN LED control from Alexa .
Attention:
GREEN LED is one of the LED in RGB LED. Since the RED and BLUE colour of RGB is not connected with WBZ351 module, only GREEN LED is used in this demo. So, look for "RGB LED" marking on curiosity board for GREEN LED also.
  • Either through voice commands like "Alexa, Turn on my first light", "Alexa, increase the brightness of my first light" or from Alexa app the GREEN LED can be controlled through Zigbee network

GREEN LED Control from QT7 Touch Button/Slider
  1. Important:

    If the QT7 XPRO board is not connected with WBZ351 curiosity board, by touching on curiosity board extention pins might cause the Touch detection. Hence Touch functionality is disabled by default.

    To activate the Touch feature, press USER BUTTON 1 (SW3) and then press the RESET button (SW1). Then release SW1 first and then release SW3.

  2. Button 2 marked on QT7 XPRO board can switch On/Off the GREEN LED. Touch and release the Button 2. See the GREEN LED is On. A LED near to Button 2 will also glow.
  3. The Slider can help to increase/decrese the brightness of GREEN LED. The lowest position will bring the brightness Low, and highest slider position will bring the GREEN LED brighness to High. The brightness are in the scale of 0 to 255.
  4. Slide on the Touch slider and observe the GREEN LED brightness changes. The 6 LED's adjacent to Slider will also show the brightness level.
  5. Touch and release the Button 2 and observe that GREEN LED is Off. All the Touch LED's also will be Off. Changing the slider position will not change the brightness until the LED is On by Button 2.
    Note:
    The GREEN LED state and brightness change by Touch button will get reflected in Alexa app.
Other Functionalities
  1. 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.

  2. Persistent Data Storage (PDS): The light status (On/Off) and brightness values are stored in non-volatile memory called PDS.

    • Power off/on of light, these values persist and GREEN LED will reflect accordingly. This PDS storage is tied to zigbee network.
    • The light On/Off status 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

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