Home Automation

"Home automation" is a very popular enthusiasm for "tech people", but normally it consists of buying a bunch of "smart" internet-of-shit devices and piling them all onto the WiFi.

I'm not very keen on this approach for a number of reasons.

So, I've adopted a policy of using a bunch of independent control systems, each of which uses the simplest possible standard protocol. Then, I install all the relevant bits onto my always-on home server (currently a Raspberry Pi 2), or optionally a relay computer (Pi Zero W) in a separate room where applicable.

(This does not mean that I necessarily believe Raspberry Pis are the best single-board computers.)


"Smart TVs" are just underpowered computers which you have no control over, though older ones without a network connection are still kind of mostly acceptable.

For video I use normal computer monitors, with ddcutil over DisplayPort or HDMI for remote input switching and brightness control, and for audio I use either speakers directly connected to the computer or a normal stereo system.

In the case of the stereo, I use a utility I wrote for emitting the amplifier's infrared-style remote-control link signals from a GPIO pin on the Pi.

This utility also includes a basic service for listening to a keyboard device, which in this case an old Windows Media Center remote control presents itself as, and triggering various programs to run.

Mains power switching

Having a tiny computer permanently plugged into every mains socket or light fitting is a horrifying prospect, and for each one to have its own cheap and shitty power supply seems like it's unnecessarily multiplying the possibilities for failures or random night-time explosions.

A more typical professional solution is to either have many radial circuits switched or dimmed at a single source which includes control gear as well as circuit protection, or to have a combined DC power and signal bus going to control units at the various points of use (which can then share a single supply circuit, but of course still don't have to).

As a cheap solution I have bought a DIN-rail-mounted relay unit, and built an elaborate extension lead with a few BS1363 sockets and a couple of extra 3A circuit breakers for longer semi-permanent lighting circuits. Thus, most of my lighting in the combined bedroom/office is run on flex cable from a single corner in the room where this thing sits. Many more decoratively-inclined people would probably consider this ugly but I don't really care, and it works really well. (I'm probably just lucky to have this awkward chunk of mostly-hidden space which would be useless for anything else.)

Large annoying unit situated in awkward corner of a room

My alarm clock now consists of a fan heater / foot warmer (5 amps on low power setting) coming on, and a short while later, all the lights, including one which I can point at the general area where my eyes are likely to be. It's pretty effective! And amusingly enough, it's currently implemented as a cron job in a very stereotypical "sad nerd" style.

The particular relay unit I've chosen has eight channels, all of which have generous current ratings far in excess of the 13A plug fuse the whole thing goes through (also more than enough for the heater's small fan motor). It's controlled by DMX signalling (a simple 1980s-era standard still used in professional theatre lighting today), which also allows it to share a bus with the RGB lights whose power supply it controls.

For this DMX bus, I've used completely inappropriate extra-thin shielded twisted pair cable, which is designed to handle balanced audio in patch bays and which I also use for headphone cables. (In practice, the impedance mismatch doesn't seem to be causing any problems, though I was half-expecting to need to experiment with different termination resistors). The control signals come from a USB RS485 unit at the Pi, controlled by another utility I wrote, triggered by the aforementioned remote control service. The cable's shielding foil is connected only to the mains earth at the DIN rail unit, to avoid ground loops.

For this DIN rail enclosure, I've taken advantage of the UK wiring regulations semi-recently mandating metal-clad distribution boards for new domestic installations, and picked up an obsolete plastic unit (from which the RCDs and main switch, which I don't need anyway, have been removed) for under half the price of a much smaller new enclosure. This particular unit is generously sized for three sockets, the large relay unit and its 3A breaker, as well as two extra lighting breakers (not shown in this early photo):

Partially completed wiring of the relay unit and sockets in the enclosure

The DIN rail itself is robust enough, handy earth and neutral bars are included, and there is plenty of space inside for wiring (though the whole unit still fits perfectly in the corner I currently need it to). However, as the enclosure is designed to mount to a wall with fixed cabling, rather than for this kind of application, some creativity [1] is still needed to make an adequate cable grip solution.

As always, none of this should be taken as advice, and we are each entirely responsible for being confident in anything we build or do.

Remote control

In addition to the aforementioned Windows Media Center remote control (aka remote-shaped keyboard), I also have a simple web service (CGI script). This lets me trigger a couple of the same scripts in a very basic fashion. It's good enough to make an Android phone useful, with shortcuts on the home screen.

[1]Wedging in a junction box with cable ties feels kind of creative, anyway, even if everything is very nearly being used for its intended purpose.