How to Connect and Control a Lamp Through ZigBee Module on Dragonboard

by GustavoR109 in Circuits > Microcontrollers

1584 Views, 3 Favorites, 0 Comments

How to Connect and Control a Lamp Through ZigBee Module on Dragonboard

cc_debuger_imager.jpg
dongle_image.jpg
dragonboard_image.jpg
download.jpeg

This instructable teaches the user how to to connect and correctly install the ZigBee module on the Dragonboard and interact it with a ZigBee controlled Lamp (OSRAM), making a ZigBee IOT network.

Requirements:

  • Dragonboard 410c;
  • CC2531 USB Dongle;
  • TEXAS INSTRUMENTS CC Debugger/Programmer;

  • OSRAM Lightify Tunable White A19.

Upload the USB Module Code to Work With Zigbee-shepherd

dongle_image.jpg

First of all, is necessary to upload a code to the USB module to work with zigbee-shepherd. It will provide the functionality of recognize correctly the devices and create the IOT network properly.

To make this possible, please check this GitHub tutorial.

Configuring Zigbee-shepherd

Considering that the code is already uploaded to the ZigBee USB module, it's now time to configure the zigbee-shepherd application.

The zigbee-shepherd was developed on Node, therefore it's necessary to have Node installed on the Dragonboard. The installation is different to each operational system, so look for the Debian topic on this link to know how to install it correctly.

With Node already installed on Dragonboard, please follow the next steps to configure the zigbee-shepherd:

  1. Create a folder to the project with the name "zbserver" (CLI: ~$ mkdir zbserver )
  2. Inside the zbserver folder, create a file named "server.js" (CLI: ~$ touch server.js )
  3. Now, it's necessary to install some dependencies to project, install zigbee-shepherd, serialport and express libs by the CLI commands:
    1. :~/zbserver$ sudo npm install serialport
    2. :~/zbserver$ sudo npm install zigbee-shepherd
    3. :~/zbserver$ sudo npm install express

After that, it's necessary to copy the control code of the server (attached at the end of this step) to the created "server.js" file.

Note: it only works with the provided lamp and the USB dongle should be connected on the Dragonboard.

Downloads

Execute ZigBee Control Service and Connect the Lamp

To connect the lamp to the server it's necessary to go to the created folder (zbserver) directory and execute the "server.js" (with the dongle connected on the Dragonboard) file by the CLI command:

  1. ~/zbserver$ sudo node server.js

The opened console should inform the state of the Zigbee connections, if a lamp was found and if it's necessary to automatically pair with.

To enable the lamp pair mode it's necessary to:

  1. Turn it off by 5 seconds;
  2. Turn it on by 5 seconds;
  3. Repeat the steps 1 and 2 five times.

The lamp will automatically connect with the server.

Controlling the Lamp

To control the lamp is necessary to realize posts on the following IP addresses:

  • localhost:3000/turnOff -> To turn off the lamp;
  • localhost:3000/turnOn -> To turn on the lamp.

Conclusion

Now, after the previous steps, you're able to control a lamp via ZigBee protocol using the Dragonboard 410c and the ZigBee Module CC2531.

In case of any doubts, please comment below or check the following links: