Home Automation DIY: Build a Smart Home Hub/Controller Using a Raspberry Pi & Home Assistant

Building your own smart home hub can be a fun and challenging task. With a custom hub, compatibility concerns are pretty much a thing of the past. Not only that, but by building your own home automation controller, you can get levels of customization that you can’t find anywhere else. In this article, we will start by talking about what a smart device is and why you might want a smart hub. Then we’re going to cover building our own smart home hub from scratch using a Raspberry Pi.

What is a Smart Device?

Home automation is everywhere these days. Walk into any hardware store and you will see smart versions of products you use every day. There are smart door locks, smart thermostats, voice assistants, smart lightbulbs, and even smart smoke detectors. Start digging deeper, and it won’t be long before you notice all these so-called “smart” devices, aren’t that smart on their own. It’s cool to turn your lights on/off from your smartphone, but is all that all it takes to be a smart device? That seems more like a remote control than anything else.

What makes devices “smart” is the ability to interact with other devices. We don’t just want to turn a light off/on, we want that light to change itself based on something else. That sounds more like a smart device, right? That’s where home automation comes into play.

Why Use Home Automation?

By automating these tasks, we can make our life easier and more convenient. For instance, if a water leak is detected in your home, the water valve can be closed, and you can be notified through text. In some examples, we can even save money. By setting up your own automation routine, you can adjust the temperature of your home based on the outside weather, or your location. What about a motion sensor under your bed that can detect when you get up in the middle of the night? That can trigger a soft LED strip and put an end to those painful stubbed toes. With home automation and a little bit of imagination, the possibilities are endless.

What is a Home Controller or Home Hub?

The secret to getting all this to work together is a controller. A controller is the brain of your smart home. It reads all the information from all your sensors and devices, decides what to do with it, and sends those commands out to the proper smart devices. This is what allows all of your smart devices to integrate with each other. If you want your smart devices to act smart, and not just like a remote control, you’re going to want to get a controller for your home.

Examples of Home Hubs

Plenty of home hubs currently exist on the market. Some of the more popular ready-made options include the Samsung SmartThings and the Wink Hub 2. Both of these devices have the ability to communicate over multiple protocols and are compatible with a range of devices including Google Home, Apple HomePod and Amazon Alexa. In fact, those last three devices can function as smart home hubs as well. So, with all these options, why start from scratch?

Why go through the trouble of building your own hub?

Creating your own smart home hub can be a fun and challenging activity for those that like to tinker, but that’s not the only reason it is taking over the home automation world by storm. All of the products listed above are proprietary. This means that your level of customization is going to be limited to what the vendor allows you to do. There’s nothing stopping a company from dropping support for a device or product once it releases a competing product. If your hub decides they don’t feel like being compatible with another one of your devices, there’s not much you can do about it.

By building your own hub, you are in complete control. There are many examples of free software that allows you to manage all of your devices in one location. No more flipping through a bunch of apps just to turn off a few lightbulbs. Programs like Home Assistant and OpenHAB give you complete control. Though of a cool feature that isn’t available? You now have the option to create it. Many enthusiasts also share their projects and code online. Since it is open-source, you’re just a quick copy and paste away from having your own version.

In addition to that, Home Assistant is entirely local unlike other solutions such as Samsung’s SmartThings. If your internet goes down or Samsung is having an issue with their servers, all your devices and automations will run just the same. There’s no delay, no outages, and your devices just work and work instantly.

Getting Started

Now that we have hopefully sold you on creating your own smart hub it’s time to get to work. We will be using the CanaKit Starter Kit as it comes with everything we will need and more. However, you may have all of the parts you’ll need laying around. Take a quick look at the material list to make sure and once you’re ready, let’s start building!

Material List

  • Raspberry Pi
  • Power Supply
  • Micro SD Card
  • A Way to read Micro SD on your PC  
  • Raspberry Pi Case (Option)

Assembling the Raspberry Pi

We are going to start by assembling our Raspberry Pi. We chose to go with 4GB of ram. Once we start connecting a lot of devices, we’re going to need that extra bit of ram to avoid any performance issues. If you’re using the CanaKit follow along below. We will be walking you through step by step. If you’re not using the kit, feel free to skip around to the parts you need.

Placing the Heat Sinks

Raspberry Pi with heat shield placement shown
Raspberry Pi with three heat shields placed

If your pi has heat sinks its best to start with those. You should have three heatsinks in all. The large one will be going on your CPU, the middle one on the DDR4 memory and the small one will be placed on your Ethernet and USB Controller. Simply peel the adhesive off the underside of the heat sinks and place them on the proper component. Be sure to keep all the fins aligned if your slightly OCD like us.

Putting the Pi in the Case

3 Sections of Raspberry Pi case broken down into individual components
Raspberry Pi case with the lid removed.

With the heat sinks in place, we are going to be setting the Pi into the case. The case will break down into three separate parts; a lid, a middle section, and a floor. With the pieces separated, place the Raspberry Pi on the floor section. Now put the middle section on top, followed by the lid. That’s all there is to it!

Setting up the Cooling Fan

Pin locations for Raspberry Pi cooling fan
Cooling fan inserted on upper lid of Raspberry Pi case

Now we are going to install the cooling fan. If your Pi came with a fan we suggest you install it now. Your fan should have two wires coming from it, a red one and a black one. Using the GPIO header reference below, the black wire needs to plug into the GND terminal. This should be the third pin from the right. To run your fan at full power, connect the red wire to the pin to the left of the ground. If you wish to fun your fan at a lower setting, go ahead and plug it in the 3.3V pin. This should be the first pin on the bottom row. Plug your Raspberry Pi into power and verify the fan comes on. Feel for which direction the fan is blowing and orient it to the air is blown from inside the case to the outside. Once you know which way your fan will be facing, firmly press it into the lid of the case. You should feel it latch into place.

Setting Up Home Assistant

Now that we have the Raspberry Pi assembled, we need to get Home Assistant on the SD card. Home Assistant now has its own operating system made specifically for Pi, HassOS. We will be installing Hass.io which will be powered by HassOS. This operating system will run on the Raspberry Pi turning it into the ultimate home automation hub.

Installing Hass.io on the SD Card

To get started we need to download the Hass.io files. You can find the needed files here.

There isn’t a lot of support for the 64-bit version yet and the 32-bit version is recommended so we’re going to go with that. You can use whichever version you prefer though. You will also want to grab the belenaEtcher application. We will be using this application to put the files on the SD card in a bootable format.

Now that you have those files downloaded, go ahead and insert the SD card into your computer. If you don’t already have an adapter, we recommend the Anker. This card reader has both SD and micro SD slots and is super convenient for stuff like this.

Now Next we need to open up Etcher. Click on “Select Image” and choose the file we just .gz file we downloaded from home assistant. Double-check that Etcher is pointed to your SD card, it usually is pretty good at that, and click “Flash!”. There you go, we’re almost done.

Configure WiFi for Raspberry Pi

Assuming you’re going to be connecting your Raspberry Pi to Wifi, we’ve got one more thing to do. In windows explorer, go to your SD card. If you don’t see your SD card listed as an available drive, you may need to unplug it from your PC and reinsert it. From here create a new folder and name it “config”. Inside the new config folder, create another new folder called “network”. Now, inside of the network folder, create a .txt file and name it “my-network”. Copy the text below and paste it into that new text file.


# Uncomment below if your SSID is not broadcasted




Be sure to change the SSID field to your network name and enter your password under psk. Now we can save and close that file.

We now need to remove the .txt extension from the text file. If you cannot see the extension, go to the view tab at the top of your window and click the checkbox saying, “File name extensions”. That will show the file extensions and now you can delete the .txt off the file. The complete filename should now be “my-network”.

With that finished, we can eject the SD card from our PC and plug it into the Raspberry Pi.

Booting Up Home Assistant

Hassio preperation screen.

Once the SD card is plugged into the Pi all that’s left to do is to turn it on. Then we wait. It will take around five minutes or so for your Raspberry Pi to connect to the network and download all the updates for home-assistant. After five minutes or so, go to your PC and open a web browser. In the address bar go to “hassio.local:8123”.

If you are on the same network as your Pi, it should pull up the following screen. Be sure to include the “8123” from above. This is the port number that hassio uses to communicate. If you leave it off, you won’t be able to see your new hub.

If you can’t get this to work and you are certain you are on the same network as the Pi, your router may not support mDNS, then we will have to find the Pi by its IP address.

Finding Raspberry Pi by IP Address

You can find the IP address of your Raspberry Pi from the admin settings of your router, or you can download this great app I was recently recommended. There’s an app called Fing in the app store and the google play store. Download this app and be sure your phone is connected to the same network. You should see a bunch of devices pull up, one of them being “hassio”. Copy this IP address into your address bar being sure to include the 8123 port.

Screenshot of Fing Ip search results

Your numbers will differ from mine slightly but the 8123 will need to be the same.

Create your Home Assistant Login Credentials

Once you can get your Pi from your browser you will be prompted to create a login for Home-Assistant. Go ahead and create a username and password. That it! You now have your very own smart home hub. There might not be much to it at this point, but you are in complete control.

Conclusion and Where to Go from Here

Home Assistant new installation screen

At this point, everything should be up and running. Your home hub is complete. I know it doesn’t look like much yet, but in our next article, we are going to be covering walking you through getting started with Home Assistant and Hassio where you will learn the basics of configuring home assistant as well as adding devices.

Leave a Comment