Building a Voice Controlled Home Automation Model — Part 1 — Overview

Timi Ajiboye
chunks of code*
Published in
4 min readOct 3, 2016

I’ve always wanted to build Jarvis.

Sometime last year, I was looking for something to build for a school project when I found this tutorial on how to build an Arduino controlled home automation model.

The writer of that tutorial, wrote another one, that explains more of the creation process here. (Thank you Ian Jennings).

Anyway, I decided to build something that does pretty much exactly the same thing but with an added feature; Voice Control (over the internet) — and build it, I did.

Video on Twitter

This post (Part 1) shall serve as a sort of high level overview of the project, elucidate all the moving parts; why they’re here and how they work.

Prerequisite Knowledge

In the world of IoT & Electronics, this is a beginner level project. But without the right background knowledge, the only outcome is being entirely lost. Here is the (non-exhaustive) list of things you might wanna read up on before diving in.

Things you need to have

The following is a list of apparatus and components that are required for the circuit prototype project in various quantities, dimensions and configuration. They’ll link to places you can get them where possible:

I bought way more stuff than I needed because getting stuff to Nigeria from stores like Amazon and FRYS.com takes so long and can be (more) expensive if you have to do it multiple times instead of in one go.

High Level Architecture

Below is an abstract sketch of the whole setup. Pardon my atrocious hand-writing.

Let’s take a quick look at each of the “modules”.

1. House Circuitry

This is pretty much the brain of the entire operation. The LEDs, servo motors and Arduino shall all be connected together in this circuit. The Arduino Yún has an in-built Wifi support, so it’s relatively easy to connect it to the internet.

The Arduino will be programmed to listen on a particular (Pubnub) channel for instructions and to turn on/off whatever LED when necessary.

House circuit diagram

The above diagram is exactly how all these components should be connected together with the exception of the 9V battery — I simply plugged my Arduino in using a regular USB cable.

2. PubNub

“PubNub is a secure global Data Stream Network (DSN) and easy to use API that enables developers to build, scale, and manage realtime functionality for their applications and IoT devices.”

What that means is that PubNub is a service that lets you send realtime messages over the internet between clients with relative ease. PubNub uses the pubsub pattern; a client can publish to a channel, while others can subscribe to that channel to receive messages.

This means that we can make the Arduino in our home subscribe to our channel and then send messages to it, using our android application.

3. Android Application

We’re going to build an Android Application with one view that takes in the user’s speech, translates it into meaningful Intents and Entities (using Wit.ai’s Speech To Text & NLU).

The application will take these Intents & Entities and use them to construct a message that will be published to the PubNub channel for the Arduino to pick up.

4. Wit.ai

Wit.ai is a FREE speech-to-text, Natural Language Processing API. Basically, you send Wit your user’s text or speech input and they can convert it to meaning for you; Intents & Entities. I’m doing another series that is heavily focused on Wit’s API and building chatbots. You can check that out here.

We’ll use Wit’s API to translate our user’s voice commands into useful information and then use that to send instructions to our PubNub channel.

What’s next

  • In the next article in this series, we would be taking a closer look at the model’s circuitry and it’s components. We’ll build this on the breadboard and write a bit of code to see that our Arduino can turn stuff on and off.
  • In the third article, we shall write more code for the Arduino to make it listen for instructions and perform the right actions, like opening the doors and turning on the lights.
  • In the fourth article, we’ll build the Android application with Wit and Pubnub’s APIs.

--

--

chunks of code*
chunks of code*

Published in chunks of code*

Articles chronicling stuff I do with code which may serve as tutorials (if anybody finds them useful)

Timi Ajiboye
Timi Ajiboye

Written by Timi Ajiboye

I make stuff, mostly things that work on computers. Building Gandalf.