Smarthome Extravaganza – Part 6

Good gods. Time surely flies. There’s been over a year since I last wrote the article about my personal smart home project, but fear not, it is still going strong.

A lot has happened since the last post, so let’s do fast recap of the previous progression

Happened in the previous episode

I spent summer 2015 digging a ditch. A lot of ditches. Tried lot of different kind of network setups for my local LAN: wireless, ethernet-over-power line, cables hanging and screaming help on the air but not with any proper success on the ping times or transfer rates.

Finally, I made underground point-to-point ethernet from my house to the warehouse and from there hanging airline cable to my workshop on the back of the yard. Had no real time to focus on the actual smart home features– and then I spent most of the year focusing on entirely different things.

And now, to the conclusion

Well, my smart home is already up and running.

As said, a lot has happened since the last post. Last summer I spent digging a ditch between our warehouse and my workshop and now the network cable between these two buildings is securely protected underground. Then I went insane and repeated the same process to the network wire between my workshop and my wife’s workshop (the old pony stable) so most of the buildings our estate are now well networked.

This is an important thing because I have an IP-camera based surveillance camera system in our yard so the network provides both good access to the work computers as well as to the security cameras.

Then I, after a researching different kind of solutions, decided to use Telldus system (Tellstick) to control the electricity in our countryside house. I originally was strongly considering Z-Wave based system because of the each control device work as a signal repeater but the price tag for per-device was way too high since I needed a lot of them; so Telldus solution it was.

The system, DIY

I built our smart home control system on a Raspberry Pi 3 mini-computer, which uses USB-based Tellstick DUO to send and receive commands between our home automation devices. Radio signal strength and range could be better, but it serves its purpose at the moment.

Now, there are a lot of ready-made software solutions for Pi to handle controlling your Telldus DUO stick but I decided to ignore them all– There’s just something doing the whole system by yourself from the roots.

I have had a lot of past experience building smart home system, primarily using X10 protocol, so I knew I could, with my vast programming experience, to handle this too. After studying well a day how the Tellstick works, I started to code the core system for our raspberry pi based smart home hub called Bear.

Main system running on Raspberry Pi 3 is PHP and MySQL based system which is supported by a different kind of PHP-daemons. The system is capable of running fully by itself without needing any user attention, but is also controllable over browser- and app-based system which all are handled on JSON based secured communication.

What it actually does, then?

Well, there are a lot of things it does. For the starters, the smart home I built monitors most of the room temperatures in our house, and turns on or off the heating when necessary based on versatile and easily customized conditioning system where it takes consideration of temperature, clock, days of the weeks and weekends.

It also turns on and off lighting in our home based on the position of the sun, clock and whenever is most likely people are awake or sleeping. In the very near future, it will also take consideration the movement in the house and whenever it has detected that there are people inside the house.

Next, to those easy-living functions, it also works as a never-sleeping watchdog. Our smart home HUB, or Bear, as we have named it, watches movement both inside and outside of our house, reporting and noticing it, and turning on security lights as well as capturing camera image.

In addition to the motion detectors, it also monitors all doors in our house and knows when they move and how. Using both motion detectors and Reed switches in the door, the system can estimate movement direction and knows how to act upon different kind of situations.

But what if there’s no electricity?

In the near future, our system will have a battery- and 4G -secured fail-safe system on the HUB which enables the system to function even in the situation of the unexpected power loss. This means it can keep up and running monitoring our house and contacting us over the mobile network if we are not around.

Who knows- maybe I even set it up to use my CB radios so if the mobile network fails, there is always CB around.

In the more distant future our smart home will be power-secure on three different levels: In the cast of larger power line failure, an automated engine-generator will kick in, and provide additional electricity. If that for some reason fails, i.e. fuel ends, house and the system is powered by good powerful battery setup and finally, if all else fails, the smart home HUB is self-powered with an isolated battery which can keep it running for hours.

There’s also some consideration towards solar panels, which would be the fourth protective layer for electricity in our smart home system.

DIY GLaDOS

So far, my smart home is based on the system I created called “IQ Rules” which is basically IF-THEN based system taking consideration on a lot of manually or automatically set up variables. It is simple, yet working solution.

Originally, it was a little bit more complicated: The first version I built had understanding for human speech-like syntax, i.e. “turn on the heat in the bedroom if bedroom’s temperature is less than 18-celsius degrees” and it understood that– system that took a lot of regular expression to built.

In the end, it was not that efficient and not as secure as I had wished so basically system used now is: If following conditions [clock > 22][temperature bedroom < 18] then perform following actions [turn on bedroom battery]. It also has kick-back operations which can perform additional functions after certain operations have taken place.

It tries to sound like actually a smart system, having a text to speech system which can talk logged smart home events to the human-like sentences, but that just for a show-off.

Future plans

In the future, I will most likely, at least I plan to, expand the “IQ Rules” system to have a neural network-based logic which can operate in the situations it has not programmed to, but on the other hand, I would not like to wake up on a Saturday morning watching big red eye staring me and asking: “What are you doing, Dave?”