Introduction: Home Automation Using Arduino Part-I

Picture of Home Automation Using Arduino Part-I

It’s not like any other home automation as we seen earlier. It’s controlling devices remotely what’s the difference. It’s because it can control from the world. You can control it using any device that have internet connection i.e. : laptop,android,iOS. As of first part it don’t have any proper security like login page. Login and other features like control device without wiring, fan speed controller, temperature monitor etc .

WHAT CAN HOME AUTOMATION DO? Make cooler home Increase home energy efficiency Saves lot of time and effort Makes home more safe Allow to monitor home from anywhere Make you more lazy :P

Features of our project:

1. Control more than 10 devices (depends upon which Arduino You use.Aduino Mega can control more than 30 devices :D B| )

2. Monitor status of our device ie that’s on or not.

3. Control devices from anywhere 4. Its using Arduino so low cost and easy to make.

Things that needed:

  1. Arduino UNO or Mega
  2. Ethernet shield
  3. A domain and host (you can use dot.tk for domain and 2freehosting for hosting both are free or use domain from 2freehosting ☺ )
  4. Internet connection
  5. Relay board (or you can make one )
  6. Testing lamp or led (if you use led don't need Relay board)
  7. Working brain :P

Step 1: Setting Up the Server

Picture of Setting Up the Server

Create Domain name and Host

First of all we wanted a MySql database.for that login to the cpanel and click on MySql database.

switching to cpanel in 2freehosting is ,login to 2freehosting and click cpanel and then switch.it will goto cpanel

then click on MySQL Databases

give your own database name username and password
then go to phpMyadmin.then click on create table

then fill up with these values (table name as temp ,then id,device1,device2,device3) (shown in pic)

then click on save
next goto the sql tab paste this query and click go “ INSERT INTO `temp`(`id`, `device1`, `device2`, `device3`) VALUES ('1','ON','ON','ON') ”

then go back to cpanel.it’s time to upload files
download the files from attachment (server.zip)

and goto File Manager by clicking it

install the language then click on Open File Manager
then upload the server.zip and extract it we need to edit it a little bit. edit “server.php” file .for editing right click the file and goto edit file

in here we are inserting our mysql database details.
their is 3 field you have to fill.

1.$user = "username of MySql eg :u8425xxxxx_xxxxx";

2.$pass = "password of MySql";

3.$database = "u8425xxxxx_xxxxx";

you can find these at MySQL Databases @advanced tab.

fill up these things(needs double quotes ).and save .
check your site is it working properly or not.

Step 2: Setting Up the Arduino

step i: open arduino ide

step ii: install ArduinoJson Library.i have attached ArduinoJson.zip.download and install the Library file.(sketch-->include library → add .zip library -->select ArduinoJson.zip)

step iii:open the provided code with arduino ide step

iv : Find www.testserver.com replace with your hostname.

step v : upload code into the Arduino.

Setting Relay hope you know how to connect relay to arduino if you don’t know refer this for stuuping hardware: https://www.instructables.com/id/Controlling-AC-li...

The output port are 8,7,6 .so put relay input on these pins. if you don’t have relay board don’t worry you can test with led :) if you are using led interchange the HIGH to LOW and LOW to HIGH in the code

NOTE:its is not safe to use AC.so try n your risk.i would priffer using the led :)

Final Step insert the ethernet shield to arduino and connect to modem. If you open the serial port you can see something like “{"device1":"on","device2":"off","device3":"off"}” then its working :)

Open your site and try to change values.

hope it will help you guys.if you have any doubt feel free to ask :)

please inform me if anything goes wrong :D

Declarator : I am not responsible for burning your device :P ;) .do it your own risk.don’t play too much with the AC.

credits : Benoît Blanchon (https://github.com/bblanchon) -- ArduinoJson

Comments

AlexL167 (author)2016-03-12

I followed all you wrote and I receive this message (on webpage):
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean
given in /home/u384xxxxxx/public_html/index.php on line 241

I checked the line 241 and I see that the script searches "select stat from temp where id=1" but "stat" don't exist...
I continued in research and there are a lot of thing missing... I don't understand what You used for "stat"

Actually I removed all the onoffswitch class.... but I am curious.... Can You explain me ?

rootx (author)AlexL1672016-03-14

i am really sorry for delay.i am in a trip so no internet.also sorry for that mistake.it was for next phase accidentely added that.just delete line 240 and 241 or updated files are available for download :) happy hacking

DIY Hacks and How Tos (author)2016-03-06

Awesome project. Thanks for sharing.

About This Instructable

2,795views

42favorites

License:

More by rootx:Home Automation using Arduino Part-I
Add instructable to: