38 January 2016
will have to put a router in to relay the packets and boost
the signal. Most mains powered ZigBee devices can be a
router.
A router can be something as simple as a Hue light
bulb. Once you add the bulb to your network, it will figure
out who its neighbors are and start routing packets to
them. In fact, that is how we communicate with our
chicken coop door controller. We have ZigBee Hue bulbs
in our landscaping that carry the traffic to our chicken
coop in the back yard.
Strong Application Layer Allowing
Devices to Find Each Other and
Communicate
In addition to ZigBee’s strong networking layer, it also
has a well-defined application layer that describes how
common devices can discover each other and
communicate. This is what makes ZigBee so attractive for
device makers. A great deal of the common actions most
devices require are categorized and defined in “cluster”
definitions. ZigBee clusters are given 16-bit numbers, often
represented as hex numbers. Table 1 is a very small
sample of common clusters used by devices.
Cluster commands are either a server or client
command. For example, say we have a ZigBee enabled
light bulb and a ZigBee enabled wall switch. Both devices
will communicate using the commands defined in the
On/Off (0x0006) cluster. The light bulb will be the server
and the light switch will be the client. How the light switch
sends the “on” command and how the bulb receives the
“on” command are all defined in the On/Off (0x0006)
cluster specification.
Why is this important to a device maker? Let’s say
you want to make a device that has an LED, and you want
to turn the LED on or off remotely. If your device follows
the guidelines detailed by the On/Off Cluster, then your
device can be controlled by the exact same ZigBee
enabled wall switch discussed above. Let’s take that one
step further. Replace the ZigBee enabled wall switch with
a smartphone application. Say you have an existing home
automation solution with a smartphone application that
controls your ZigBee enabled lights (like Smart Things).
Since your LED device adheres to the ZigBee On/Off
cluster commands, it is now possible to control the LED
by that same smartphone app! Your device just joined the
Internet of Things!
You have all the power of that slick smartphone app
without writing one line of custom code for your
smartphone! Not only can you control your LED from
your smartphone, it can also be part of your home
automation. So, if you have your home automation rules
set up to turn on your lights when you pull into your
garage, your LED can come on as well.
Controlling a Custom Device with
SmartThings
This project is going to focus on
the radio hardware setup and
communications required to talk to a
ZigBee HA network hub (Smart Things)
over ZigBee standard Clusters. We will
use a Propeller microcontroller
connected to a Digi XBee ZB radio to
communicate with the hub. The circuit
is simple and you can use any number
of existing Propeller prototype boards.
To play along, you will need some
hardware. Here are a couple of
options: Option 1) is a custom PCB
and a link to the parts you can order
to populate it (requires soldering);
Option 2) is a list of parts you can
order to work with one of your
existing Propeller project boards (refer
to Tables 2 and 3). There is an
Option 1) ZB-LED PCB,
Propeller Mini, and Parts URL to buy one Price
Order Zb-LED PCB for Prop Mini Nuts & Volts Webstore $7
Propeller Mini www.parallax.com/product/32150 $25
Digi shopping cart for above board www.digikey.com/short/t8nn8d $27
XBee USB Program Board www.parallax.com/product/32400 $25
Smart Things Hub https://Smart Things.com $99
Option 2) Parts only
(no Propeller) URL to buy one Price
Digi shopping cart parts list www.digikey.com/short/t8nn8d $27
XBee USB Program Board www.parallax.com/product/32400 $25
Smart Things Hub https://Smart Things.com $99
Table 2.
Table 3.
Table 1.
Cluster Number Description
0x0006 On/Off Cluster for devices that can be turned on, off, or toggled.
0x0008 Level Cluster for a device that can be dimmed.
0x0101 Door Lock Cluster for controlling a door and its lock.
0x0402 Temperature Measurement Cluster.