Introduction: Jarvis: an Arduino Based Home Automation System

About: Just a tech enthusiast.

I was inspired by Jarvis from the Iron Man and strongly wanted a home automation system. The existing systems were not cheap so I decided to build my own home automation system using an Arduino. At present its functionality is limited to switching the devices on or off but it can process natural language at a very basic level that allows you to use this technique to incorporate natural language processing capabilities into other Arduino projects.

CAUTION: I DID NOTtest this project with real world appliances and if you are planning to do so, do it at your own risk. I strongly advice a professional electrician's help in doing so.

Step 1: Things You Will Need

The project is fairly simple in terms of the things required.

  1. Arduino
  2. Bluetooth Module (Preferably HC-05)
  3. LEDs (For prototyping) x 4
  4. BC-547 transistors x 4
  5. 10k and 150 ohms resistors x 4 each
  6. Relay Board (Optional, only if you are serious about installing Jarvis in your home)
  7. Power supply (I used a powerbank and a 9V battery)
  8. Wires and Breadboard
  9. An Android phone or tablet with an Internet connection

Step 2: Preparing the Hardware

The main problem that I faced while developing this project was processing the input using the Arduino to understand what the user has said. The user, by default, can carry out 2 functions: to switch on or switch off a device. The code by default supports 4 devices but it can be extended. The program basically finds the keywords "on" or "off" and the names of the devices in the sentence and executes that function. You can control up to 2 devices simultaneously( a combination of "on" and "off" or each device). I used this method because it allows you to say anything as long as the sentence contains the keywords. For example you could simply say "Switch on all the lights" or even "OK buddy, do me a favor turn on all the lights" and both these sentences will have the same effect, i.e they will switch on the lights. I used the Arduino function string.indexOf("value") to locate the keywords in the sentence. I have included the circuit diagram for connecting the LEDs. It is not recommended to connect all 4 LEDs directly to the Arduino as its output is not powerful enough to drive all 4 at once. Do check the datasheet of the transistor to know the pin configurations as sometimes they differ from one manufacturer to another. The pins on the Arduino are as follows:

Led 1 (Corresponding to light) = 13

Led 2 (Corresponding to fan) = 12

Led 3 (Corresponding to TV) = 8

Led 4 (Corresponding to charger) = 4

Here light, fan, television, charger are the keywords required to trigger those pins.

EDIT: The circuit has been changed a little as per suggestion.

The code was written in hurry so I did not comment or make the code easier to understand. I will make the code more efficient and neat as soon as I get some time. Any volunteers would be great!

Step 3: The Android Side

Integrating speech recognition into this project was one of my main motives from the beginning and what better way then using the powerful speech to text engine on Android? I used MIT app inventor to build the app. The app is fairly simple. What it does is it takes the speech input, converts it into a string and sends it to the Arduino via Bluetooth.

Step 4: Improving Jarvis

Though the initial setup works good but one has to open the app to give commands and this can be a little boring if you end up using Jarvis pretty often. I modified the initial Jarvis app to start listening as soon as it is opened. Then I used Tasker and Commandr to create a custom voice command to open Jarvis. You can assign the call button on a Bluetooth headset or earphone to open Google now. Now as soon as you say your custom command the app will open and start listening!

Step 5: How to Use Jarvis?

Jarvis is pretty simple to use. It has a pretty basic natural language processing capabilities that at least allows you to modify the sentence a little and thus eliminating the need to remember the perfect command. Jarvis allows you to control upto 2 devices simultaneously with separate on and off control or upto 4 devices with just a single control (i.e either on or off). The default keywords are fan, charger, television (or just TV), light (or lights).

Example Commands:

1.Turn on the fan please.
2. Switch on the charger and turn off the lights.
3. Can you please turn on the tv? I am feeling bored.
4. Turn off everything
The commands can be used in any combination. The only thing to remember is the presence of an on and/or off keyword and the name of the device/s.
Internet of Things Contest 2016

Runner Up in the
Internet of Things Contest 2016

Sensors Contest 2016

Participated in the
Sensors Contest 2016

Robotics Contest 2016

Participated in the
Robotics Contest 2016

Home Hacks Challenge

Participated in the
Home Hacks Challenge