Introduction: ZigBee Home Automation

About: Kinoma hardware products and software solutions are designed to take connected device ideas to prototype and production. Developers adopt the Kinoma platform to build IoT products in JavaScript, and to make th…

Turn Kinoma Create into a ZigBee Home Automation gateway, and control your lighting.

Step 1: Overview

Many home appliances include wireless light bulbs that support ZigBee Home Automation, a wireless standard that enables smart objects to work together in the home. For this project, we use a GE Link light bulb which is a ZigBee Home Automation compatible device, and can be controlled from anywhere via a mobile app. The sample application will perform "ZigBee Service Discovery", find the light bulb within the network, and control lighting remotely.

Parts List:

We need to connect a ZigBee radio module to Kinoma Create. For this example, we have selected Digi's XBee radio. We can use any kind of antenna for XBee. If you prefer an affordable option, you don’t have to use "Pro (Series 2B)." Do not select "Series 1" or any other "Non Series 2" module. GE Link light bulbs are an easy and affordable option, especially if you live in the United States where they’re sold at Home Depot stores.

Step 2: XBee

When you buy an XBee module, the default firmware is typically in "Router" mode. We need "Coordinator" mode, so you have to rewrite the firmware. It is also good for keep XBee firmware updated to the most recent version.

Using the X-CTU tool, write latest "Coordinator API" firmware onto the XBee module. We need SparkFun XBee Explorer Dongle with PC or Mac environment to do this.

After successfully rewriting the firmware, change the baud rate to "115200" from the default value of "9600".

Step 3: Wiring

Connect the XBee module to Serial pins on back of your Kinoma Create device, using a breakout board. Be sure to first solder sockets and headers.

Here is the connection between the breakout board and the back pins of Kinoma Create.

Step 4: Setup ZigBee Network (Commissioning/First Time Setup)

To use ZigBee devices, perform "commissioning" on each device. Kinoma Create, which has the "Coordinator" role in this network, will first need to perform network forming. To do this, run the ZigBee Home Automation sample application from Kinoma Studio and tap the "Establish/Join Network" button on the GUI.

Once the network is formed, XBee will store the network information in its internal memory, so this needs to be done only once. After network forming, or if the network has already been formed, the light bulbs need to join the current network. We use the GE Link light bulb as an example, but you we can use any ZigBee HA standard light bulb — just keep in mind that commissioning methods vary for each device because there is no standard method to do commissioning. For a GE Link light bulb, commissioning is done by following steps.

1. Tap "Permit Join/Leave" on the Kinoma Create GUI, allowing other Router/End Devices to join the network.

2. Follow the reset instruction on the official install guide.

3. When the light bulb flashes, you know the device has successfully completed commissioning.

4. Repeat the above steps if you want to add multiple light bulbs to your system. Once devices join the network, each device will store the network information in its internal memory.

Step 5: Discover Light Bulbs (Service Discovery)

"Service Discovery" is the core process to communicate with each ZigBee device within the ZigBee standard application profile network. In this example, all non-Coordinator devices are HA light bulbs. But in a typical ZigBee network, you might not know what kind of devices are in the current network, making Service Discovery necessary to find ZigBee devices.

When you tap "Discovery" on the GUI, the application will broadcast the discovery message to all devices within the network. If the recipient has the "On/Off Cluster" and the ZigBee Home Automation profile, then it will respond to the message "Discovered" in the application. (You will notice the trace log in the Kinoma Studio console.) The application will retain information of those discovered devices in JS object.

Step 6: Finish

Now you can toggle your GE Link light bulbs on and off. Tap the "Toggle All" button on Kinoma Create’s GUI. It will send out a "Toggle" command message to all discovered devices within the network. You now have wireless and remote control of the lighting in your home.

You’ve done it! Or if you got stuck along with way, we’re here to help — come visit us at our forum and let us know how we can help.