Z-Wave is a wireless communications protocol designed for home automation, specifically to remotely control applications in residential and light commercial environments. The technology uses a low-power RF radio embedded or retrofitted into electronics devices and systems, such as lighting, home access control, entertainment systems and household appliances.
We follow the steps in post to install z-wave controller on pcDuino. In this tutorial, we show what we did on pcDuino.
First, we need to make sure we shutdown power to the branch. The Z-wave switch needs main power (110V) to power it up. As shown below, we connect the hot of line in (Black wire) and neutral (White wire) to the lower end (where the LED is located). We also need to connect the hot wire of load (Black wire) to the upper end. We also hook up the ground.
To see if we get it correct to connect the line in, we can then turn on the breaker. If the connection is correct, we will see the blue LED on.
The installed switch is shown below:
The Z-stick has built-in battery. We come close to the z-wave switch and press button on the Z-stick once, the LED on z-stick will slowly blink. Then, we press the z-wave switch once, the LED on z-stick will blink much faster, which means the pairing is successful. We press the button on z-stick again to finish the pairing.
1. Install build-essentials, make, subversion applications (maybe others).
$sudo apt-get install build-essential make subversion
2. Plug in z-stick
3. Install open-zwave:
$cd /home/ubuntu $svn checkout http://open-zwave.googlecode.com/svn/trunk/ open-zwave $cd open-zwave/cpp/build/linux $make
This step will take some time.
4. Build the open-zwave example to test if everything is Okay.
$cd ../examples/linux/MinOZW (change Makefile if your device is not at /dev/ttyUSB0) $make $./test
While this is running – hit the button on the switch and we will see some output from test, and it will create a config file – zwcf_yourhome.xml, where yourhome is replaced by a hex string.
5. Install openzwave-control-panel.
$cd /home/ubuntu $svn checkout http://openzwave-control-panel.googlecode.com/svn/trunk/ openzwave-control-panel
6. Install libmicrohttpd.
$wget ftp://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.20.tar.gz $tar -xzvf libmicrohttpd-0.9.20.tar.gz $cd libm* $./configure $make $sudo make install
7.Went to back to openzwave-controller
Edit file ‘Makefile”, and make sure OPENZWAVE and LIBMICRoHTTPD are as below:
OPENZWAVE := ../open-zwave LIBMICROHTTPD := /usr/local/lib/libmicrohttpd.a
We also need to uncomment the three lines for linux:
# for Linux uncomment out next three lines LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/linux/*.a) LIBUSB := -ludev LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB)
Then we compile by:
8. Time to test (the number after p is port number):
$./ozwcp -p 55555
Before we run ozwcp, we need to copy the directory ‘config’ from open-zwave to openzwave-control-pannel.
9. On a PC, launch browser, and point to http://pcduino_ip_address:55555
We input ‘/dev/ttyUSB0’ under device name, and hit button ‘Initialize’, then we will see our z-wave switch shown up under tab devices, we can then turn on and off the switch!