How to build your own smart home hub with a Raspberry Pi

Don't want to rely on the big names? Try this private DIY home controller

How to build a home hub with Raspberry Pi

We've explored several ways to set up a smart home without relying on Amazon, Google, Apple and the other big guns. Sure all-encompassing voice commands are brilliant and convenient, but not everyone is comfortable with the always-listening element of the Google Home and Amazon Echo smart speakers. Likewise, some people don’t want these big data firms gathering even more information on our habits in our most intimate settings.

That's why we think Mozilla’s Things Gateway will appeal to people who want still want a degree of home automation without telling Google every time they turn on the bathroom light to pee.

The experimental Things Gateway enables you to control multiple smart home devices from a simple and secure web portal, which can be accessed at home and remotely.

Read next: How to set up and use Home Assistant

Still in a nebulous stage, it works with the Z-Wave and Zigbee protocols and is compatible with a number of off the shelf smart switches, dimmers and sensors, as well as bulbs from Philips Hue, Ikea and Cree. It also enables you to create If This Then That (IFTTT) style rules, a floor plan and use (limited) voice controls.

How to build your own smart home hub with a Raspberry Pi

Here’s what you’ll need:

• A Raspberry Pi board (preferably a Pi 3 with Wi-Fi built in, but a Wi-Fi dongle should work too)

• A clean microSD card with minimum 4GB storage

• A compatible Zigbee USB dongle and/or a Z-Wave enabled USB stick to communicate with devices on that protocol

• Some compatible smart home devices to add. Here’s the list of tested devices.


Getting Started

The first thing you need to do is download Things Gateway software onto your Mac or PC. It can be downloaded from Mozilla here. Next you’ll need to find the file in your downloads and unzip the package (this may happen automatically). The unpacked file will be called “gateway-0.3.0.img”.

From here you’ll need to flash the software to your clean SD card. There are many pieces of Mac and PC software that can do this, but I’d recommend Etcher.

How to build your own smart home hub with a Raspberry Pi

Once you’ve installed Etcher, insert the microSD card into your computer (note: the way I achieved this on my 12-inch Apple MacBook is pretty comical, pictured above but you can also get USB-C card readers). All you need to do in Etcher is select the image from your hard drive, select the drive and hit Flash. It’ll take a few minutes, but after that you’ll be good to go.


Setting up the Raspberry Pi

Now it’s almost time to fire up the Raspberry Pi. Before powering it on, you need to insert the SD card loaded with the Things Gateway software. You’ll also need to insert the Zigbee and/or Z-Wave USB dongles. We used the Digi XStick (ZB mesh version).

How to build your own smart home hub with a Raspberry Pi

If your Pi doesn’t have Wi-Fi built-in, you can insert a USB Wi-Fi adapter. Because this will be operated as a ‘headless’ machine you don’t need to worry about attaching a monitor, keyboard or any other accessories to the Pi.

Now you can fire up the Pi.


Connecting to your Gateway

This is where the clever part starts. After a minute or two you should see “Mozilla_IoT_Gateway” show up in your list available Wi-Fi networks. Connect to this network ID on your laptop or smartphone and you’ll get a pop-up window asking you to input the SSID and password for your home network.

How to build your own smart home hub with a Raspberry Pi

The Gateway will then connect to your broadband and the pop up will disappear. You’re asked to enter to ‘gateway.local’ in your browser to complete set up.

Here’s where I ran into problems. No matter how often I tried, the Gateway and my Wi-Fi network wouldn’t play nice. The Gateway recognised it but wouldn’t register a connection. I’ve reached out to the project lead at Mozilla to find out why, but haven’t heard back yet.

How to build your own smart home hub with a Raspberry Pi

So I resorted to good old Ethernet (I had to buy an Ethernet switch to create more ports because the Google Wi-Fi only has one spare and I need that for the Hue bridge, but that’s my problem) and hard-wired the Pi into my network old school. At this point I was able to type gateway.local into my browser and complete set up.

Here you create your own unique web domain for your Gateway, which is crucial if you want to control it remotely. You’ll also create a username and password to safeguard this secure tunnel.


Adding Things

It wouldn’t be much of a Things Gateway without Things now, would it?

Once set up is complete you’ll be taken straight to the Things Gateway home screen. You’ll see a '+' in the bottom right corner and the Gateway will scan for available devices, so make sure they’re plugged in.

How to build your own smart home hub with a Raspberry Pi


I tested this with a Sylvania Smart Plug compatible with the Zigbee IoT standard, which was quickly recognised by the Digi XStick USB stick. You can give it a custom name and then save it. The switch now appears on the Things homepage and can be turned on/off with a tap/click exactly as advertised.

I was also able to add my Philips Hue lighting set-up to the Gateway, although this required the installation of a special add-on. I hit Menu > Add-Ons > the + sign > Philips Hue to install it.

How to build your own smart home hub with a Raspberry Pi

Functionality is more limited here. You’ll see each bulb listed individually and can turn them on and off. You can also tap the “Things” icon next to a bulb to alter the colour on a pop-up colour spectrum wheel.

How to build your own smart home hub with a Raspberry Pi

Unfortunately, you can’t access the Hue dimming controls or any of the custom scenes, so functionality is currently pretty basic. If you want to dim lights you’ll need a dedicated, compatible smart dimmer switch or another compatible brand’s dimmable bulbs.


Things Gateway – Extra functionality

The Things Gateway is more than just an on-off switch for a growing number of smart home products.

The Rules menu allows you to add IFTTT style rules that link multiple devices to a single command.

How to build your own smart home hub with a Raspberry Pi

For example, you can link the smart switch controlling your TV to the living room lamp and switch both off at the same time. You can turn on the bedroom lamp and switch on the coffee pot connected to the smart switch.

You can even upload your own floor plan of your home and position your devices accordingly. This offers another way to control devices on a room-to-room basis.

How to build your own smart home hub with a Raspberry Pi

The final experimental feature in this version (0.3) is voice commands, which must be enabled in Settings. After doing so you’ll see a microphone in the top left corner.

I had no joy with this perhaps because I hadn’t taken time to give the Things simple names like “Kitchen” rather than “Hue color lamp 4”. Hindsight is a wonderful thing.

The voice controls have to be manually enabled by hitting the mic icon rather than a wake word, which might be preferable to the Echo’s always-listening approach if privacy is your main goal here. We’ve reached out to Mozilla to see if and where this voice data will be stored.

Adds-Ons are also interesting. Here you can open up support for the Pi’s GPIO ports (general purpose in/out) too, which raises some interesting possibilities in the future.


Is the Things Gateway worth it?

How to build your own smart home hub with a Raspberry Pi

I’d describe Mozilla’s Things Gateway as a fun way to spend a couple of hours tinkering with the Raspberry Pi and a good way to control simple smart home devices from a single interface, both at home and remotely. If you’re adverse to giving all your data to Amazon, Google and co. then this might be worth a try. I’d certainly like to try it when there's a wider range of compatible devices.

There’s definitely potential for it to grow into more over time, as more devices and more expansive functionality are added. However, in no way is the Things Gateway a like-for-like substitute for a fully functioning smart home hub with all of the bells and whistles.

TAGGED   smart home

What do you think?

Reply to
Your comment