IoT 201: ZigBee and Thread mesh networks

ZigBee® and Thread are appropriate networking choices for home, commercial and industrial automation. Each of these technologies have an ultra low-power “sleep” mode when not active and most of the time are drawing current in the microamp range. In their latest versions, they have the ability to form mesh networks, with Thread having the most sophisticated ability to re-establish connectivity when a “child” is moved from one “parent” to another. In this IoT 201 tutorial we introduce both technologies and show you how to get started with either.

ARTIK 5/7/10 and ARTIK 030 modules offer as standard the ZigBee®/Thread personal area network interface, using a built-in IEEE 802.15.4 radio. Each radio offers bandwidth up to 250 kbps and range of 10 – 200 m. Mesh network topology can extend the effective network foot print considerably. The ARTIK 5, 7, and 10 series modules have ZigBee®/Thread® capability integrated on the module itself, using circuitry nearly identical to the ARTIK 030 devices.

ZigBee is used primarily for control and monitoring of lights, sensors, switches, appliances, etc. and can be applied to both home and commercial/industrial automation. Thread networking is designed to use the same IEEE 802.15.4 radio standard as ZigBee, but uses different protocols that are designed to interact with Internet Protocol (IP) addressing and messaging. Using this methodology, IPv6-format messages pass throughout the system intact. Because these messages never need to be decrypted for conversion to an intermediate format, they stay secure throughout their travels.

Mesh network toolchain

No matter which protocol you implement or which ARTIK modules you plan to use, the tool chain for developing with ZigBee or Thread is the same: Simplicity Studio® 4.0 from Silicon Labs. Simplicity Studio simplifies the IoT development process with one-click access to everything developers need to complete their projects using an integrated development environment (IDE) based on Eclipse 4.5. Simplicity Studio includes a powerful suite of tools for energy profiling, configuration and wireless network analysis, as well as demos, software examples, complete documentation, technical support and community forums.

These integrated tools and features combine to make embedded development simple and productive for IoT developers of all skill levels. Simplicity Studio provides built-in intelligence to automatically detect a connected ARTIK module, graphically configure the device, and show supported configuration options to help developers get their projects underway in minutes.

The tool installation and code compilation process varies depending on whether you’re developing for an ARTIK 030 module or for an ARTIK 5 / 7 / 10 module.

ARTIK 030 applications

Being designed for low-cost and CPU-efficient applications, the ARTIK 030 is not Linux-based. Its memory and processing capabilities are not sufficient for native compilation of code, so cross-compilation takes place on a separate PC using the IAR Workbench tool.

ARTIK 520, 710, and 1020 applications

The EM3587 ZigBee/Thread radio on ARTIK 520, 710, and 1020 Linux-based modules works with the main processor on the module as a network co-processor (NCP), connected by a simple serial interface.

Note that during the initial installation of Simplicity Studio you’ll need to have an ARTIK 030 module attached to the development machine even if you plan to develop for an ARTIK 5, 7, or 10 module.

For installation details and introductory demos see:

zigbee-logoZigBee

A ZigBee network of automation and control nodes is often a hybrid mesh/star topology. Mesh nodes are typically implemented by devices with access to line power, for example a light switch. Because they have access to power they can remain active network nodes at all times. Attached to these mesh nodes can be a star configuration of sleepy end devices that wake only long enough to receive or transmit data to the nearest mesh node before returning to sleep. Here are typical device types in a ZigBee network:

  • Sleepy end devices Simple, battery-operated devices (a remote temperature sensor, for example) form a star around a central parent device that routes their messages into the main mesh; the end devices wake up on their own schedule, check for messages from and send status to their parent, and then go back to sleep.
  • Powered end devices Line-powered devices or devices with higher-capacity or rechargeable batteries are used when immediate reaction is required (a controllable light, for example). These devices may optionally be routers.
  • Router capable devices can take part in a mesh and can be dynamically coordinated to select routes. Routers must stay active all the time and therefore are often line-powered.
  • Coordinators One of these router devices becomes the Coordinator for the system and orchestrates forming and maintaining the network. The Coordinator can reorganize and reroute message travel paths as needed to adapt to changing conditions (device addition/removal, radio disturbances).

 

ZigBee getting started tutorial

We’ve made it easy for you to get started with ZigBee networks using ARTIK modules with this ZigBee Application Tutorial that includes pre-compiled packages for you to load and begin your testing. The tutorial works with a mix of ARTIK 030, 520, 710, and 1020 boards. You’ll need at least two. Once the devices are joined on the network, they will be able to send messages to each other.

  • Obtain any combination of the following boards: ARTIK 030, ARTIK 520, ARTIK 710, or ARTIK 1020.
  • If you intend to develop using the ZigBee software stack, you must register an ARTIK 030 development kit with Silicon Labs. The kit comes with three boards, so one kit is sufficient for testing.
  • For developing software using the stack, install Simplicity Studio on your host PC. Have your ARTIK 030 board ready to plug in when you install the software, so that it is automatically recognized and the appropriate drivers installed.

Here’s the full online documentation set for ZigBee.

Thread logoThread

For a deep dive into Thread networking origin and technology, check out this Technical Document from Silicon Labs. Much of this overview section draws from their work.

While ZigBee has been the dominant 802.15.4 standard for many years, there has been a need for an IP-based wireless mesh networking standard. Customers are demanding direct connectivity to all their devices, specifically in their Connected Home. At the same time, application developers are seeking a simpler IP development model for the cloud, smartphones, and tablets.

Thread is the answer to the demand for direct, IP-based connectivity for devices connected to the Internet of Things. Thread is a secure, wireless mesh networking protocol. The Thread stack is an open standard that is built upon a collection of existing IEEE (Institute for Electrical and Electronics Engineers) and IETF (Internet Engineering Task Force) standards, rather than a whole new standard. The Thread software stack includes:

The Thread network stack incorporates IPv6 addresses for each node. (image source: threadgroup.org)
The Thread network stack incorporates IPv6 addresses for each node. (image source: threadgroup.org)

The Thread stack supports IPv6 addresses and provides low-cost bridging to other IP networks and is optimized for low-power / battery-backed operation, and wireless device-to-device communication. The Thread stack is designed specifically for Connected Home applications where IP-based networking is desired and a variety of application layers can be used on the stack.

These are the general characteristics of the Thread stack focused on the Connected Home:

  • Simple network installation, start-up, and operation: The Thread stack supports several network topologies. Installation is simple using a smartphone, tablet, or computer. Product installation codes are used to ensure only authorized devices can join the network. The simple protocols for forming and joining networks allow systems to self-configure and fix routing problems as they occur.
  • Secure: Devices do not join the network unless authorized and all communications are encrypted and secure. Security is provided at the network layer and can be at the application layer. All Thread networks are encrypted using a smartphone-era authentication scheme and AES (Advanced Encryption Standard) encryption. The security used in Thread networks is stronger than other wireless standards the Thread Group has evaluated.
  • Small and large networks: Home networks vary from several to hundreds of devices. The networking layer is designed to optimize the network operation based on the expected use.
  • Range: Typical devices provide sufficient range to cover a normal home. Readily available designs with power amplifiers extend the range substantially. A distributed spread spectrum is used at the PHY (Physical Layer) to be more immune to interference.
  • No single point of failure: The Thread stack is designed to provide secure and reliable operations even with the failure or loss of individual devices.
  • Low power: Devices efficiently communicate to deliver an enhanced user experience with years of expected life under normal battery conditions. Devices can typically operate for several years on AA type batteries using suitable duty cycles.
  • Cost-effective: Compatible chipsets and software stacks from multiple vendors are priced for mass deployment, and designed from the ground up to have extremely low-power consumption. Typical home products run in the Connected Home include: normally powered (lighting, appliances, HVAC, fans); powered or battery-operated (thermostats, smoke detectors, CO and CO2 detectors, security systems); and normally battery-operated (door sensors, window sensors, motion sensors, door locks).

Thread getting started tutorial

If you’re done with theory and ready to get to work, we have a tutorial prepared for you that takes a total of about 30 minutes, including installation of software. The tutorial uses two ARTIK 030 boards, one configured as a Thread simple end device, the other as a Thread router-eligible end device (REED). Once the devices are joined on the network, they will be able to send messages to each other.

To complete the tutorial, you’ll need:

  • Two ARTIK 030 development kit boards
  • Simplicity Studio® 4.0 software tool installed on your host PC.

Here’s the full online documentation set for Thread.

Planning for the future

Much coffee and beer has been consumed debating the technical merits of the ZigBee vs. Thread networking stacks. However, when you move the discussion above the networking protocols and start talking application layer, the rivals start to look more like partners who are still finalizing their partnership agreements.

Consider the seemingly simple task of interacting with a lamp over an IoT network. Both ZigBee and Thread handle the secure attachment of network nodes and delivery of packets between those nodes. But only ZigBee has an established application layer protocol to interpret those packets across device manufacturers.

Developers build applications against the ZigBee protocol using the ZigBee Cluster Library (ZCL).  It’s in the process of being rebranded as “dotdot”. The library defines a generic interface consisting of attributes and commands. Back to our lamp example: How do you command the lamp to turn “ON”? Does the lamp have a common but not universal attribute “dimmable”? Does it have an uncommon but emerging attribute “HUE” and what command do I use to change it? Can I set an alert to have it notify me when it’s in danger of failing?

Thread networking stack is compatible with ZigBee and other application layers.
The Thread networking stack is compatible with ZigBee and other application layers. (image source: threadgroup.org)

Until recently, ZCL provided an application-layer interface exclusively to the ZigBee networking stack. But work during 2016 culminated in demonstrations at CES 2017 of ZCL applications running over the Thread networking stack and interacting with IoT end devices, including IoT products built with ARTIK modules. We hosted some of those demonstrations in our booth. Thread is in the process of opening up their protocol for other application-layer protocols as well. The networking stacks and tools are not yet ready for commercial release, but developers can take steps today to allow their devices to make the transition in the field when the tech is ready.

  • Develop application-level code using ZCL (dotdot) and run your devices over the ZigBee protocol stack.
  • Prepare your devices to allow field-upgrades of the ZigBee and Thread stacks. The factory default firmware for ARTIK modules gives the module a ZigBee identity. You must upload new NCP firmware if you plan to use Thread or you want to switch to a version of ZigBee firmware other than the default.
  • Plan your field-upgrade process using ARTIK Technology Partner Resin.io or similar tool.

About the author: Kevin Sharp has been an engineer since long before he got his engineering degree, and has extensive experience in data acquisition and control networks in industrial, retail, and supply chain environments. He’s currently a freelance writer based in Tucson, Arizona.

Disclaimer

Opinions expressed here and in any corresponding comments are the personal opinions of the original authors, and do not necessarily reflect the views of Samsung. All Samsung names and trademarks are the property of Samsung Electronics Co., Ltd. or its subsidiaries in the United States and other countries. Other names and brands may be claimed as the property of others.

Legal Info

Please read these legal terms carefully before using this blog.