My Automated Home : Richard Farthing’s Green Open Source House

Green Open Source House

In the second of our new “My Automated Home” series, Richard Farthing takes us on a tour of his Green Open Source House.  On a budget of less than £600 the Linux setup looks after property whilst keeping an eye on the carbon footprint too.  Read on for the free software recommendations, the Joggler photos, tips, the what he’d do differently next time and the what’s coming next.

The Green Open Source House – Submission By Richard Farthing CEng MIET.  This is the story of how I built a functional, reliable, low cost, and reasonably low power, automated home solely with open source software.

Let’s set the parameters. The house is quite small with just 2 bedrooms, the aim was to provide automation functions, music and reliable SD TV services, as HDTV is a fast-moving area, it was specified as a “nice to have” if straightforward solutions permitted.  This puts it at the opposite end of the spectrum to those houses that need a 42U high full rack or two to hold the kit, with an air conditioned room to house it all.  As an engineer running a small company by day, often working from home, my aim was to do what engineers do according to the Duke of Wellington  …the art of doing for 10 shillings what any fool can do for a pound.  The total cost of everything described here is less than £600 – excluding the wiring and the valuable time of course!  Keeping to the green/recycling theme, some stuff like the dimmers, came from eBay.

Doing a “start-again” renovation of a very dilapidated house, I had a free range of options, so started by writing a spec for the functionality I wanted, which drove the need for a PC server based control system in node 0 and a large amount of CAT5e wiring – a minimum of 2 outlets per room, up to 8 in places like the living room and home office – total 32.  By writing a spec that contained some future aspirations I haven’t so far been significantly short of capacity in the building infrastructure.  For example I started from the aspiration/assumption that it would be possible to stream live TV over a LAN, which actually wasn’t that easy when I started writing a spec in 2003.  And just in case it didn’t become cost-effective in a reasonable timeframe, aerial cables were installed to most rooms, as well as node 0.  Today, I would only put the aerial/satellite cables in node 0 and the living room.

 Green Open Source Home Configuration
CLICK FOR BIG VERSION – Diagram showing the main system components and their configuration.

 

Green Open Source Home Node Zero
CLICK FOR BIG VERSION
– The modest node 0, AKA under the stairs – server, low power
24 port 10/100 switch, patch panels for data and voice (VOIP/POTS via Speedtouch 780 currently
commoned to all house & office phones. Also under floor heating manifold and controls. Wooden
wall panels removable, covering cable trays and plumbing.

 

The spec also meant home-run cabling for all the lighting circuits, to allow for central control, as well as home-run switch wiring, simply so that a fairly conventional system could work by patching low voltage switches to dimmer inputs in node 0 as necessary, before the automation system was commissioned (I used grid switches to allow swapping momentary and conventional types easily). This hardwiring may be implemented again in future if I rent or sell the house, because I recognise that the system I have developed is quite custom, and as this segment of the housing market isn’t used to this type of thing – a potential renter, buyer or estate agent might think it as “overcomplicated”.  Of course, lack of “big brand” hardware isn’t going to help either, so you might like to consider these factors when choosing your kit and how you implement it.   My thinking around potential sale is “with planning permission to automate” – i.e. the difficult stuff like flood wiring is there – a future occupier can choose their own automation system, e.g. a Homevision box etc, or leave it (almost) conventional.

The one thing I didn’t complete is whole house audio, though the speaker wiring exists to support it in several places as it was an initial spec item.  The reason is that with so many digital devices around today, there are a plethora of low cost boxes you can network with wire or wirelessly to access your server-based media, so there seems less incentive than there was when the spec was written, and wiring installed.

 

Green Open Source Home - Media Distribution
A MediaMVP on the back of a TV.  IR receiver faces down
control signals easily picked up by reflection from the floor.

 

What this system shows is that relatively low powered PC hardware can be made to run a plethora of applications with uptimes measured in months – or if you are prepared to forego the disk upgrade treadmill – years.  OK, so running a server 24 x 7 isn’t very green, but if you want a functional automated home, with a few bells and whistles, media server etc, you’re going to need at least one box running 24 x 7, so my view if that you might as well pile as much functionality (and disks with your media) into one power-efficient box, make it as reliable as possible (e.g. by spending extra on a better PSU), and have an adequately robust backup strategy.  As well as helping initially, electrically hardwired backup carries your essential systems through server downtime, and is easy to implement if considered from the start.  Fortunately this thinking often ties in well with more cost-effective kit, like those old-fashioned analogue dimmers on eBay.

Here’s a list of the main applications running on the PC, based on a “Mobile on Desktop” (MODT) motherboard from MSI that was a fashion in 2006-7. The server has 2G RAM, and uses a Seasonic 80%+ efficient power supply built into a recycled Elonex desktop case – see photo.

 

Software component

Function Hardware/ Peripherals used
SuSe linuxV10.3
  • Apache web server
  • MySQL used by zoneminder and xxv for VDR
  • PHP, Perl
  • Samba windows file / media server and Primary Domain Controller for unified user management & Windows client logins
  • Laptop-mode to spin down media disks when not used, saving power
VDRV1.6.0.2 Freeview digital TV recording, playback and live TV streaming over LAN.Can also receive satellite or cable DTV with appropriate tuner cards.Plugins:

  • Streamdev (HTTP streaming TV/audio)
  • vompserver – see below
  • Epgsearch
2 x TV tuners: USB or DTV1000 PCI card, (or others)NB The machine was unreliable with 2 x DTV1000 for some reason.
VOMPV0.3.0 serverV0.3.0.10 custom client

 

VDR client / server plugin to allow thick client access to VDR.Live and recorded Freeview TV streaming, media player and management of recordings and timers at each TV. 3 x Hauppauge Media MVP’s.  High quality SD via RGB SCART.
VDRadmin-AMV3.6.7 Perl based program providing web interface to VDR timers, recordings and live/recorded streaming, using epgsearch to automate timer creation based on complex epg search criteria.
XMLTV2VDR Extracts full epg data & film reviews from XMLTV feeds and insert into VDR epg.  Adds episode names (so you can weed out repeats and identify series) and allows films to be searched / recorded based on actor, director, review score etc.
XXVV1.6 Web interface to manage VDR, providing web preview of VDR recordings, search and timer management. Partial alternative to VDRadmin.
Misterhouse (mh)V2.104 Object Oriented Perl based home automation system.  Interfaces to many different types of hardware.  Provides:

  • Web interface
  • Lighting scene / channel control via conventional switches, speech, time of day, random (security) and web interface
  • Adaptive under floor heating control based on temperature & weather forecasts (a separate article in itself…)
  • Security interface (interfaces to standard commercial alarm system I/O via K8000)
  • Music media playback on server
    (poss. whole house audio)
  • Aggregation of other occupancy related functions.
No specific hardwareSee software interfaces below
xPLk8000 In-house developed xPL I/O daemon for 2 x Velleman K8000 interface cards and custom analogue output card for 24 dimmers.  Samples/debounces low voltage switches, partially implements xPL lighting schema, does smooth lighting fades, and samples temp sensors / converts to real temps, drives heating zone controls.Relies on native xPL support in mh.Uses xPL_Hub – based on xpllib.

Uses libk8000 to interface to K8000 with additions to support custom hardware.

K8000 on parallel port (I2C “bit banged”)- switches, alarm I/O, 4 x Analogue temp sensors, drives heating zones & UFH pump.In-house developed 24 ch. analogue output card to drive 0-5V dimmers.

K8000 provides full opto-isolation of switches and PC

Festival Text to speech engine driven by mh.Uses mbrola voices – acceptable quality once you’re used to it (i.e. a bit better than Stephen Hawking’s voice). Motherboard Sound
Zoneminder(zm)V1.24.2 CCTV application. Live video streaming, recording, motion detection, event database management, automatic offsite archiving via FTP and event notification via email and/or SMS.   Interfaces to mh.In-house developed maintenance scripts. Retired WinTV PCI card used purely for analogue video capture. (many other suitable cards)
WebminV1.510 Web based management of linux serverSecure remote https web access to most server functions.
ZimbraV5.0.23 Open source edition.  Enterprise mail server complete with secure https Ajax web interface for remote mail access.  Also secure SSL IMAP remote access and local IMAP or POP3 for Outlook or Thunderbird clients etc.
Ubuntu Netbook Remix V9.1 Access to all of the above, including wireless TV streaming from VDR server using streamdev plugin O2 JogglerSee photos

 

Green Open Source Home Interface

CLICK FOR BIG VERSION – Interface cabinet with 2 x K8000 and custom analogue output card to
drive 24 dimmers, interfaces to low voltage switches via mains rated cables.

 

Performance – As far as server CPU load is concerned, key measured figures are:

  • 10-12% Misterhouse (about half of this is due to complex lighting scene control and relating logic)
  • 5% xPLk8000 due to 25Hz sampling of all inputs and outputs via “bit-banged” I2C to provide switch debounce and smooth lighting fades.
  • 4% Zoneminder (1 camera)
  • 2% VDR + 1 – 2% per recording or playback channel
  • 1-2% for Zimbra

The total is around 25% doing everything required, peaking up to 75% during housekeeping tasks.  The CPU mostly stays in LFM (800MHz idling) except during these peaks with all applications running, so minimising CPU power. You can however log in remotely and securely with a couple of NoMachine NX clients and the server is very usable with a large HD screen (1920 x 1200 res) graphical interface – there isn’t a noticeable detriment caused by the server load.

Power – The CPU is a mobile Pentium M 740 (1.7GHz) giving a total measured idle PC consumption of about 39W with a 500G disk spinning. Add a further 3 disks in an “icy dock” (total 2TB), and a couple of TV tuners and an old WinTV capture card re-cycled for CCTV use, and the idle power rises to around 55W with the 3 media disks spun down.  You’ll be wanting to keep power down due to the cost/CO2 and heat produced in node 0 – as has been discussed recently on the ukha list.  Disk life is greatly increased with low temps – at an ambient 20C, these are reported by smartd  as between 33C and 37C on the server described.  Putting my commercial hat on,  I use an approx rule of thumb: £1/W/year with 3yr payback as the benchmark to decide if it’s better to invest in lower power hardware. (that explains the recycled WinTV card for CCTV).  Today one can no doubt improve a bit on server power by breaking this rule, as I discuss later.

 

Green Open Source Home - Server

 Server internals – off-the shelf parts – nothing special.
At the top an “Icydock” for 3 x SATA media disks – replaces CD-ROM + spare bay

While discussing power, it’s worth reviewing other system components from a green perspective.  I found that D-link had a range of very power efficient and small Ethernet switches which use remarkably little power (measured just 4W for a 24 port basic switch), but ADSL routers remain a problem, typically consuming, as mine does, 10W.  Scope for the future there.

Availability – To date, downtime has been about 2 half-days per year, equating to 99.9% availability.  The downtime has been caused by me messing around with server config to try one thing or another out, or moving disks around.  The longest uptime so far has been 6 months over last summer.  There was an infant mortality disk failure of a 500G server grade disk, sadly a media disk with limited backup.  Hence the aspiration to at least move the OS to SSD.   Be careful how you configure laptop-mode so as to limit the spin ups of the media disks – 3.5in disks are typ. rated for just 50k spin ups, I’ve done less than 5k on my 3yr (oldest) disk according to smartd, so even half the spin up count won’t be reached before obsolescence.  Exclude your OS disk of course!

Application choices – It’s clearly possible to build a system with these functions out of many different components. Did I use the first ones I tried – hell no!  Each of these applications was chosen out of a large range of possibilities based on the following criteria:

  1. Open source. Simple, in my experience this is almost always a better choice – more flexible, often more functional, and authors/maintainers are quicker to improve and fix bugs – yes, even the ones I report.  Sometimes the same day (e.g. VDRadmin), sometimes the next week (e.g. Zimbra).  If it takes more than a month, you might be barking up the wrong tree.  Is it cheaper?  Not if you value your time, but equally I’ve had to invest time helping debug several commercial applications over the years, so I’m under no illusion that parting with a pile of cash is a guarantee of quality and support.
  2. Software should show good promise of working well, meeting the specified needs within a few hours of installation, and must be reliable in testing in the target environment over a week or two.  An example of some apps I ruled out were open source mail applications that start by asking you to install and configure several complicated components – like Cyrus, Courier, Postfix, Spamassassin etc. Huge learning curve, how will you maintain it once you’ve been through the pain of getting it working? Life is too short!  By comparison, Misterhouse did something meaningful right away, with good diagnostics, and despite being effectively a huge Perl script, has proven very hard to break.
  3. 3rd party applications of any complexity should have a significant and ideally growing user base, with an active forum or email list. This is one of the best guarantees of longevity and support.  Open source versions of commercial applications provide an interesting choice too – piggy back on enterprise development, such as Zimbra – in testing found to be the easiest to install and configure, and a dozen (semi-automatic) upgrades later, never a problem.
Green Open Source Home
CLICK FOR BIG VERSION – Misterhouse –Lighting controls on Joggler
(Firefox).  Individual logs per item assist debug

Green Open Source Home

 CLICK FOR BIG VERSION – VDRadmin-AM on Joggler (Google Chrome)
Extended EPG with subtitle etc via xmltv2vdr

Green Open Source Home

 CLICK FOR BIG VERSION – Streaming live TV full screen off VDR wirelessly using
VLC player on Joggler. Apple fans: prepare to weep at the price/performance
– you get 8 or 9 of these for 1 iPad, and it can even multi-task – Firefox / other applications
are all still running in the background while streaming smooth live full screen TV.

Would I do it the same way again? – Mostly yes, the functionality available far exceeds my initial expectations, and closely matches spec.  It wasn’t the easiest to create, as there was all the testing and learning, and writing of C and OO-Perl in a few places to interface my quirky hardware orm provide unavailable features, so it’s not for everyone, but perhaps the list I provide above is a shortcut to some of the first applications out there that you should consider. You can of course substitute off-the-shelf hardware interfaces in most places.  Bear in mind that things may have moved on, since the list was developed between 2005 and 2008.

If starting today, I would consider using a dual-core Atom CPU based server, but even today, it’s not a clear cut choice in terms of MIPS/W/£ compared with the setup described.   For TV, I would expect to see some HD support, but HD media client and server solutions in the open source arena are still a bit immature today. As a fan of content over presentation, I would rather have a solid, quick SD system than an HD one in beta – that’s the engineer in me.  I’ve been pleasantly surprised by the perceived quality of SD from the MVP’s.  Friends have commented how good the HD pictures are, then I tell them that while they’re looking at a full HD screen, the content is not only ordinary SD upscaled by the TV, but worse, connected via analogue RGB!  Purists, cringe now.

Operating system? – Choose a linux distro that “has legs” and is big enough so you don’t have to go searching for all the dependencies each time you install a package, or worse are forced to keep building from source (open source is great – for the things you want to tweak, customise and extend – but that really doesn’t include the OS unless you have time to burn).  Unfortunately fashions change.  For example Ubuntu is clearly in the ascendancy while my initial choice from 8 years ago, SuSe, may be fading after the Novell takeover.  You want something with long term support as the last thing you’re going to want to do is swap OS once you have that beatifically crafted, reliable, mission-critical system containing several terabytes of media, running just the way you want.  Centos tracks Enterprise Redhat, and might be the most sober, if not bleeding edge choice today.

Virtualisation may be worth considering, but the overheads to support it in this (modest) environment seem be disproportionate to the benefits at the moment. In the long term, it’s likely to be the way to go for some applications.

What else did I consider and then discount, and why? – Here’s a list of major items tested. Many others fell by the wayside.

  • The great TV debate – MythTV or VDR?  VDR can run as a stripped-down daemon, but has a rich set of plugins and support programs if you want them, some a bit long in the tooth. It often hides its gems, and trades footprint for a much less glitzy user interface.  For me, a killer feature is support for multiple low power, functional, reliable & integrated clients based on hardware like the MediaMVP, meaning the server is “headless” running in daemon mode, and a (silent) client can be strapped to back of the TV (see photo).  Both support this now, but at decision time, MythTV needed a tuner per recording channel, whereas VDR could extract all (up to about 8 channels) out of 1 transport stream (multiplex) on a tuner. MythTV has overcome this now AFAIK.  A 2 tuner-setup is then all you need (I have recorded 4 programs simultaneously using only about 10-15% CPU) .  People on the web sometimes complain Myth is a heavyweight to install/configure and slow, so it’s a close call today.  VDR basic setup is easy, plugins can be messy and often involve building from source.
  • Mail – OpenXchange, for reasons given above, Scalix very limited choice of OS, won’t let you install on other versions of OS.
  • LinuxMCE. It was V1.0 when I looked at it.  It was a bit difficult to fathom how the automation stuff worked (and had limited interfaces at the time), it also used Myth for TV which I had ruled out, and at the time came as a monolithic OS install, I was some of the way with other apps on SuSe.  Today, it may be a runner.  As flexible as mh?

Tips

  • Put wires in the walls if you can. Wires are always easier to get working,  more reliable in use, and higher performance until we get multi gigabit wifi. Install appropriate wires for every conceivable location.
  • Think of the future – what’s not quite possible now (in your budget) is likely to be within a year or two of starting the project.
  • The project won’t get done overnight, unless you are using a specialised installer and off-the-shelf systems, in which case you’re reading the wrong article!  Allow for phased introduction of features and refinements.
  • Provide backup for essential controls like heating, core lighting, so you can live through disasters, esp. in the early days, and can occupy the place while getting the automated controls working right.

Todo list

  • I have yet to publish some of scripts and custom applications, but plan to when I have the time.
  • Voice control – not sure it’s that useful, but it’s possible with mh.
  • Interface to the alarm’s movement sensors to trigger lighting in some rooms  automatically after dark.
  • Move the OS to a solid state disk.  RAID has it’s issues and I wanted to keep it simple as I knew I’d be adding and swapping disks regularly.  SSD now offers the possibility of effectively turning the core part of the automation system into an embedded system.
  • When DVB-T2 cards / USB receivers become available, implement latest VDR version with HD.  Possibly add Freesat antenna instead with server DVB-S2 card.  This will require suitable HD clients at the TV’s, and a lot more disk space.
  • Implement a reverse proxy to provide access to all house applications via a common portal.  Not because it’s absolutely necessary, but because when working away on client sites, corporate firewalls usually block all outgoing connections to ports other than 80 and 443. Many of the applications described currently occupy separate non-standard high-numbered ports (5 in total already), so are blocked and need aggregating onto either port 80, or preferably 443 using https.  Squid to the rescue…
  • Fix a small recycled LCD monitor to the wall panels in node 0 to ease the  occasional server maintenance that can’t be done by remote NX client.
  • Automatic plant watering.  Just need relevant valves & plumbing.

Related Articles – My Automated Home : Soitjes Soit’s Digital Home Server

Send us Your ‘My Automated Home’ Story 

Want More? – Follow us on Twitter, Like us on Facebook, or subscribe to our RSS feed. You can even get these news stories delivered via email, straight to your inbox every day

3 Comments on "My Automated Home : Richard Farthing’s Green Open Source House"

  1. good write-up – very useful, too !

    performance – do you have a SWMBO rating, too ?

    Joggler – did you notice Kevin’s thread :

    https://www.automatedhome.co.uk/vbulletin/showthread.php?t=2755

  2. Great article. Very informative. Thanks for sharing, Richard.

  3. mishoboss | May 28, 2010 at 4:30 pm |

    Great article. I’m doing almost the same in my new home. I don’t like the X10 method of controlling lights and appliances (it’s an 30 years old, slow and not reliable standard). KNX/EIB/ZigBee/Z-Wave is very expensive. So, I decided to do what you did, as I have the opportunity to wire my whole house as I like.

    Rights now I make my custom controller with 32 220V AC dimmer outputs, 60 digital inputs and 8 analog inputs. If I had to buy 32 AC controllable dimmers, this would cost me more than a $6000… I make them all for less than a $60 with one micro-controller.

    I have still troubles with the hardware, then I start the software. Did you know OpenRemote? The are still at the beginning, but the project is promising 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.