Close
0%
0%

Raspberry Home Automation Cluster

A high availability Raspberry pi cluster for home automation purposes. Simple, low on energy, but very stable.

Similar projects worth following
Why Pi’s..?

One year ago I started my home automation project. It then consisted of a large (Windows) server and php web interface hosted externally.
Changes where made on the web interface which would be polled by the server.
If the server found a change in state for example a light bulb, it would execute a command. In this case turn on the light bulb over X10.

Running a full server (with its power cost) for something this simple is overkill. And since I’m trying to get a grip on my power usage, it seems a good idea to reduce the computing power, and power cost.



Why Pi’s..?

One year ago I started my home automation project. It then consisted of a large (Windows) server and php web interface hosted externally.
Changes where made on the web interface which would be polled by the server.
If the server found a change in state for example a light bulb, it would execute a command. In this case turn on the light bulb over X10.

Running a full server (with its power cost) for something this simple is overkill. And since I’m trying to get a grip on my power usage, it seems a good idea to reduce the computing power, and power cost.

Why a cluster..?

I have been messing around with Raspberry’s before, and something that really bothered me was the lack of stability. For example. I had made a RPI based thermostat complete with LCD and PIR motion sensor. After I wrote the code I tested the setup for a week before installing it. Within this week the RPI crashed a few times, got harder to boot, and finally did not boot at al. After doing some research it seemed that some files where corrupted on the SD card. Reading the stories on internet, I’m not the only one with corrupted SD cards. Anyhow, I love the simplicity and power of the Raspberry, and still want to give it a fair chance at being stable. I thought I would help it a little by making a 3 node H.A. cluster with a decent power supply.

Is it working…?

At this moment in time I really don’t know, but I sure hope it does. I’m currently testing the cluster, and want to thank you for doing to! The link to the cluster status is running on the cluster, and there you can see the current state of the nodes. Green nodes are up and running, and red nodes are offline.

Cluster Overview Website

How does it work?

Really simple. The nodes all have two IP’s, one node IP, and one master IP that is offline (eth0:0 << alias). The nodes run some bash script for synchronising the Mysql and web directory, and a heartbeat script. If the heartbeat script detects that the master is down, it will bring up a other node (clone) of the master.
It’s as simple as that. : )

  • 3 × Raspberry Pi
  • 1 × SilverStone SUGO SG05-Lite Casing
  • 1 × TP-LINK TL-SF1005D 5-Port 10/100Mbps Desktop Switch
  • 4 × StarTech.com Molded Cat 5e UTP Patch Cable
  • 1 × PSU 5V 5A

View all 6 components

  • Going into the "cloud"...

    Michiel Spithoven01/28/2015 at 19:37 0 comments

    I'm currently working on the fourth domotica version. I hope this will be the best, and last…

    Even in a cluster form, the Raspberry's showed not to be bullet proof. As you can imagine, this is must for a system you depend your lighting, heating, venting, security, etc. on.

    The new idea is to get the system in the "cloud". I really hate this marketing term, but ok.., I'm going into the cloud.. -_-

    I have ordered a "Electric Imp". This is a small microcontroller with the SD card form factor, and can (must?!) be programmed thru the Imp cloud IDE. So far I have one "imp" running, and posting his GPIO port status to my own domotica API.

    I will let this run for a few days, and check if this will be a stable solution for my domotica blues….

    Will keep you guys updated!

  • [16-09-2014] New SD Cards

    Michiel Spithoven09/16/2014 at 19:56 0 comments

    Just replaced the 3 SD-card for some brand new PNY high speed 16 GB card. Looking good so far! :)

  • [06-08-2014] Notification push service

    Michiel Spithoven08/06/2014 at 12:27 0 comments

    Just added the Pushover API notification service to the cluster. This is a third-party app for android and apple, and it can display notifications on your phone. The notifications can be pushed by a web API.

    For now the cluster will push a notification when the scheduled “getting darn, lights on” job runs. And when the “lights of when nobody home” job runs.

    Hope it will work…

  • [06-08-2014] New interface

    Michiel Spithoven08/06/2014 at 09:36 0 comments

    Recently made a few adjustment to the web-app interface (see pictures).

    I added a dropdown menu, and added a few new functions like:

    • -Real-time weather information
    • -Information tab that shows if anybody is home or not, car presence etc.
    • -System maintenance, just a tab to monitor, shutdown and reboot the cluster.
    • -Security system. This will let you check the status of the system, arm and disarm it.

  • [27-05-2014] New remote web interface

    Michiel Spithoven05/27/2014 at 06:29 0 comments

    Made a new php based remote 'webapp' for my phone. It allows me to control the lights, and the central ventilation system. See the project pictures for a screenshot.

    The ventilation system is also triggered by a cronjob. It will shut off at 23.00, and start venting again around 11.00 in the morning.

    The rest of the system is still working like a charm. Sometimes I lose a pi, but the backup nodes will take its place, and everything is well. : )

  • [04-04-2014] Still going strong!

    Michiel Spithoven04/04/2014 at 07:28 0 comments

    This morning I checked the cluster for errors, but there were none. No errors, no change in slave/master roles or whatsoever. : )

    Furthermore the 433 MHz ASK modules still work like a charm! The light sockets seem to respond better to the Raspberry cluster, then to the original remote.

    Other little update>> The TV, digital TV tuner, radio etc. are switched off at night, and are powered back on in the morning. This will save some extra €15,- on standby-power a year.

  • [23-03-2014] WIFI Detection / Tasks

    Michiel Spithoven03/26/2014 at 09:40 0 comments

    Made a cronjob which runs a ‘tasklist’.

    The first task I made runs a script which check the current month, looks up the ‘sundown’ time in a table, and switches on some lights, but only when someone is present (if it can detect one of our mobile devices on the network ( wifi ) ).

    It work! And also scared the crap out of me the first time, haha. : )

  • [25-03-2014] 433 MHz KAKU

    Michiel Spithoven03/25/2014 at 08:38 0 comments

    I came across a special offer on KAKU outlets from some Dutch home depot, so I bought some and added a set of 433 MHz ASK modules to the cluster.

    After doing the research on internet I found the following code for controlling the KAKU wireless outlets: http://weejewel.tweakblogs.net/blog/8665/lampen-schakelen-met-een-raspberry-pi.html

    I works like a charm!

  • [10-02-2014] WIFI Detection

    Michiel Spithoven03/25/2014 at 08:38 0 comments

    Added Wi-Fi device detection. A cronjob triggers a little bash script which on his turn checks if my phone can be reached. The result is pushed to the database, and can be queried by jobs like (Turn on light A1, if phone presents > 5/10, and time > 21:00)

View all 9 project logs

Enjoy this project?

Share

Discussions

chris wrote 04/23/2014 at 15:11 point
Nice project! But why do you need three of them? The taskes can be handled by one...

  Are you sure? yes | no

Michiel Spithoven wrote 04/24/2014 at 06:20 point
Chris, It’s a high availability cluster. The 3 PI’s are configured in a master slave configuration. So one PI is the master, and when the master fails, one of the slaves take over.
You can see that at this moment the 2e PI became the master, and the 1e and 3e are slaves now. : )

http://82.161.238.38:81/

  Are you sure? yes | no

chris wrote 04/24/2014 at 08:28 point
Oh, now I got it :)

  Are you sure? yes | no

Michiel Spithoven wrote 03/26/2014 at 09:30 point
Thanks!

And yes. The 3 PI’s only draw 7 watt of power (measured between the outlet and cluster). This is more efficient than 3 separate RPI’s with their separate PSU’s. I think the reason for this is the use of a single large A-quality power supply instead of 3 cheapo china PSU’s.

  Are you sure? yes | no

Eric Evenchick wrote 03/25/2014 at 18:30 point
It's unfortunate that you had issues with RPi stability, but the cluster looks like a neat solution. I'm guessing the power consumption with 3 of them is still much lower than that Windows machine.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates