alt.embedded
Taking Z-Wave’s SDK on a Trial Run

Taking Z-Wave’s SDK on a Test Run

Technology Editor Bill Wong checks out the tools for developing applications that take advantage of the Z-Wave network.

A plethora of low-power wireless technologies currently populate the communications space, including networks like Z-Wave and Zigbee. These two have been used as the base for consumer and commercial networked products such as smart locks and smart lighting.

Silicon Labs acquired Sigma Designs’ Z-Wave business this year. Sigma Designs was a driving force behind Z-Wave providing hardware and software; in fact, it had shipped its 100 millionth chipset this year. Silicon Labs is now the provider of the free Z-Wave Embedded Software Development Kit (SDK), which features the Z-Wave Plus Application Framework.

The SDK addresses two aspects of Z-Wave development. One targets the Z-Wave support on Z-Wave devices. The other involves control of a Z-Wave network via a gateway such as one of the many available Z-Wave USB sticks. A stick allows a PC to be part of a Z-Wave network as well as manage it. For this article, I’m looking the latter, although much of the protocol support utilized by the former is employed by the gateway. Both use the same application programming interface (API). As a result, application development can occur on a PC, with the code subsequently ported to a device.

1. Z-Wave USB sticks like this are often used for PC-based gateways, as well as development and network management tools.

The first thing to do is get your hands on one of the Z-Wave sticks; I used one of Silicon Labs’ sticks (Fig. 1). Most of the many other sticks on the market will work well with the development tools. However, check them for capability as some don’t support the newer Z-Wave Plus.

The stick alone isn’t very useful without a Z-Wave network. My network consisted of a Z-Wave plug-in wireless Smart Switch from General Electric model ZW4101 (Fig. 2). The remote switch has a pass-through socket and a Z-Wave controlled socket. It provided the basic on/off feedback as well as access to management and network details available via the APIs.

2. The General Electric Smart Switch is one of hundreds of Z-Wave devices that can be managed using the USB stick.

The first step is to install the USB stick, which in turn needs the matching device drivers. The other binary in the SDK package is the Z-Wave PC Controller application (Fig. 3).  This application is designed as a development tool rather than the commercial Z-Wave user interfaces. It accesses the USB stick via a USB serial port interface. Likewise, most of the SDK is designed to support embedded development on Z-Wave nodes, of which there are many.

3. The Z-Wave PC Controller application uses the Z-Wave USB stick to connect and manage a Z-Wave network. It’s designed as a development tool rather than as a commercial Z-Wave user interface.

On the other hand, controlling a Z-Wave network via the USB stick interface tends to be significantly easier. The starting point for this support is the Z-Wave public standard Developer Site. This is where I found links to the libzwaveip and PyZWare repositories. The libzwaveip is a Z-Wave-to-IP gateway. It can be compiled to run on almost any platform, and there’s a binary available for the Raspberry Pi. A Z/IP client as well as the gateway software is in the mix, too. The client provides a command line interface to test out the platform.

Turning the switch on and off used a command like:

send "Switch Binary [efb1db2f0600]" COMMAND_CLASS_SWITCH_BINARY SWITCH_BINARY_SET ff

That’s not something you want to type in all the of time, but the syntax is easily generated by an application. It’s even possible to connect the gateway to IFTTT, which is a free IoT service for tying IoT devices together. It’s a rabbit hole I decided not to investigate at this point, but it didn’t appear too difficult to use. Matching smartphone apps for IFTTT could then be used to control or communicate with the nodes on the Z-Wave network via the gateway.

The PyZWare is a Python-based example that provides similar, but more limited, functionality as the Z-Wave PC Controller application. The basics can be extracted and used in a Python-based web interface if desired. I need to get a better handle on Python before trying that. I’m more invested in PHP for the web these days. The Python support will be equally useful for scripts running on an embedded device, even if it’s not targeted at a web interface. Likewise, this approach can be used to provide Z-Wave support to an embedded project that would use the USB stick.

Getting the prepackaged management tools is an afternoon affair. Expanding upon PyZWare takes a little longer; it’s on par with libzwaveip that provides an IP gateway. Developing on one of the Z-Wave device platforms in C using the SDK will take the most effort.

SmartStart

One piece of the puzzle I didn’t delve into is Z-Wave SmartStart. It’s a method of adding devices into a Z-Wave mesh network using QR Codes. This assumes two things. First, the network has a link to the internet, which tends to be a good assumption since most Z-Wave IoT networks are designed to be controlled via smartphone applications that connect via the internet. The other is that users have a smartphone capable of scanning QR Codes.

The idea is that each device has a unique QR Code that’s usually found on the box a device is delivered in. The user scans the QR Code with the SmartStart app that’s logged into the desired network using the out-of-band (OOB) management approach. This adds the device to the network’s possible list of devices. Therefore, when the device is turned on, it can now be securely linked into the mesh network. It eliminates the need for any synchronization buttons or procedures that were required in the past while providing a faster, more friendly mode of operation.

It’s possible to match devices without employing the QR Code; instead, the identification information encoded in the QR Code is used. This will often be done when a large number of devices are purchased and incorporated into a large network, such as a lighting system in a commercial setting. Still, the QR Code version can be useful especially when dealing with replacement or incremental additions to the network.

The SmartStart software addresses the linkage between a device that has unique identification information, and its QR Code. This support is needed when making Z-Wave products for production.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish