Previously, I shared on Facebook that I had created a system that allowed me to voice control my house with my phone. I had set it to accept commands like “Okay Google, turn the light on”. This command would result in the lamp in my office being turned on. I also mentioned I was able to control other things – the lounge TV, and bedroom aircon – with my voice. Most of the comments on that post were requests for details on how I did it. So here they are. In this King’s Keep series I will cover the origins, extension, and development of this system.
Module One – Power Switches
Years ago, I was trying to avoid standby power usage for all the computers and monitors in my bedroom. I bought a bunch of 433Mhz RF power switches that allowed me to do this. These switches allow me to turn on devices, lamps, TVs, computer monitors, and fans with the push of a button. At the time, I wanted to create some sort of controller inside one of my computers that would allow me to control these RF switches, so I started looking around for solutions, but there were none available.
From time to time I would google for “RF 433 Switches” and a little under four years ago I stumbled on a blog by an English fellow who had posted about using a Raspberry Pi with a tiny 433Mhz transmitter to toggle these switches. I bookmarked the page with intending to follow his progress and eventually building something similar myself, and then I promptly forgot about it.
A few months later I heard about NinjaBlocks from a work mate, and started looking into it in earnest. By this time I had three Pis around the house, and decided I wanted to give it all a shot. I ordered a few of the transmitters and receivers, and again, forgot all about it.
Eventually though, I found some free time, and remembered all about the power switches and the transmitters and receivers, and I put them all together on the Raspberry Pi, and built a static HTML page that fed back to a PHP script, which called the command line tools that NinjaBlocks released for their Ninja-Pi port. I had computer control over the power supply to the lamps and televisions in the house.
Adding Voice Control
Just for kicks, I decided to see what I could do with my phone and voice control. Because I use Android, I have a pretty open system that I can work with. I installed the following apps:
I set up Tasker AutoVoice to intercept all the Google Now commands, so they would trigger Tasker commands instead. Next, I set up JuiceSSH with private key authentication so I wouldn’t need to enter passwords when connecting to the Raspberry Pi. Finally, I linked the Tasker commands through the JuiceSSH Tasker plugin to run command snippets on the Raspberry Pi in response to my Google Now commands. These command snippets where the same commands that my PHP script ran.
It turned out this was a really slow process. The phone had to parse the voice command – this took about 1 second. It then had to launch JuiceSSH and connect to the server – this took about 12 seconds. Then it would run the command – this took less than a second. Finally, the TV or light would come on.
I have since realised that I can just call a HTTP address from Tasker, removing the need for JuiceSSH completely, and reducing that 12 second lag down to about 2 seconds. This still isn’t as fast as I wanted, so I am working on some other solutions to the lag problem.
More To Come …
With that, I had created the basis of a home automation tool that I am now expanding on. I am adding controls for Chromecasts, magnetic reed switches, motion sensors, bluetooth presence, Bluetooth-to-Infrared relays, remote computer commands, and so much more.
If you’re interested in looking at the code of my home automation system, or want to learn more about what I have done or will do, the details are available at https://thebrazengeek.com/kings-keep/