Introduction: Smart Home Automation With Android + Ethernet Internet + Arduino

Home automation becomes more and more popular, affordable and fascinates people. Internet offers such possibilities as never before. Impress your friends showing on Smartphone that you can switch on/off lamp in your apartment miles away and simultaneously see it through a webcam, opening doors. Very cool!

// --------------------------------------------------------

Step 1: Materials

Smart Home Automation with Android + Ethernet Internet + Arduino

01 - Smartphone with Android 2.3+

01 - Wire Ethernet + Router (My Model is TP-Link (TL-WR740N)

01 - Arduino Mega 2560 ou Arduino Uno + Shield W5100 (Ethernet)

01 - Led IR (Optional)

// --------------------------------------------------------

Step 2: App Inventor (application That Control the Arduino Via the Internet)

First you need create an app android, in this case I use an app inventor 2 link: http://ai2.appinventor.mit.edu/

Reference: https://www.youtube.com/watch?v=rwsKzyEpgoE

(Tutorial: AppEthernet - App inventor 2 / Channel: Android e Arduino)

Download .aia to my project, if you need change this application to English, because I created in Portuguese

http://www.mediafire.com/download/pbcepmryegczdpb/SmartHouseApp.aia (Project .aia)

Download App to install in Android:

http://www.mediafire.com/download/v2yk79xk91eaw57/SmartHouseApp.apk

//------------------------------------------------------------------------------------

Step 3: Sketch to Arduino Mega - Code Link Download

Download link in the end code:

You need change:

byte ip[] = { 192, 168, 0, 00 }; // IP the arduino

EthernetServer server(80); // Port acess

Obs:

01 - You need a version IDE 1.0.5 - the code does not work in IDE 1.0.6 because of IRremote library

02 - Every 4 seconds the page automatically updates, if you need change: client.println('<'MET A HTTP-EQUIV='refresh' CONTENT='4; URL=http://seudominio.no-ip.org/'>");

03 - In application "SmartHomeAPP" you need change to a URL=http://seudominio.no-ip.org/'

04 - Change the LED IR code to turn on or turn off your TV or Stereo

Lindo Download Sketch Arduino INO

http://www.mediafire.com/view/v2y3ztk5uhex2ij/APP_ETHERNET_INVENTOR_WAKE.ino

How can you creating a http://seudominio.no-ip.org/

Acess the link: https://www.youtube.com/watch?v=1FWGt5gnnYs or https://www.youtube.com/watch?v=ZPvvoEDjSww

//---------------------------------------------------------------

Step 4: Understanding the Code and Main Features

The methods "Get" send the variable for arduino, you can see in the piece of code:

if (c == '\n') {

if (readString.indexOf("lampada1") > 0) {

digitalWrite(lampada1,!digitalRead(lampada1)); }

//--------- send the page a variable "lampada1"

then the Arduino reads the full page and returns a method "Get" you can see in the piece of code:

//botao lampada1
if(digitalRead(lampada1)){ statusLed = "Ligada"; }

else { statusLed = "Desligada"; } client.println("

Lampada 1 - "+statusLed+"

");

//--------- in this piece you can see "+statusLed+", it returns to the relay this on or off on page

//-------------------------------------------------------------------------

Comments

author
CassioU made it!(author)2017-04-11

excellent project congratulations, here functioning everything perfectly, only has a problem, after a time on circuit it stops/congeals, already I made of everything I changed the source, Internet and nothing, it helps me

author
RubineR made it!(author)2017-03-29

hi,

i need your guide on my project cause im doing bluetooth and arduino to control home applicance...plz respond as sson as possible rubinerx68@gmail.com

author
JimT114 made it!(author)2017-03-05

Nice job AlanV2.

Please someone re upload or send me .aia file because the link not work anymore....

author
ecmperalta made it!(author)2017-03-21

you got the link? someone could help please?

author
JimT114 made it!(author)2017-03-25

OK i got the .aia file. Thanks.

author
Ranjee+OmarA made it!(author)2016-12-21

Sir, can you switch on/off your appliances even if the android application is connected to a different internet connection?

author
samyxyz made it!(author)2016-11-14

hi .am doing a house automation project an your project inspires me a lot .while reading i cannot understand the first part of the connection between smartphone android and the arduino how it works.

as am not a premium user i cannot download your pdf .could you send me it on my personal e-mail : adilensamy@ymail.com.

thx.

author
Aijeleths made it!(author)2016-11-19

Hello there, I too with my team working with the same project. We can't avoid to have confusion with the connection especially with the code if there are some lines of functions that we need to be dealt with according to the address of the router. If you had the pdf my friend, It would be a great help for us to complete the project. Here is my email: shaharaijeleth@gmail.com Hoping for your response, Thank You

author
jjimenez21 made it!(author)2016-11-04

excelen proyect

author
ChanaC made it!(author)2016-10-18

can i be able to control appliances when i am connected to a different network?

author
ShaubhamS made it!(author)2016-10-02

sir kindly provide me codeing shaubhamsaini@gmail.com

author
Mark+AndyS made it!(author)2016-08-09

sir how can i connect the android phone to control the automation?

author
Mark+AndyS made it!(author)2016-08-09

sir how can i connect the android phone to control the automation?

author
Mark+AndyS made it!(author)2016-08-09

sir how can i connect the android phone to control the automation?

author
TarekM2 made it!(author)2016-07-17

G.T

Screenshot - 01_07_2016 , 04_41_08 م.png
author
ChetanK23 made it!(author)2016-02-11

Sir How can i call my ip address from other remote place . for eg. From mobile or from other city. because whenver i am going on my ip address from mobile to access it It couldn't get opened after reloading page also. Please help me sir. Thank u .

author
AlanV2 made it!(author)2016-06-29

Hi ChetanK23.. you need use this site http://www.noip.com/

Watch this video

https://www.youtube.com/watch?v=LerqGqdhzhQ

author
masterwixx made it!(author)2015-12-25

hello; great project.

how i can repeat ir commands from my air conditioner? and use on the app?

thank you

author
AlanV2 made it!(author)2015-12-26

..

light_arduinopna4602.gif
author
williamn31 made it!(author)2015-12-27

thank , you. but how i can record and repeat the codes from my air conditioner ?

author
AlanV2 made it!(author)2016-06-29

You can use examples of the IRremote library.. Watch this video

author
AlanV2 made it!(author)2015-12-27

Hi

In this video you can see how to make what you need

https://www.youtube.com/watch?v=WzxIVK33bg4

You need the Ir receiver..
change to Pin11 or change the code for PIn2, (Picture)

Enjoy

author
avieira+giavera made it!(author)2015-12-26

Hello Thanks

In this video you can see how to make what you need

https://www.youtube.com/watch?v=WzxIVK33bg4

You need the Ir receiver..
change to Pin11 or change the code for PIn2, (Picture)

Enjoy

author
sny2ksa made it!(author)2016-06-28

Dear AlanV2,

Please have a look on the attached image. I try a lot but got same error.

i use the IDE 1.5 , 1.05 . 1.5.3.

Can you guide me how to solve the issue

Error.jpg
author
AlanV2 made it!(author)2016-06-29

Hi Snyksa..

You can fix, just remove "#include "
and everything related

This code run just in arduino sketch 1.0.5 with IRremote library inside the directory...

I have helped
Alan Vieira

author
RohitC22 made it!(author)2016-02-02

Well Iv been trying to replicate your project for my own
house, but I want to know how it will work if I connect it to my home
router and then assign it an IP from there?
So, instead of connecting to the Internet Ill use it as a LAN device.

Also I want to host the webpage onto my own PC i.e localhost, can you tell me how that will work?

I would be really grateful if you can also provide me the HTML code, INO, circuit diags to connect to the breadboard for the same.

author
AlanV2 made it!(author)2016-02-03

Hi, Good morning Rohit

Well, if you need connect to ip local, change the arduino code fragment

byte ip[] = { 192, 168, 1, 99 }; // IP the arduino

EthernetServer server(80); // Port acess

client.println('<'MET A HTTP-EQUIV='refresh' CONTENT='4; URL=http://192, 168, 1, 99/'>");

First you need look in your IP / PC the group 192.168."1".99

if you are not with 1.. change to the number you have on your computer

You also need to change in "SmartHomeAPP"

http://192.168.1.99/

Don't forget in app you need the "/" at the end

With these changes will work

author
williamn31 made it!(author)2015-12-20

work also with arduino uno ?

thanks

author
AlanV2 made it!(author)2015-12-21

Yes.. It works

author
LuisL17 made it!(author)2015-08-23

hola muy buen aporte...pero yo tengo un problema con mi host name ..mi no -ip... me podrias ayudar a editar el codigo para solo utilizarlo con una ip local ejemplo 192.168.1.57.. porque abro la app (apk) y me sale error de conexion .. eso es por el dominio..como cambio el codigo solo para red local.

author
avieira+giavera made it!(author)2015-12-07

You need change in app your URL...

author
gprilla made it!(author)2015-11-24

03 - In application "SmartHomeAPP" you need change to a URL=http://seudominio.no-ip.org/' Where do i go and change the url in app inventor? any help appreciated

author
avieira+giavera made it!(author)2015-12-07

You need change your URL like that

Example: if you edit your code in this way:

byte ip[] = { 192, 168, 1, 99 }; // IP the arduino

EthernetServer server(80); // Port acess

You URL will look like this:

URL=http://192.168.1.99:80/

author
RaywardB made it!(author)2015-09-08

sir, can you make english version for your code in arduino and for the App inventor code? i am beginner using this kind of devices. please help me. thanks..

author
Eric.Hyungki.Jung made it!(author)2015-02-15

Hi. I am engineer of WIZnet.

May i introduce your instructables to our Web site - WIZnet's Musuem (http://wiznetmuseum.com) ?

Thank you in advance.

author
salianvk made it!(author)2015-04-09

Hi Eric,

Is there any link to site where I can get libraries of WIZnet for Microcontrollers, especially MSP430 or Atmega series that I can use for my project based on Home Automation? If so, please forward to me.

--

Vksalian

author
Eric.Hyungki.Jung made it!(author)2015-04-14

Hi Vksalian.

We have W5500 chip Ethernet libraries for MSP430 at WIZnet Wiki.

(These lib for MSP430 Launchpad + WIZ550io module)

I think this code will be appropriate skelecton for your development.

Please visit our our wiki page.

http://wizwiki.net/wiki/doku.php?id=osh:ioshield-l...

author
AlanV2 made it!(author)2015-02-19

Yes.. when you're done... send the link to me.. ok?

author
Eric.Hyungki.Jung made it!(author)2015-03-08
author
Eric.Hyungki.Jung made it!(author)2015-03-04

Sure. I will leave a reply to you as your instructables is posted on the our museum site.

And, if you have any new project idea using WIZnet ethernet chips or modules, we can provide help (like free samples) to you. Please email me.

>> Eric Jung, hkjung@wiznet.co.kr

author
JordanL6 made it!(author)2015-03-18

Sensacional! esperando meu shield ethernet chegar para fazer!

author
splendid87 made it!(author)2015-03-02

I have verify the code but it show up error compiling!

Would you remedy me?

author
AlanV2 made it!(author)2015-03-03

Send me a PrintScreen of the error..

Do you have all the libraries? (try using Arduivo IDE version 1.5)

author
splendid87 made it!(author)2015-03-05

The image i have uploaded!

I was using Arduino IDE version 1.6

I newbie in Arduino! Where to get the libraries?

Thanks in advance!

Untitled.png
author
AlanV2 made it!(author)2015-03-06

This error happens because you using Arduino IDE Version 1.6

The library the IRemote.h in Version 1.6 is not compatible

Try using the Arduino IDE Version 1.5

author
splendid87 made it!(author)2015-03-06

The problem is same as well.

even though i try 1.0.5 version

author
AlanV2 made it!(author)2015-03-06

Uninstall your arduino IDE remove all folders ..

then download version 1.0.5 again ..

then remove the code the part that relates to IRemote.h library

author
Mr+AbAk made it!(author)2015-01-15

Nice Ible and idea ...

About This Instructable

97,137views

199favorites

License:

Bio: Skills: Programming Language: HTML, CSS, PHP (Basic), Javascript (Basic). - Software and Development Tools: AppIventor (Android), Arduino IDE, Dreamweaver CS4, Photoshop CS6, 3D Studio Max, AutoCAD ... More »
More by AlanV2:Smart Home Automation with Android + Ethernet Internet + Arduino
Add instructable to: