In about year I am planning to move to a new house. As the house is completely new, I though it would be an awesome idea to create a solution to control my lights (and more) via an automated system which I can build myself. My goal is to control the Lights via the Philips Hue API, using the motion detection via a Z-Wave motion sensor and control other light switches, integrated in the wall by using the Z-Wave protocol. All these controls will come together in a simple web interface.
At this moment of writing, I have very basic solution in place to test, which took me for about 6 months to stabilize. Let me guide you trough the path I walked the last months…
What did I use?
As I am an experienced Web/software developer (C# and .NET) I am hooked to a Microsoft solution. Together with a Raspberry Pi 2B (you can also use the 3 as it has WiFi integrated) and an image of Windows IoT I have a good setup to achieve my goal.
The hardware I used (I’ve linked it to a variety of Dutch webshops to get you started but also to get you a good indication of which item I exactly used) are just a couple of components:
- Raspberry Pi 2B (I would suggest for you to go for the Raspberry Pi 3B)
- Official Raspberry pi Wi-Fi Dongle (If you go for the Raspberry Pi 3, you will not need this)
- Aeon Labs Aeotec Gen 5 Z-Wave USB Interface
- Aeon Labs Smart Switch 6
- Micro SD card (take one of the last generations to take advantage of the speed of the read/write)
- Any mini USB power cable with around 1.5 to 2A will do (perhaps you can use the one of your phone)
This startup and its materials will cost you approx 160 euro in total.
Setting things up
The image on the RPi
The installation on the RPi is fairly easy. By opening the IoT Dashboard, you have the ‘Set up a new device’ option on the left. Make sure you have the micro SD plugged in your pc and have it selected as the Drive. Hit ‘Download & Install’ and after a couple of minutes the RPi should be ready. Put the microSD in the RPi, together with the power cable and power it up. After a couple of minutes all things should be set up and ready to use. In case you are using the RPi 2B, this is the moment to plugin the WiFi dongle.
Configure the environment
There are 2 ways to check if the RPi is up and running, by HDMi attached to the RPi and screen or making use of the Device Portal (which I prefer the most).
Best way to configure the WiFi is to connect the RPi with a network cable on your modem/access point/whatever you use to connect on the LAN. Once connected, open the IoT Dashboard and make sure you have the ‘My devices’ option selected. If everything is connected in the right way, your RPi should be visible in the list.
Press the ‘…’ next to the RPi and select ‘Open in Device Portal’. You should be prompt with the login credentials to access your RPi. These are the credentials your have set up in the ‘Setup a new device’ step.
Once logged in, go to the ‘Connectivity’ option and choose ‘Network’. This is the part to setup the WiFi where the UI is pretty straight forward. Once connected to the WiFi, you can detach the network cable. The RPi should still be remotely connectable. If not, you might want to reconnect to the Device Portal as the IP Address of the RPi will change between wired and WiFi connection.