DIY Home Automation for less than $75: Introduction

by Frank on

print
The promise of the automated home is nothing new. In the last decade, promise has come closer to reality with the introduction of  of home automation hubs and smart devices. But then and to a large extent today, if you bought into home automation then you were locked into buying product from the one vendor and if you were lucky their business partners. Let’s be honest none of them were cheap and all were complex and hard to get up and running.

In the recent past, if you have the DIY mentality, like I do, you soon found an electronics engineering degree was needed to get anything to work just a little bit. That was just the state of the home automation world.

Fast forward to the present. We are now in the middle of the Maker Movement and the early days of IoT (Internet of Things). Combined they make it the prefect time to get into DIY home automation. Here are a couple of reasons:

  1. Every company out there is rushing to make IoT products and get them to market. In their rush, they have left openings for the hardware and associated software to be hacked and used in other ways.
  2. Makers like to show off their hacks. There is all kinds of how-to blogs and videos on YouTube. In all honestly, there is too much information. Most of it, not all, shows only a small part of the puzzle, those gee, golly, whiz, that was cool, kind of things.

So for a Wannabe Maker, this is the perfect time to dive in, right? So the previous statement should have had sarcasm quotes around it.. Don’t get the wrong idea! It is the perfect time if you are willing to waste hundreds of hours going down a path and finding out there was a fork you should have took in the path at mile maker 3. Now you are standing at mile marker 20 and wondering can I backtrack or did a bridge on the path back wash out and now I am stuck? Is there even a way forward.

So this is where I come in….

Making mistakes, so you don’t have to… So if you decide to follow along on my journey, I will try to show you a clear step-by-step method to begin building a DIY home automation system and do it in a way you gain the knowledge and ability to strike out on your own.

DIY Home Automation goals:

  • A concrete useful example. Turn on a couple of lights and be able to do it at from your phone, wife’s phone, tablet in other room, and eventually maybe when you are away on vacation. Also have an event trigger the lights. For example, when you come home turn on a lamp.
  • Make it expandable and have the ability to incorporate products from multiple manufactures.
  • All communication between components will stay within the home. Many IoT devices need to call home for them to work properly. Maybe I am a little paranoid, but I really don’t like giving a server in China access to my home network.
  • Keep it as inexpensive as possible to start. Cheap in fact. $50-$60 if you have to buy all the items to start. Did you notice I said “to start”. There are some really nice gadgets out there. When you start adding them in, it begins to get pricey. But as long as we keep the second goal in mind..

 

The key components of the system we will created are cheap SonOff smart switches flashed with custom firmware and a Linux server running on a Pine 64, Raspberry PI or some other inexpensive device. On the server we will be running OpenHAB 2 and a MQTT Broker to tie it all together.

To get started  you will need to purchase a few items. Below, I have provided a description of why the item,why you need it, and a list of sources where I have purchased my own. You will also need a few tools.

The foundation of my home automation solution is an inexpensive Linux single board computer (SBC) and a product called a SonOff Basic Wifi smart switch.

The hardware:

A single board computer capable of running Linux such as a Raspberry PI or a Pine 64. An old laptop or running Linux will also work, but use lose some of the benefits you get from a single board computer, mainly small size and small power requirements.This will device will be the server and the heart of the home automation system. This guide will not cover installing Linux and getting your server.
I will be using a Pine64 with Ubuntu 16.04 installed. Others will also work, but there will be some differences along the way, primarily with commands needed to install and setup software on the server.

SonOff Wifi Smart Switch – The Sonoff  switch will be doing the work by controlling the power for whatever it is attached. Get at least one, but get two if you can. These are really cheap. If you are willing to wait, you can buy these for less than $7 each (free shipping) from Banggood.com. You can also order from the manufacture, but they will charge for shipping (ITEAD.CC). This is going to be doing the work by turning the power on/off to our light, or whatever you may attach to it. They work OK using the companies cloud service, but they can be very easily modified and flashed with custom firmware. ITead actually supports the maker community and intentionally make these smart switches so they can be modified and hacked. Source and links will be listed in the BOM at the bottom of the post.

FTDI USB To TTL Serial Converter – These are handy little devices. You will use one of these to change the firmware on the SonOff smart switch. Make sure it supports 3.3v. Most can do either 3.3/5v by changing a jumper. These are really inexpensive. I keep a 3-4 in my electronic tool kit.

Jumper wires – get selection of female-female, male-female, and male-male wires. If you have ever worked with an Arduino these should be very familiar.

Dupont Header connector kit (optional) – If you plan on modifying a lot of Sonoff switches, you may want to get these and make a cable so it will be easier to flash the firmware.

2.54mm Single Row Male Pin Header (optional) – If you plan on flashing a Sonoff switch multiple times or just want to make it more likely that a flash works the first time you may want to solder these to the switch to make a header you can plug into easily.

micro switch (optional) – Again if you think you will using a lot of Sonoff, a special connector cable can be made to save a lot of hassle, adding a switch to one of the cables will make things even easier. I will cover this in detail later.

The tools:

Small Phillips screw driver

Soldering iron and solder (optional)

Bill of Materials:

Item Sources Cost
Pine64  Pine A64+ 2GB Board $29.00
or
Raspberrey Pi 3 Amazon $33.53
Banggood $39.99
SonOff Smart Switch Amazon $10.90
Banggood $6.69
Itead $4.85
FTDI USB To TTL Serial Converter Amazon
Banggood

 

 

Written by: Frank