Z-Wave Humidity-Temperature Sensor Project
The demo programs that come with the Z-Wave 7.0 DevKit don't involve much work. You change a constant for the radio frequency, compile, flash the board, and press a few buttons and watch a few LEDs. The documentation recommends as a next step extending one of the demo programs for your application. But the project setup is complicated, the interaction with the Z-Wave Application Framework (ZAF) opaque, and how to make changes unclear.
We set out to write a demo program that would fill in these gaps. For one, the devkit board includes some hardware that isn't used in any of the demos, so our program will use it: a humidity-temperature sensor and the LCD. For another, we'll start with a blank project to learn what's needed for libraries and hardware drivers, how code is organized within Simplicity Studio, and how the build process works. For a third, we'll add functionality and commands within the framework to see what it does and how its components are put together. Our demo will allow you to read the sensor via Z-Wave or to start a data logging run that will periodically send readings to the controller; in both cases we'll also see the readings on the LCD.
The program will be built in several steps. First we need to set up the equivalent of a "Hello World" program within the application framework, the simplest program that will compile. Second we'll figure out how to work with the hardware, first the buttons and LEDs, then the humidity-temperature sensor, then the LCD. These steps will involve working with libraries and code in the SDK. Third we'll add Z-Wave support, first inclusion and exclusion, then getting a correct Node Information Frame (NIF) and adding CC_VERSION, next implementing CC_SENSOR_MULTILEVEL to read the sensor and CC_CONFIGURATION for starting a logging run, and finishing by setting up security (just S0). Fourth we'll look at the differences between our demo and the full programs provided with the DevKit.
This last point is important. Undoubtedly there are FAEs at Silicon Labs that will shake their heads at what we're documenting here: it may not follow best practices, it doesn't follow their coding standards, and it doesn't try to be Z-Wave compliant. The demo is meant to be a starting point to unravel a rather large knot. We hope the result provides the background one needs to develop a good production program.
Here is a tarball with the entire project; you'll also find links to separate tarballs for each step at the start of their section. If it's easier to read this text in one document, you'll find a PDF here.
Step 1: Setup and Framework
Step 2a: Hardware - Buttons and LEDs
Step 2b: Hardware - Humidity/Temperature Sensor
Step 2c: Hardware - LCD
Step 3a: ZWave - Inclusion and Exclusion
Step 3b: ZWave - NIF
Step 3c: ZWave - CC_SENSOR_MULTILEVEL (reading)
Step 3d: ZWave - CC_CONFIGURATION (logging)
Step 3e: ZWave - Security
Step 4: Application Framework
The Silicon Labs specs we used in developing the program include
UG381 ZGM130S Zen Gecko Wireless Starter Kit User's Guide
devkit hardware description
INS14280 Z-Wave 700 Getting Started for End Devices
devkit bring-up, first demo program
INS14278 How To Use Certified Apps in Z-Wave 700
demo program description
INS14259 Z-Wave Plus V2 Application Framework SDK7
framework description and how to use
INS14281 Z-Wave 700 Getting Started for Controller Devices
Z/IP gateway program and GUI
SDS13781 Z-Wave Application Command Class Specification
most command classes
SDS13812 Multilevel Sensor Command Class
list of assigned Multilevel Sensor types and scales
DSH14299 ZGM130S Z-Wave 700 DiP Module Data Sheet
part of the Simplicity Studio SDK documentation
Si7021-A20 I2C Humidity and Temperature Sensor Data Sheet
chip specification, also how to read values
LCD Module LS013B7DH03 Device Specification
signal timing
We're using the Z-Wave 700 DevKit and Simplicity Studio 4.2, running under Linux. The SDK was version 7.12.1. We will need two files from the Gecko SDK, version 2.4. We're using the Python GUI for the Z-Wave gateway software to communicate with the device, and our Zpiffer program to monitor network traffic.
One last note. Much of the text will describe the evolution of the source code as we build on previous steps. There will be links to code snippets showing the most important changes or functionality, but if anything is unclear, try looking at a diff of the file to the previous step or the original source in the SDK. Let us know if something still doesn't make sense so we can fix the text. As always, comments about the project or write-up are welcome at by sending us an e-mail.