Introduction: Jarvis: an Arduino Based Home Automation System

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.

Comments

author
MaximilianS12 (author)2017-03-23

Hey love this projekt

could you post a commented version of the Arduino Code? i havn't worked with some of the commands yet and i'm trying to understand everything so i can possibly expand the program further.

Also do you think you could send text back to the phone so via text to speech Jarvis could tell you what is happening?

author

I have added some comments to the code. Feel free to make changes and mail me if you want to know something.

author
marsekal (author)2017-02-04

good job

author
Mahendran Varma (author)2017-02-04

How to connect it to our house

author
Zade Nisha (author)2016-12-10

Where is the code of this project? Please provide code.....i want to try my own

author

The Arduino code is attached under Step 2 and the Android app is available under Step 3.

author
uppili pranavane (author)2016-08-21

iam very impressed by this project

iam in a half way of constructing this project

may i know please why the pins 0,1,5V,gnd,gnd are used

author
uppili pranavane (author)2016-08-20

can you provide me the pin connection of the aurduinno module with the bluetooth module and the connections of the leds with the aurduino

author
Aneriah (author)2016-07-24

Hey man great design. I have really wanted to make something like this to use in my make shift robotics lab. If you could answer a couple of my questions that would be great.

1. What are all the things it is capable of? For instance can I hook it up to my phone and any other house hold appliances?

2. How do I actually hook it up to something?

3. Also what is the total cost of this project, including the cost of hooking it up to any of my appliances?

author
C.V.Hariharan (author)Aneriah2016-07-25

This is capable of switching on and off most of the devices. You can attach the devices to a relay module and use this project to control them. The total cost with Arduino and the relay board will be around $29 but could be cheaper if you go for a clone. The relay board will be around $5. You can check out some instructable on using a relay board.

author
Aneriah (author)2016-07-24

Hey man great design. I have really wanted to make something like this to use in my make shift robotics lab. If you could answer a couple of my questions that would be great.

1. What are all the things it is capable of? For instance can I hook it up to my phone and any other house hold appliances?

2. How do I actually hook it up to something?

3. Also what is the total cost of this project, including the cost of hooking it up to any of my appliances?

author
Aneriah (author)2016-07-24

Hey man great design. I have really wanted to make something like this to use in my make shift robotics lab. If you could answer a couple of my questions that would be great.

1. What are all the things it is capable of? For instance can I hook it up to my phone and any other house hold appliances?

2. How do I actually hook it up to something?

3. Also what is the total cost of this project, including the cost of hooking it up to any of my appliances?

author
Jasmeeet Singh (author)2016-06-16

I wanted to make this project for controlling home appliances. I have a 2 channel relay for this purpose and I want to connect a fan and bulb to it. Can you please tell me how can I connect both of devices to the relay??
Thanx

author

Glad to know! It will be difficult for me to explain it in the comment section. You can check this instructable it is great!
https://www.instructables.com/id/Controlling-AC-light-using-Arduino-with-relay-modu

author

thank u for the project. I made it and it works successfully!!
I just wanted to know how can we make the circuit work by just clapping?

author

Glad to know it works! There are many clap switch circuits available online. You might also find some kits but I don't understand how you might integrate that with this project.

author
AhadS1 (author)2016-06-02

Could you please provide a more clear wiring diagram or a schematic diagram? I am trying to follow the instructable and and confused where the wires are going

author
C.V.Hariharan (author)AhadS12016-06-02

Do have problem connecting the Bluetooth module or the LEDs?

author
LucasB85 (author)2016-05-07

hello, thanks a lot for your programs ^^

But I have a problem, the arduino doesn't receive text from bluetooth module (or the module doesn't send the text ?) help please :)

I have tried to switch RX and TX but nothing changed :(

author
C.V.Hariharan (author)LucasB852016-05-07

If you have connected the Arduino to Serial Monitor the bluetooth module will not work. Connect the Arduino only to the Serial monitor or only to the bluetooth module.

author
TJsanzen (author)C.V.Hariharan2016-05-17

How would you recommend doing this so that i could have it in a vintage car and be able to turn the radio on and off, etc.?

author
C.V.Hariharan (author)TJsanzen2016-05-17

First you would have to change the keyword to something related to radio and you may have to wire a relay in place of the switch on the radio and connect it to the corresponding pin on the Arduino.

author
LucasB85 (author)C.V.Hariharan2016-05-08

Well I don't understand why but it work with my arduino uno, I was on a leonardo. Thanks soo muchh!!! :DDD

author
vikasbs2010 (author)2016-05-17

Learnt something new, wonderful work, will try it....

author
lemaxnut (author)2016-05-08

Call me Anal - but when I see wires hanging out all over the place, I just shiver - poor discipline - Sorry!

author
p0laris (author)lemaxnut2016-05-17

I guess you don't prototype much.

author
isaevserge (author)2016-05-06

hello. greate project! would you please give us sources of Anrdroid part of Jarvis? Thank you.

author
C.V.Hariharan (author)isaevserge2016-05-06

I created the app on MIT app inventor. I will attach a snapshot of the blocks.

author
isaevserge (author)C.V.Hariharan2016-05-07

ok. thank you

author
amitmey (author)2016-05-06

Hello
the Arduino do not need the transistor in order to drive the LED it can provide enough current. But if you want the transistor you should move the 10k resistor from tha collector to the base of the transistor.

author
C.V.Hariharan (author)amitmey2016-05-06

When I tried to drive all 4 LEDs at once the LEDs were dim so I added the transistor. Thanks for the correction I will check and change it soon.

author

JARVIS is one of my favorite you are really awesome cool waw what a great tech superb man all the very best for your furure and a little suggestion if u add the source code it would ve helpfulf for the mates who follw us.

author

Thanks a lot! I will attach a snapshot of the blocks. The android app was created on MIT app inventor.

author
Raphango (author)2016-05-06

Nice!! =D

Congrats!

author
chienline (author)2016-05-05

Pretty cool.. Will try this one day ;)