Zigbee Router Temperature Sensor Example App
- Introduction
- Hardware Prerequisites
- Software Prerequisites
- Functional Description
- Configuration With SysConfig
- Example Usage
Introduction
This document discusses how to use the Zigbee Temperature Sensor Example App and the different parts that compose it. Zigbee Temperature Sensor Application is an example which exercises different features of TI Z-Stack.
Some of the features exercised include:
- Base Device Behavior attribute configuration.
- Temperature Sensor device that acts as Initiator of Finding and Binding.
- Report attributes functionality and configuration.
Hardware Prerequisites
- The Launchpad which is used by this particular project.
Software Prerequisites
Code Composer Studio™ (CCS) v9.1 or newer
Functional Description
Software Overview
This section describes the software components and the corresponding source files.
Application Files
- zcl_sampletemperaturesensor.c/.h: Contains the application's event loop, device initialization function calls (for timers, peripherals, Nvm, LEDs, Switches, Serial interface), Zigbee stack notifications and all Temperature Sensor specific logic.
- zcl_sampletemperaturesensor_data.c: Contains the endpoint, cluster and attribute definitions for this sample application.
- main.c: Defines the application task and the application stack size.
- bdb_interface.h: Defines commissioning parameters to be used and configured in the application upon calling commissioning methods (see zclSampleTemperatureSensor_initParameters()).
Configuration With SysConfig
SysConfig is a GUI configuration tool that allows for TI driver and stack configurations.
To configure using SysConfig, import the SysConfig-enabled project into CCS. Double click the *.syscfg
file from the CCS project explorer, where *
is the name of the example project. The SysConfig GUI window will appear, where Zigbee stack and TI driver configurations can be adjusted. These settings will be reflected in the generated files.
The example project comes with working default settings for SysConfig. For the purposes of this README, it is not recommended to change the default driver settings, as any changes may impact the functionality of the example. The Zigbee stack settings may be changed as required for your use case.
Note that some Z-Stack settings are stored in non-volatile storage, and Z-Stack prioritizes stored settings over SysConfig settings. To guarantee SysConfig settings are applied, perform a factory reset of the device to clear non-volatile storage.
Example Usage
This section describes how to use this sample application.
Buttons
BTN-1
: Starts the commissioning process.BTN-2
: If hold after reset, perform Factory New reset (erase network and application persistent data)
Serial interface
- Open a serial session (e.g. PuTTY, etc.) to the appropriate COM port.
- The COM port can be determined via Device Manager in Windows or via
ls /dev/tty*
in Linux.
- The COM port can be determined via Device Manager in Windows or via
The connection will have the following settings:
Baud-rate: 115200
Data bits: 8
Stop bits: 1
Parity: None
Flow Control: None
Note: The serial output is known to be formatted incorrectly in Tera Term and in the CCS Terminal.
The serial interface allows you to control the commissioning configuration as well as application behavior. The commissioning interface is common for all applications and is implemented in the module zcl_sampleapps_ui.c/.h. Any application specific behavior of the serial interface is implemented in the example application files.
The serial interface implements a common set of menus described in 'Application Overview' within the Zigbee docs in this SDK. This common menu can be used to commission the device into a network.
Commissioning the Device Into the Network
Zigbee router devices can create a network with limited security capabilities (Distributed network) or join a network. The commissioning process to be done can be configured in the Config screen menu. Note that if both Formation Mode and Steering Mode are enabled when Commissioning is executed, the device will first try to join a network, after which if it fails, the device will create its own network. This sample applications uses the stack notifications (zstackmsg_CmdIDs_BDB_NOTIFICATION) on a successful network formation process to open the network and allow new devices join, even if the Steering Mode is not enabled from the common user interface. In the same way, if the device joins a network, it will open the network for 180 seconds. If the network is closed, it can be open again by enabling the Steering Mode and execute the commissioning process in the Commissioning Screen.
Interfacing with the Thermostat Example App
Once the Temperature Sensor and Thermostat are in the same network, enable the Finding and Binding Mode and execute it from the Commissioning Screen. When Finding and Binding is executed, the Thermostat device is set in Identify mode for 180 seconds. During this time the Temperature Sensor device must perform Finding and Binding as well to find the Thermostat device in Identify mode and create a bind to it. The status of the Identify process is shown in the BDB status line.
Finding and binding status in the BDB status line
IdXXX shows the remaining XXX seconds in Identify mode, SrchYYY/ZZ shows the remaining YYY seconds searching for devices in Identify mode and ZZ the number of binds created during this process.
Once the Temperature Sensor device has the bind to the Thermostat, it will periodically send Reporting Attribute commands according to the reporting configuration set by Zstackapi_bdbRepAddAttrCfgRecordDefaultToListReq().
The Temperature Sensor can adjust the temperature in the Application menu of the user interface:
Local temperature set screen in Temperature sensor device
Note: The temperature displayed on the TEMP screen may lie (inclusively) between SAMPLETEMPERATURESENSOR_MIN_MEASURED_VALUE and SAMPLETEMPERATURESENSOR_MAX_MEASURED_VALUE (these values are defined in zcl_sampletemperaturesensor_data.c).