Intro: How to Connect and Control a Lamp Through ZigBee Module on Dragonboard
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.
- Dragonboard 410c;
- CC2531 USB Dongle;
TEXAS INSTRUMENTS CC Debugger/Programmer;
OSRAM Lightify Tunable White A19.
Step 1: Upload the USB Module Code to Work With Zigbee-shepherd
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.
Step 2: 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:
- Create a folder to the project with the name "zbserver" (CLI: ~$ mkdir zbserver )
- Inside the zbserver folder, create a file named "server.js" (CLI: ~$ touch server.js )
- Now, it's necessary to install some dependencies to project, install zigbee-shepherd, serialport and express libs by the CLI commands:
- :~/zbserver$ sudo npm install serialport
- :~/zbserver$ sudo npm install zigbee-shepherd
- :~/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.
Step 3: 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:
- ~/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:
- Turn it off by 5 seconds;
- Turn it on by 5 seconds;
- Repeat the steps 1 and 2 five times.
The lamp will automatically connect with the server.
Step 4: 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.
Step 5: 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: