May 17

Mailbird 2.0 Review

I’d like to consider myself a child of the modern world, but … email. I’m a slave to it. I have a number of different enterprises that I run and look after, I administer 7 of my own Google Apps Domains not to mention looking after a few more for my clients (schools) who have typically many hundreds of email accounts per domain.

For a small business owner, customer communications are absolutely critical to my livelihood, and so choosing the right email client is important for me.

Back in the earlier days of Windows, there were really only two products for Windows users. Outlook and Outlook Express. The latter was laughable, and so I was a great lover of Outlook with its enterprise features like Public Folders, shared resources, meeting requests, etc. I loved Outlook XP when they introduced “Outlook Today” – somehow this was the pinnacle of technological progress being able to see my calendar and my emails and my task list all in a friendly view.

Then came Gmail and I never looked back. In comparison, Outlook felt bloated and slow – probably because email demands have increased over the years and we expect to keep mailboxes of 15GB and more, with everything instantly accessible.

But webmail was lacking in some ways. Firstly the hassle of multiple sign-ins, and the fact that I couldn’t keep multiple calendars from different accounts (yes I know this is a bizarre thing to need…)

For years now I’ve been using the Windows 8.1 and Windows 10 Mail client and in the most part I’ve found it excellent. But… lacking.

There’s no native access to Gmail contacts or Calendar (although it is possible to view your Gmail calendar now). It’s a very well designed interface, but it lacks configurability, such as using different views, specifying exactly how much of the last 15 years of email I’d like to download, advanced email signatures, and I always need to revert back to Gmail web interface to search my email archive. For years I’ve kept my eyes out for a new mail client.

Enter… Mailbird 2.0. The feature set was attractive:

  • A “coming of age” email client
  • All the obvious things like multiple account support
  • A really nice integration with Google Calendar and contacts
  • Unified email inbox (this has become important to me)
  • Quick, batch archiving of emails in multiple accounts (Outlook 2016 is missing this!)
  • Touchscreen support
  • Some other great integrations: a Whatsapp sidebar, Moo.do, and loads of other apps
  • Identity support, i.e. advanced multiple email signatures

As soon as I downloaded it, I loved it so I purchased it within a few hours and I’ve been running it for a couple of weeks now.

Here’s my review.


First things first. It’s fast. Searching is fast, the UI doesn’t hang randomly as I’ve come to expect from Outlook, and I love the keyboard shortcut support. I really like multiple selecting emails in the unified view and hitting E to archive them into their respective archive folders. Getting to “inbox zero” is a big thing for me, as I feel like I am sinking under email sometimes, so this is good.


An email client must not crash. Ever. Having put Mailbird 2.0 through its paces with my 10 email accounts ranging from Gmail to Office 365, each with gigabytes of mail, attachments, folders, tags, etc., I’m pretty happy on the reliability aspect.


The application supports two view styles: the traditional Outlook style reading pane at the bottom right with email list above it, and the newer style email list on the left:

I’m a configurability nerd, and I like a little more control. Whilst I can drag panes to make them bigger and smaller, it’s not amazing in this respect. But – life is too short, and it does what I need so I’m happy here.

Email signatures

Excellent support for advanced signatures. With one exception, which you may consider minor but to some it’s very important. It doesn’t allow attaching images to the signature. You can link to images online, but not attach.

Some email purists might consider this a good thing: attaching a file to every email you send makes email bigger, and takes up more storage space, increases bandwidth use, etc. For me it’s a small price to pay to ensure the signature appears correctly on the screen, as most clients block linked images by default.

I raised this with Mailbird support, their first response was that attaching images to a signature could create a security flaw as a trojan might inject a virus into the signature. I responded by saying that they should probably consider disallowing email attachments altogether in that case, not just to signatures. They responded well and said they would consider this for future developments.

Core reading and writing functionality

The main look and feel of the interface is similar to Outlook in that you can double-click on an email in the inbox list and a new window will open.

However Mailbird has this quick “in-line” email compose view:

This is the default way of responding to an email, if you hit R for reply or use the button over the email in the preview pane:

This inline view is the biggest problem with Mailbird.

To date I’ve lost a few emails, and been confounded by what to press and where, when you need to change the recipients, subject, or anything else.

Here are the problems:

  • If you “reply to all”, it only shows the primary recipient at the top, i.e. the person who sent the email. That’s fine, because at the bottom it lists all recipients

  • Now what if I want to change the recipients? You would click on the little double arrow at the bottom, wouldn’t you? No. That switches between “reply” and “reply to all”
  • So you’d click on the names at the bottom, right? No. That does nothing.
  • So you’d click on the same line as the green name at the top, right? No. That collapses the inline view and the whole email and you have to start again.
  • So you’d click on the little arrow on the right at the top? No, that brings up a context menu for the original email, which is completely useless when you want to do something with the email you are writing.
  • Ok so you click on the green name at the top. That shows what I need:

  • Let’s say you’ve gone ahead and spent 30 minutes writing a response to your email. Can you see where I’m going with this…
  • You click on a name at the top to remove it (you don’t need to CC yourself in do you?)
  • Right-click – no option to remove recipient
  • Click and press delete – woah. You just lost the email you wrote. There’s an option to “UNDO” that pops up at the bottom, but when you press it, it just un-deletes the original email, it doesn’t restore your draft!


There are a few other things that bug me about the inline view, which make it very difficult to use in my opinion. This aspect lacks polish.

Most importantly, I should never lose a draft. Ever. This is a big problem for me.

Searching is fast but I can’t do powerful searches (date ranges, field searches).

The client uses screen space very efficiently.

I’m unable to specify views. For example I can’t show unread emails. If you need to get to Inbox Zero, this makes it hard work as you’d have to search through hundreds of emails to find that one unread email to mark it as read!

I can click quickly between huge mailboxes without any lag. This is excellent.




Jan 16

Dynamic DNS using Linode and local powershell script

After noip.com and dyndns.org shut their doors to all but non-paying customers, I spent many years without being able to reliably access my home network from outside. Of course, it was always possible to do without dynamic DNS by making a note of the current IP address and use this for as long as the address stayed the same, but sods law I would *really* need to access home the day that the router was upgraded remotely or the address expired or whatever.

Over these years I looked at various options, and almost settled on installing BIND9 and using nsupdate on a remote machine and writing a script on the local network to check-in periodically.

This seemed like a good option because I already pay monthly for a linux VPS so there was no extra outlay. Deep down, though, I knew it was overly complicated and would probably break someday because I don’t have the time to maintain my VPS in a “mission critical” way, or I’d rebuild the server and forget it took me 4 hours to setup the solution, thus ending up not having it for another 6 months because I couldn’t be bothered to go through the effort again.

Turns out there was much more of a tidy solution for me. I use Linode.com to host my VPS, and I also use its excellent DNS manager control panel for all of my domains. Sure, you can use the DNS manager of your domain registrar and create A records and the like to point to your Linode’s IP, but it’s so much nicer pointing your NS servers to Linode and managing all your DNS settings from Linode. The interface is designed beautifully, the account security is top-notch, not to mention there’s a very sweet iPhone app that makes creating records / cloning zones a breeze.

I digress. My solution involves creating a Linode API key, pulling-out the domain and resource IDs from Linode, then having a powershell script which runs on a local Windows box update these when it detects a change of address.

I won’t bother going in to the former as you can work that out, but the latter is certainly something worth sharing here.

After nicking the IPChangeNotify powershell script from somewhere on the web, I discovered a whole load of reliability weaknesses, which I’ve pretty much accounted for. Without further ado, here’s the spec of my updated script and solution as a whole

  • relies on Windows task scheduler
  • (ironically) uses dyndns IP address checker at http://checkip.dyndns.com/
  • if for some reason the above doesn’t respond in a timely manner, it waits, tries again, waits, etc.
  • updates are of course made securely, over https
  • email notifications telling you a whole load of useful info such as:
    • how many attempts it took to discover the ip address
    • number of milliseconds it took to discover the address (for fun / to help diagnose problems)
    • old ip address
    • new ip address if changed
    • response from Linode API to confirm that the A record was updated
    • email subject based on change / success / failure to allow for sensible rules in Gmail
  • write-out the IP address to Dropbox (added bonus – you get a little Windows notification when this text file is changed) – just in case something goes wrong and you can’t be bothered to sift through notification emails

All you need to make this work is:

  • a Linode account
  • Windows machine on your local network that stays on all the time
  • the below script

(Apologies for the godawful formatting, but it should copy/paste okay!)

$scriptpath = $MyInvocation.MyCommand.Definition
[string]$dir = Split-Path $scriptpath
set-location $dir

$oldip = gc .\ip.txt
Write-Host “IP stored in Dropbox: $oldip”
Write-Host “Getting current IP…”

$firststartTime = get-date
$webpage = (New-Object net.webclient).downloadstring(“http://checkip.dyndns.com”)
$firstendTime = get-date
$timetogetpage = ($firstendTime – $firststartTime).TotalSeconds
$currentip = $webpage -replace “[^\d\.]”
Write-Host $currentip
Write-Host “That took” $timetogetpage “seconds”

if ($timetogetpage -le 2) {
$triestext = “(on first attempt)”
} else {
$triestext = “, not on the first attempt:`n`nTry 1 ($currentip) = $timetogetpage`n”
$tries = 1
while ($timetogetpage -gt 2) {
Write-Host “Let’s try again”
$subsequentstartTime = get-date
$webpage = (New-Object net.webclient).downloadstring(“http://checkip.dyndns.com”)
$subsequentendTime = get-date
$timetogetpage = ($subsequentendTime – $subsequentstartTime).TotalSeconds
$currentip = $webpage -replace “[^\d\.]”
$triestext = $triestext + “Try $tries ($currentip) = $timetogetpage `n”
Write-Host “Try $tries ($currentip) = $timetogetpage”

$smtpServer = “smtp.gmail.com”
$sender = “sender-email@gmail.com”
$users = “recipient-email@gmail.com”, “anotheruser@gmail.com”
$subject = “”

# change the below to match the ID of the given record
# change api_key and domainid below to match your Linode.com API key and ID of the domain

if ($timetogetpage -lt 3) {
if ($oldip -eq $currentip) {
# Discovery success – IP stayed the same (ideal case)
$subject = $subject + “IP address found: $currentip. No change! (discovery took $timetogetpage seconds)”
$body = “Old IP = $oldip`nNew IP = $currentip`n`nNo change!`n`nDiscovery took $timetogetpage seconds $triestext”
Write-Host “Not updating the file” -ForegroundColor Gray

} else {
# Discovery success – IP changed (important case)
$subject = $subject + “IP change detected: $currentip. Discovery took $timetogetpage seconds”
$body = “Old IP = $oldip`nNew IP = $currentip`n`nWe updated the DNS!`n`nDiscovery took $timetogetpage seconds $triestext”
$currentip | Out-File .\ip.txt -Force
Write-Host “New IP saved in file is: $currentip” -ForegroundColor Green

Write-Host “Updating DNS…”
$updatewebpage = (New-Object net.webclient).downloadstring($updateurl)
$body = $body + “`n`nOutput of the DNS Update service:`n`n$updatewebpage”
if ($updatewebpage -like “*Invalid*”) {
$body = $body + “`n`nLinode response: DID NOT UPDATE. Check Linode.com.”
} else {
$body = $body + “`n`nLinode response: UPDATED”
Write-Host “Output of the DNS update service: $updatewebpage”

} else {
# Discovery failed
$subject = $subject + “IP address kept as $currentip (discovery failed and took $timetogetpage seconds)”
$body = “Old IP = $oldip`nNew IP = $currentip`n`nI’m suspicious, discovery took $timetogetpage seconds $triestext”
Write-Host “IP address supposedly found, but it took $timetogetpage seconds” -ForegroundColor Red
Write-Host “Keeping the current IP: $currentip” -ForegroundColor Red

# Finally send the email
Write-Host “Sending an email now…” -ForegroundColor Green
foreach ($user in $users) {
Write-Host “Sending email notification to $user” -ForegroundColor Green
$smtp = New-Object Net.Mail.SmtpClient($smtpServer, 587)
$smtp.EnableSsl = $true
$smtp.Credentials = New-Object System.Net.NetworkCredential(“sender-email@gmail.com”, “email-password”);
$smtp.Send($sender, $user, $subject, $body)





Sep 15

My KeePass to LastPass Migration Woes!


This blog post details the technical difficulties faced when trying to migrate from using KeePass to LastPass. KeePass has been an excellent password companion for the last 6 years and I’ve been using MiniKeePass for iOS, loading my password safe from Dropbox quite happily. But since starting to use a Chromebook I’ve been increasingly frustrated in this area. There are a few Chrome extensions that provide access to KeePass. CKP has 4.5 stars in the Chrome app store, but I’ve found this browser extension clunky and annoying to say the least. Manual search in CKP doesn’t work properly and despite the good reviews overall the experience in my opinion is poor. Not to mention it only gives read-only access to the password safe.

So I finally bit the bullet and decided to migrate to LastPass, after months of frustration trying to access my password safe from ChromeOS.

Here I document my migration woes, for no other reason than to provide help to anyone who might be googling for this info!

The import

LastPass supports importing from KeePass. You have to export to XML then upload the XML. Sounds simple, but fraught with the following problems.

Tip #1: use Firefox. Don’t question this, just install Firefox and run the import in Firefox. This solves a lot of issues.

Tip #2: if you used folders in KeePass, consider exporting each folder as a separate XML file. If you export the whole database, the result is that *all* your folders will be in a top-level folder. There’s no obvious way to change this later.

Problem: import process hangs


  • My KeePass database had a folder structure. As per Tip #2 above, split up your export into different XML files, one per top-level folder. To do this, right click on your folder in KeePass and there’s your option to export
  • The process can still hang, and I scoured the XML file for possible issues, however I learned after much trial and error that the hanging was random and not related to strange characters. Delete the folder that may or may not have been imported into LastPass by right-clicking on the folder in the web interface. Again – don’t attempt this in any other browser than Firefox, results are highly unreliable in Chrome! Then simply re-attempt to import. For me at least, it worked on the second or third try.

Problem: Items are imported as note ITEMS, not website ITEMS

I used KeePass to store credentials for websites, banking, etc., as well as other personal info like driver’s licence info etc.

LastPass stores items as different object types. Anything you import that had something in the URL field in KeePass will be stored into a website item. Anything else will become a “Secure Note” of type “General”.

So if you’re like me and didn’t really bother putting anything in the URL field in some / many / all of your entries in KeePass, you’ll need to do the following.


What you need to do is edit your XML file before importing to give the URL field some value. I gave mine this: http:/0 as if you accidentally attempt to launch the website we don’t want LastPass attempting to send your credentials to a website that actually exists like www.null.com (yes, it exists…)

To do the above, using Sublime Text Editor:

  • Remove leading whitespace from the XML file, otherwise the following step won’t work. Press Ctrl-H to find and replace, click the Regex button, and use this string ^[^\S\r\n]+ and make sure nothing is typed into the replace box. Replace all to remove leading spaces / tabs
  • You now want to find and replace all instances of the URL field where it’s blank, but not where it’s not. Find multiline string

<Value />



Use Ctrl-Enter to split the lines in the find and replace fields.

Now hit Replace, save the file, and try the import. This time you should notice the icon next to all items is not the purple pen (secure note), but the white box (website).

Jul 15

OLED from BuyDisplay.com – Mat’s Hookup Guide

Here’s a quick hookup guide and sketch to get the ER-OLEDM032-1W display to work with Arduino. We are going to use the u8g library to drive the OLED.

The ER-OLEDM032-1W is a 256×64 graphic OLED module costing $26.56. White on black. I bought mine from eBay although the Chinese brand BuyDisplay.com sells them directly.


There are two versions of the display, one including the integrated PCB (above) and one without. We want the above one, with integrated PCB. Make sure you purchase the one with the M in the part number.

Here’s a link to the data sheet.

About the part number:

  • ER stands for “East Rising” the manufacturer
  • OLED stands for OLED: “organic light emitting diode”
  • The M stands for “module”. I think. They do two versions, the one with driver board (adapter board) which is this one, and one without the driver board which doesn’t have that M. Confusingly they call the one without a driver board module an OLED module as well. Either I’m wrong or their naming convention is confusing. Or both. Either way you probably want the one with the M, it has an integrated PCB.
  • The 032 stands for 3.2 inch, corner to corner
  • Not sure what the 1 stands for, they all seem to have it
  • The W stands for white, they have other colours (yellow, green blue)

To use the display with u8g library and Arduino you must swap the tiny resistor on the back in position R18 to the position R19. Do this with a steady hand, some really good tweezers and a soldering iron.

ER-OLEDM032-1W Display hookup
swap 0 ohm resistor from R18 to R19 on rear of display
1> gnd
2> 3.3 OR 5 ok
4> level conv – arduino 4 (clock)
5> level conv – arduino 5 (data)
7-13> gnd
14> level conv – arduino 7 (command data select i.e. D/S)
15> reset – this needs to be connected to +5v
16> level conv – arduino 6 (chip select)

For the level converter I used this very cheap module, a clone of something by Adafruit: http://www.ebay.co.uk/itm/Pop-IIC-I2C-Logic-Level-Converter-Bi-Directional-Module-5V-to-3-3V-For-Arduino-/381311755120?hash=item58c7f3a370

And here’s a sketch. I ripped this from a larger sketch I have been working on and haven’t tested it, but it should all be about right.

#include "U8glib.h"

#define oledClock 4 // OLED
#define oledData 5 // OLED
#define chipSelect 6 // OLED
#define commandDataSelect 7 // OLED

U8GLIB_NHD31OLED_2X_GR u8g(oledClock, oledData, chipSelect, commandDataSelect);

void setup()
// Setup U8G
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) u8g.setColorIndex(255); // white
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) u8g.setColorIndex(3); // max intensity
else if ( u8g.getMode() == U8G_MODE_BW ) u8g.setColorIndex(1); // pixel on
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) u8g.setHiColorByRGB(255,255,255);



/* --------------- */
void drawControl(void) {

** insert logic to draw different things here, e.g. as follows **

// Draw current room light level
if (showlightlevel == 1) {
u8g.drawStr(178, 30, "Currently");
if (lux < 20) {
sprintf (buff, "%i%s", lux, " (dark)");
} else if (lux < 100) {
sprintf (buff, "%i%s", lux, " (med dark)");
} else if (lux < 400) {
sprintf (buff, "%i%s", lux, " (med bright)");
} else if (lux < 10000) {
sprintf (buff, "%i%s", lux, " (bright)");
u8g.drawStr(178, 40, buff);

void loop()
u8g.firstPage(); // START U8G
do { // START U8G
drawControl(); // START U8G

** insert the rest of your sketch that does stuff **

} // END U8G
while( u8g.nextPage() ); // END U8G

Apr 15

Multi-zone audio: a discussion of the options

Multi-zone Audio: the last 15 years

Multi-zone audio has been possible in the home for decades now, but until recently has only been an option for the super-house; the high price of systems and installation meant it was out of reach for the average home.

The first cheap device I know of that opened-up multi-zone audio to the consumer market was the SliMP3 (2001), which quickly matured into the Logitech Squeezebox ecosystem of devices and apps. Unlike the old paradigm, where a multi-zone amplifier had to be connected to a central source which was then controlled from each room – thus requiring direct connection from each room to the central unit (i.e. in-wall wiring) plus speaker cable running from a central location back out to the rooms (i.e. in-ceiling wiring) – the Squeezebox was situated in your living room and bedroom and connected to your speakers directly. It used a wireless connection to talk to the central controller, providing access to a central store of music, sync’d or independent control of audio for each zone, internet music, and other bells and whistles.

Sadly Logitech abandoned the product in 2013, but as of 2015 the ecosystem lives on thanks to software players and a surplus of cheap, high quality second-hand audio players which are still traded online.

Sonos filled the vacuum. Their units are more expensive than Squeezebox devices and many have built-in amplification. They are frankly sexier and more user-friendly, but for the audiophile, advanced music cataloger, classical music listener, DIYer, or home automation expert, Squeezebox still has huge advantages over Sonos.

The Problem / The Dream

The problem with the Squeezebox/Sonos paradigm of multi-zone audio is this: although you can play different music or listen to different radio stations in each room, you are limited by what the system itself can do. For example, Squeezebox and Sonos are internet-enabled music players. They don’t play Bluetooth audio or music playing on your Apple TV, they don’t play CDs, and they can’t pump the music from a YouTube video projected onto your wall around the home. Surely this is “The Dream”?

You still need a multi-zone audio amplifier for this. And they cost bucks. Big bucks.

You want

  • expensive hi-fi quality audio in your living room, and some cheap amplifier to power the speakers in your bathroom and hallways?
  • 12 zones of control instead of 4 because your hallway speakers are next to the kids room and you would rather have them off and night?

Forget it. Not without quadrupling your budget from £1500 to £6000.

The likes of Niles Audio who produce a network-controlled amplifier, and Russound who make interesting looking wireless-powered receiver amplifiers amongst other things seem like good options. Again these options do appear to total the thousands, not the (very) low hundreds which I’m aiming for.

And sadly even if you spend £6k+ do you think you can have the bells and whistles? What about

  • controlling audio volumes in each room from your central automation system (e.g. OpenHAB) as well as some proprietary wall panel?
  • fading the music across the whole house when someone calls you on the ‘phone?
  • fading the music down when the doorbell goes?
  • having your house speak to you?
  • speaking to the burglar when he enters to freak him out?
  • [insert your own #homeautomation fantasies!]

Possible Solutions

I looked at multiple source, multiple zone systems for a long time before deciding that I needed to home-brew my own. Here was my thought process:

  • I have some nice Class A amps sitting around. They cost me hundreds in total, not thousands. Why can’t I use them?
  • I can pick up a Class D amp with power supply for £20, for kitchen and non-audiophile zones
  • I just need to find a way to do the switching and mixing of multiple audio sources

Reed relay switches. With a view to making my own Arduino-controlled source switcher I looked at using transistors, relays, or dedicated audio ICs. I gravitated towards the idea of a series of reed relays to switch multiple audio sources. A relay is a cheap and very high quality way to switch an audio signal because it introduces no distortion or load to a circuit. Reed relays are great because they would minimise the audio click you’d otherwise get when using a metal relay to switch from one source to another. Reed relays unfortunately don’t come in complex arrangements such as 2P6T which would be nice, as this would allow you to switch the positive signal path for L and R between 6 sources – but this is not a huge problem as they are only a couple of quid each and so you can buy multiple reed relays.

After thinking about this a little more, it becomes apparent that you can’t just connect up a load of relays and hope for the best: your board design must account for minimising cross-talk. Whatsmore, using relays only solves 1/3rd of the problem: the input stage. You still have to route signals to multiple rooms and if you are aiming for the dream option of fading something down when something else happens, you have to design gating and signal detection. Routing audio to multiple rooms isn’t simply a case of connecting one signal path up to multiple rooms’ amplifiers. Adding more than one load will introduce distortion. And although gating and signal detection is possible with cheap ICs, this is starting to grow into a big project!

Wow… this idea got out of hand quickly.

Using dedicated audio ICs. Whilst it’s possible to find audio switching and mixing ICs, it becomes apparent after a little research that such ICs have rather specific applications, furthermore then aren’t very “black box”; a significant investment of understanding about their inner workings is required to design them into an application. When an ICs application notes is a document 45 pages long, this particular home automation DIYer knows it’s time to consider alternative options!

Making the Dream Happen!

Sorry, dear reader, to drag you through this rather pointless process. I’ve banged-on about my take on the development of multi-zone audio over the years, and let you into my raw thoughts about designing my own system, which amounted to nothing.

If you’ve got this far, however, I do have a great solution for the Audio / Home Automation enthusiast looking for the same things as me.

The ClearOne XAP 800

  • It’s a 12×12 audio switch / mixer
  • No it’s not an amplifier, but it will be the core of your multi-zone automation system
  • It’s cheap – very cheap and highly available second hand (£30 ebay)
  • It’s very powerful
  • It’s rackmount

And here it is:


ClearOne XAP 800 – a 12×12 audio mixer



If the above looks to you like it has worryingly few buttons on the front, then like me you may be thinking… “hmmm, is this thing software controlled?” Yes it is.

And if the above looks to you like it may be far too small to house the numbers of inputs and outputs you would need to power a whole home, then rest assured:



I’ve just bought mine on eBay for £25.

Don’t be put off, it’s called a “microphone mixer” and a “conferencing system”, and whilst I’m sure it’s great for B&Q’s staff announcements, this baby is a dream come true for home automation and multi-zone audio.

Why is it so cool? The product manual will answer that (nicely written too), but here’s my take with a Home Automation hat on:

  • Core use: an audio routing matrix. Basically this provides everything that the most expensive Crestron multi-zone system does, and more. Route an audio source to a single room, multiple rooms, or groups of rooms. Route another audio source to another room or set of rooms. Switch the source or zones from anywhere in the home. Keep going until all rooms have the exact audio you want. Rooms could be set up as stereo zones, mono zones (e.g. bathroom), or even 5.1 theatre zones.
  • Scenario presets. Because of the possible complexity of a 12×12 routing matrix (i.e. assigning different sets of audio to different rooms) you will want to have presets. The XAP 800 supports 32 whole-system user presets.
  • GPIO: interface with your home automation hub via an Arduino. Amazing! Imagine the possibilities:
    • Remotely control the presets, e.g. listening scenarios.
    • Remotely control volume, set EQ Presets, and control audio routing direct from my MQTT wall panels! (Did I mention this thing has digital signal processing?)
    • Page someone from another room, and fade-down the audio if they are listening to something
  • Not only does the unit have GPIO, it has GPIO assignment. There’s even a “GPIO builder window” in the software, meaning that you can assign whatever you wish to the input / output pins.
  • The device supports gating, gating groups, configurable ramps, and a whole load of other advanced stuff when it comes to stopping one sound when another one happens.
  • The device has echo cancellation and some advanced “adaptive ambient level”, which means it can detect noise even when there’s ambient noise in a room. Useful if you want to hook-up some home automation voice commands with boundary mics
  • Rest assured, mic/line level can be configured for each input

Looking forward to getting my new XAP 800 hooked up with some pre-amps, amps, audio sources, speakers, and an Arduino to give it all a whirl!

Jan 15

Pimped-Out DIY Alarm Bell Box

For reasons of general sensibleness and security I won’t go into much detail about exactly how my DIY Alarm Bell Box is configured to work in relation to actually keeping thieves away. Suffice to say: network of sensors indoors and out, differential siren sounds depending on alarm state, iPhone notifications and emails to neighbours (seriously, I will be doing the same custom install for them, they are very nice people. And big. Very very big. 7 foot. And they have dogs. Dogs that eat anything.)

So the thing pictured below looks like a dummy box, it’s sold as a dummy box, but it is far from a dummy box.

It’s sold on eBay for £9.10 including postage from a UK seller (that price is without “dummy LEDs” – I’ll be adding my own thanks), and it does rather fortuitously have a rather sophisticated plastic moulding design inside that allows the placement of alarm sirens, LEDs, internal housing boxes, and incoming cables.

Cheapo alarm sensor casement  £9.10 including postage

The box itself is not IP66 rated, but that’s not a problem because I have bought from Maplin an internal component box and some anti-mould silicon sealant which will do the job of making sure the electronics I’m about to pimp this thing up with stay nice and dry.

So what’s going into this puppy?

Arduino Nano, obviously. And a tiny red W5100 break-out board to provide networking. Oh and this cool super-tiny buck converter to allow me to power the thing over ethernet:



And the cool stuff? Why not:

  • Vibration sensor (for anti-tamper)
  • BMP180 Barometric pressure sensor (we always need to know outdoor pressure, right?)
  • BH1750FVI Ambient light sensor. This is mounted under the blue window, but it doesn’t matter because the serial output needs calibrating to some kind of meaningful scale anyway, so it’s all relative
  • DHT22 Temperature and Humidity sensor. Because it’s wrong not to
  • 4x ultra-bright red LEDs
  • 4x ultra-bright blue LEDs
  • 4x ultra-bright green LEDs
  • 2x cheapo very loud buzzers (Maplin and eBay – £2 each – different pitches)


The astute amongst you will notice I’ve already maxxed-out the pins on the Nano, but LEDs will be in groups of 2, meaning 6 pins. This still gives me Knight Rider options. More importantly it allows me to use a number of signals to would-be burglars.

I may even use these addressable LEDs with driver, if I can be bothered not to program individual LEDs myself.

Naturally the thing will report sensor values on their own individual MQTT topics back to my OpenHAB server which stores all data for historic purposes.

And naturally the thing will respond to commands such as:

  • Make discreet but audible warning beep to potential intruder in back garden when house armed
  • Make screaming noise when house security has been compromised (this of course along with iPhone notifications / emails sent to me and three other nominated contacts. I’m lucky, I have cooperative neighbours who will take care of these things)

Such commands will be triggered in OpenHAB from network of sensors inside and outside the house, including vibration sensors on doors etc.

Will I get a twitter notification when a cat / dog / fox moseys into the back garden? Probably.

And the fun stuff:

  • Using a series of fun flashing sequences, alert me when I walk down the road whether wife, child, or both are home. (FYI I’m not really married.)
  • Using a series of fun flashing sequences, alert me when I walk down the road that I should have brought an umbrella as the forecast shows it’s going to rain in the next 4 hours
  • Using a series of rather serious and angry flashing sequences alert me that I left the window open when I left the house
  • etc.


Jan 15

How Kerning Could Save Your Life

As someone who buys electronic goods from China on a regular basis, I am used to looking closely at the CE logo to check how close together the letters are.

For my buying habits it doesn’t matter. I’m dealing with low-voltage stuff. The worst that could happen is a component might overheat and cause a fire in my loft space melt a bit.


It’s not that the Chinese make dangerous electronics. It’s just that they (I should be specific; “they” means the Chinese Export regulatory bodies) don’t do a great job of checking whether the electronics they do make are safe, or whether they are likely to kill you.

I’m probably splitting hairs.

Recently I bought a job lot of COB – as in “corn on the cob”, or “Chip On Board” – LED light bulbs. Gladly mine were safe by design, but as this video shows I got lucky.


Jan 15

Home Automation PoE with Arduino – in praise of DIY PoE!


First up I’d say in any professional environment there’s no way I’d recommend anything but “proper” PoE, that is to say 802.3af or PoE plus.

For DIY home installations, however, we can do things differently. And I don’t mean “substandard” by any means. Rather we can do them in a more tightly-spec’d way, we can design our own system of distributing power that is equally efficient in terms of power loss, and equally reliable… but far cheaper.

(The reason you wouldn’t inflict this on a corporate environment is not because it isn’t as good, but rather the next guy / girl who comes along won’t spec the replacement power supply properly, and blow something up. Also DIY jobs tend to vary in quality, whereas using a PoE switch and device gives a standard of power distribution quality that can be relied upon. We DIY types do things properly, we are masters of our own home, and we know how to do basic maths, so it’s okay, right?)

DIY PoE with a buck converter - dodgy connections fine for prototyping but we can do better

DIY PoE with a buck converter – dodgy connections fine for prototyping but we can do better


I suppose I would sing the praises of DIY PoE for the home, because when it comes to electronics I love doing things myself.

This isn’t true with computers, I can’t be bothered to faff around swapping RAM out or upgrading motherboards for my own gear any more, although I used to love doing that. Perhaps that’s because in the 90s desktop PCs were the rage and to play better games you had to have the better video card, which required knowing how to change the video card, which meant knowing how to build a computer. I don’t play games any more and I certainly don’t remember the last time I used thermal paste on a CPU. Or maybe it’s because there are no cost gains to be had with DIY computers these days.

Not so with PoE!

Below is a little chat about PoE, and at the bottom of the post I’ll go into what I am using in my wall controller project.

Most computer / network techies already know the basics when it comes to PoE, but this post seeks to shed some light on the choices to be made when considering PoE for Home Automation.

Why PoE? (Skip this if you already get it.)

Most wired network devices also need some way of powering them. Wireless Access Points, network cameras, intercom systems, control panels, they all need power – but if you are already taking a network cable to them, why not use that cable to also deliver power to them as well? Here are two benefits: no need to hire an electrician to extend your ring mains to awkward places, no ugly extra cables on wall-mounted devices to compound the felony.

Certainly in the case of my uber wall control panels, they are being sited inside wall boxes at various points in the house that don’t require power. To bring power to each panel would be a lot of extra cables in walls, and the installation cost would increase hugely. There’s spare capacity in a CAT6 or CAT7 cable, why not use it?

Active vs. Passive PoE

“Passive PoE” is a bit of a misnomer, but that aside – here’s a comparison.

Active PoE is industry standard in business, and involves sending 48V down a network cable to the device. The power usually* comes from the network switch itself, and the device has some special electronics that talks to the switch on the other end of the wire and negotiates power using a series of signals (resistance detections and presentations of loads). It’s pretty complex, and in fact PoE isn’t really one standard at all. (“The thing I like about standards is that there are so many to choose from…”)

The other thing the device must do is step-down the voltage to whatever it requires.

* Many people use mid-span injectors, that’s where the switch doesn’t supply power but you can inject power using a separate device. This gets messy if you have very many devices requiring power, but as a general rule fine for the odd one or two.

Passive PoE is a system that simply splits your ethernet cable at both ends, allowing you to place your own power supply at one end, and then connect your device power to the splitter the other end. No power negotiation – no voltage step-down.

There are shoddy implementations of passive PoE, and there are lovely ones.

A common example is where, instead of hooking up a power supply directly to where your security camera is installed, you can install a splitter at both ends. On the camera end, your splitter has a little power plug that connects to your camera (sinking power), and on the other end your splitter has a socket that connects to the power supply (sourcing power).

Active PoE – pros and cons for home use


  • Higher 48V transmission over cable means lower voltage drop-off = decreased power loss (saving money on bills).
    • NB Passive PoE allows you to supply whatever voltage you like, but more often than not it’s used with existing 12V or 9V device power supplies
  • Power negotiation is great because it means that a device is only allocated the power it requires; where there are more than a few PoE devices, this quickly becomes a sensible idea for all aspects of a system (cooling, conserving energy, etc.)


  • PoE switches are usually expensive (£350+)
  • PoE switches are usually very noisy (bad for the home environment). You can find cheap fanless switches such as the Cisco 2960C-12PC-L or D-Link DGS-1008P/B, but most smaller switches tend to have PoE capability only on half the number of ports (e.g. 8 port switch has PoE on 4 ports).
  • PoE requires your Arduino project OR your network device must support it. Network devices supporting PoE are usually far more expensive.

Re the last point, it’s possible to include some electronics that will supply your Arduino project with PoE but they cost £16 on top of the network shield:

From Sparkfun: a network shield with PoE module (the black board that sits vertical on the shield)

From Sparkfun: a network shield with PoE module (the black board that sits vertical on the shield)

£160 for 10 units, not including the network shield!

Or you could get an Arduino with built-in network and PoE, such as the excellent EtherMega. These are wonderful, but this is even more expensive.

Finally you could get your own chip and include this in a project but it’s still about £6 per unit, see Silvertel Ag9800 themal protected 12vDC module.

Passive PoE – pros and cons


  • Reduced complexity for your project. No inherent need for power negotiation electronics, or step-down converters (unless you want to)
  • Far cheaper. PoE passive injectors cost £20 for 8 ports. You supply your own power supply. Of course, no extra electronics at the device end, so it will support most things that come with their own power supply. Your Arduino project may need no special electronics, depending on how you implement it. In my case I added step-down voltage at the other end, read on for more info.


  • Most devices want to run at 9, 12, 15, 18v DC. At these lower voltages, the power loss over cables is significantly higher. This requires thought about two things:
    • Electricity bills – are you wasting money?
    • Power tolerances – will your device work reliably if running from a slightly lower voltage?
  • An extra hub in your comms cabinet = double the number of patch cables = more mess

Which is best?

So which is better for Home Automation? Looking at the Passive PoE cons, I can live with the extra mess, but really how much power is lost over a CAT6 cable?

Joule’s Law

If we can minimise power loss, perhaps we can justify the cheaper option as our cable runs in the home won’t be so long. Let’s take a closer look.

According to Joule’s Law, if we keep the voltage high then DC electrical transmission power line loss will be low. So the first thing we want to do with passive PoE is get the voltage as high as we can (within reason – we are talking low voltage systems here!)

On the other hand, the higher the voltage on your Arduino, the less efficient the conversion down to 5V will be, this is because your Arduino has a linear voltage regulator which is not wonderfully efficient. Also the harder you drive that voltage reg, the hotter it gets. And don’t forget the acceptable voltage input range that your particular Arduino can handle – check the data sheet!

As you can see it’s a trade-off. The best option is to use a non-linear voltage regulator, aka a switch-mode power supply or buck converter. Obviously this is places at the same end of the CAT5/6/7 as your Arduino, so you can benefit from lower power loss over the cable.

Pros of using a separate buck converter to power your arduino over ethernet:

  • Doesn’t get as hot = safer for home installations
  • Doesn’t waste as much power in the conversion down to 5V. Buck converters are typically 95% efficient. Linear regs’ efficiencies depend on a number of factors such as how hard you drive them, but they are generally 50-70% efficient. (I’ve pulled these numbers from the air!)
  • Means you can put a far higher voltage down the line, e.g. some small buck converters can take 30V down to 5V without getting too hot. This in turn means less wasted power because of Joule’s Law.

Cons of using a separate buck converter

  • Introduces another component that takes up space on your circuit board or project board
  • Can introduce EMI (electric noise) to your circuit, which means you need to be careful about how you design your circuit, and how you lay out your circuit board.

For an excellent introduction to buck converters, check out the videos of Julian Ilett or Afrotechmods on Youtube.

For the sake of answering my own question above, “how much power is lost over a CAT6 cable”, I measured 12V down a 20m cable sinking 400mA at the end of it, and the power had dropped 0.9V. This is fine, but it will vary for cable runs, so let’s run at a higher voltage and not use the Arduino’s in-built linear regulator.

In the end I found this lovely little device on eBay. You can pick them up for £8.30 for 5 = £1.66 each including shipping. Search for “Ultra Mini DC Buck Converter”.

Cheap as chips. (Actually cheaper.) Ultra mini buck converter.

Cheap as chips. (Actually cheaper.) Ultra mini buck converter.

Strangely the auction says “12V to 5V Power Supply 7-22V to 5V”. I think that means you can get them in various flavours outputting anything from 12V to 5V. Lower down on the auction it says “Output Voltage: DC 5V”, so that’s okay. I tested them before I hooked them up and the voltage was a very reliable 5V… although I didn’t test with different current draws, only about 550mA.

Incidentally if anyone with an oscilloscope has used these before, let me know how clean the output is.

They also come in 1A and 2A flavours, I plumped for the 2A versions of course. I’m sceptical about driving 2A from it and I don’t plan to do that ever!

This “Fulree” branded cheap buck converter seems like the same thing as one you can get from Sparkfun:

Sparkfun Buck Converter - tiny

Sparkfun Buck Converter – tiny

I’ve no doubt the “Traco Power” branded one, also available from Farnell, is superior in quality, shielding, and design. But it’s £5 and I’m a complete cheapskate. (i.e. I’m making 20 of these things and every little saving will reduce my total project cost from thousands to hundreds.)

You could also buy another type of buck converter, even cheaper but not as compact. It exposes the whole circuit on a board of its own and is based on the LM2596 switching regulator. If you do, make sure to watch Julian Ilett’s warning video on not getting a dodgy version:

The other alternative is to include your own buck converter circuit in your project using components from scratch, but there are some design challenges you must be aware of and the components stack up to be more like £3-4 – not worth it. See this beautiful Youtube vid from Afrotechmods for more info.

What cable to use with DIY PoE?

We don’t normally bother about cable gauge when it comes to CAT6, as performance is more about minimising cross talk, shielding, and data transmission speed – not wire thickness. Well, of course the latter does affect the former, but either way for the pursuit of low cost PoE, we must consider this.

Do get good quality CAT5/6/7 cable – preferably CAT6 minimum for PoE. I measured a single strand of my CAT6 cable. The cable measured 0.6mm diameter on my Vernier scale, which is approximately equal to 23AWG. I’m using LSZH (low smoke zero halogen, aka LS0H) infrastructure cable, that is, rigid non-stranded cable that can bend a few times but is not designed for regular movement. Good for home installation if a little rigid. It cost £100 for 305m reel from a local electrical reseller.

My wall controller project

After a whole load of price checking and electronics research, I decided on this solution for powering my Arduino over ethernet:

  • Standard network switch
  • Cheap 8 port PoE injector (£20 each)
  • Re-use old Dell power supply (free if you have them already)
    • 19.5V = perfect for longer runs
    • High power (90W or 60W), high quality
      • 90W split 8-ways is 11.25W per port
      • Almost certainly enough for your project, unless you are powering motors or lights
      • P = VI. My project uses max. 450mA at 5V, so that’s 2.25W.
      • 2.5W. Don’t forget to do a back-of-fag-packet calculation for power loss and include a lot of headroom. Include line loss, and assume 5-10% loss in the buck converter
    • Chop connector off and replace with 2.1mm connector
  • Fulree buck converter at Arduino end. Connect both browns to GND and both blues to IN (check wiring standards and verify this yourself!)
  • Split ethernet cable at Arduino end and use PCB block connectors. I may develop this to route power through the W5100 board in the future, but right now this works for me.
  • Connect output of buck converter to Arduino’s 5V connector.

I do have a PoE switch at home, but given the amazing cost benefits of the above option, and the fact it makes a big noise, I’m not going to use it for my project.


Jan 15

The spec for the ultimate home control panel

A number of months ago I became obsessed with the idea of controlling my room lighting using knobs in the wall. Crazy, I know 😉

Seriously though, most lighting automation systems do not use rotary controllers (i.e. knobs), but rather you have to keep your finger on a button until the desired light level is reached. Isn’t that so 1990s? Knobs are the way forward. Worse still, many only let you select “scenes” without even controlling individual light level. So I set about making my own digitally controlled lightswitch. The process has been one of research and learning new skills. Soon enough I stumbled upon the ultimate way for things within the home to communicate with other things: MQTT.

Here are my design goals for the ultimate home control panel for each room.


Use physical buttons and lights NOT touchscreen. I find touchscreens great for web browsing but when I want to control lights and volume I need an accuracy and responsiveness that can only come from;

  • tactile switches with visual feedback
  • rotary controller knobs
  • display screen showing levels as percentage (i.e. numbers) for fine adjustment

Look sexy. DIY metal faceplates with push buttons conjure-up images of 1970s style control panels. Disabled toilets. Hobby aeroplane remotes. I’m going with brushed stainless steel faceplates with no visible screws, smaller LED-integrated tactile buttons, matching brushed steel knob.

Use numbers on the display. In the increased sexification of home automation, things have become too touchy-feely. Having controlled lights and music from my iPad, I get annoyed if you press in slightly the wrong place, or need to make that super-fine adjustment. Also I get annoyed by the ubiquitous slider and the lack of information it provides the user.


  • The faceplate must run at low voltage, requiring no special electrical certification
  • Connected with ethernet (CAT5, 6, or 7)
  • Powered over the same ethernet cable
  • Fit within a back-box readily available in shops: 47mm depth max


  • Use “Scene” buttons to quickly select the lighting mood in a room
  • Dim individual lights in a room to create your own scene
  • Quickly cycle between different lights in a room
  • Control music volume and see what’s playing (track title and artist)
  • Similar to light scenes, there should be audio “favourites” (i.e. radio channels, playlists, shuffle mode for a given genre, etc.)


  • The unit is designed for a range of functions, but can be expanded later to incorporate more. e.g. lighting and audio modes have their special uses and displays. As it’s based on Arduino, the sketch can be updated by USB later.
  • “Thing” settings (i.e. how many lights in a room, the name of a light in the room, the name of a scene for a given room) should be queried from a server and downloaded to volatile memory at startup. These things are not stored in the unit.
  • We should be able to press an “update” button to pick-up the latest settings. Home automation installers and users change their minds all the time!


  • “WAF” is an offensive phrase used in #homeautomation talk. It stands for “wife adoption factor”. Maybe “GAF” – grandparent adoption factor? No – that’s swapping one prejudice for another. “HAF” will do nicely – human adoption factor. The controller must be the perfect balance between powerful and usable. I don’t mean “powerful for the geek, usable for the granny”. I mean “equally powerful and usable for both”.
  • This means: consistency of display and immediate access to primary functions. No menus, no prompts! Placement of buttons should be intuitive.
  • All light should cease when it hasn’t been touched for a while. No lights in the middle of the night!

The solution I’ve settled for is a “mode cycle” one. Like old digital watches. The mode button is set apart from other buttons and placed near the icon displaying the current mode. All other physical controls depend on the mode in question, and their function is intuitive given the placement.

Consistency comes from the unit defaulting back to a “primary” mode after x seconds of not being touched. The display dims appropriately.

Here’s a brief demo of the progress so far – January 2015:

Aug 14

Arduino and code efficiency

The thing I love about programming for Arduino is that, unlike programming in most other environments nowadays, you are forced to think about memory footprint, memory allocation, and how your code relates to the hardware.

That’s great for people like me who don’t really consider themselves coders at all, because “perfect code” is less about something that’s mathematically beautiful and conceptually elegant, and more about getting the job done. In fact the code is often more efficient if you spell it out line-by-line in a bunch of nested if statements, rather than abstracting it into a pre-written processing function that may do the job in fewer lines of code but end up costing more in storage space because the function itself is general purpose.

Take for example this code. Horrendous to mathematicians I’m sure, but lovely for electronics engineer types;

void callback(char* topic, byte* payload, unsigned int length) {

Serial.println("Volume Callback");

if (length == 1) { output = payload[0] - 48; Serial.println(output); }
else if (length == 2) { output = ((payload[0] - 48) * 10 + (payload[1] - 48)); Serial.println(output); }
else if (length ==3) { output = 100; Serial.println(output); }


In the above you can see I have a byte array, each location in the array is an ASCII representation of a digit that forms a number. I know that number coming in from the payload will only ever be between 0 and 100, AND have considered in what situations that might not be the case and what would happen. So it will have a maximum of 3 digits. Indeed if it does have 3 digits the number must definitely be exactly 100. And so rather than using expensive string to integer manipulation functions which add 2k (yes, 2k!) to my sketch it is cheaper to write it out in if statements that calculate it in a “units – tens – hundreds” way working on the basis that the characters 0 to 9 are represented in the ASCII table consecutively.

So oftentimes it’s more computationally efficient to write more lines of code than fewer, which is great for idiots like me who tend towards wanting to put everything in terms of flow charts and IF statements!

There are so many examples of the above I’ve discovered so far, e.g. using a switch statement, whilst looking a little clearer on the page, is worse than using IF statements unless you have over at least 4 cases. The exact detail depends on your sketch and how variables are stored of course.

Arduino helps us by showing us how many bytes your sketch is at compile time. Great for keeping an eye on things as you progress your project.