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

Picture of 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

Picture of 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)

Picture of 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

Picture of 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

CassioU (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

RubineR (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

JimT114 (author)2017-03-05

Nice job AlanV2.

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

ecmperalta (author)JimT1142017-03-21

you got the link? someone could help please?

JimT114 (author)ecmperalta2017-03-25

OK i got the .aia file. Thanks.

Ranjee OmarA (author)2016-12-21

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

samyxyz (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.

Aijeleths (author)samyxyz2016-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

jjimenez21 (author)2016-11-04

excelen proyect

ChanaC (author)2016-10-18

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

ShaubhamS (author)2016-10-02

sir kindly provide me codeing shaubhamsaini@gmail.com

Mark AndyS (author)2016-08-09

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

Mark AndyS (author)2016-08-09

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

Mark AndyS (author)2016-08-09

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

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

G.T

ChetanK23 (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 .

AlanV2 (author)ChetanK232016-06-29

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

Watch this video

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

masterwixx (author)2015-12-25

hello; great project.

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

thank you

AlanV2 (author)masterwixx2015-12-26

..

williamn31 (author)AlanV22015-12-27

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

AlanV2 (author)williamn312016-06-29

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

AlanV2 (author)williamn312015-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

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

sny2ksa (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

AlanV2 (author)sny2ksa2016-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

RohitC22 (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.

AlanV2 (author)RohitC222016-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

williamn31 (author)2015-12-20

work also with arduino uno ?

thanks

AlanV2 (author)williamn312015-12-21

Yes.. It works

LuisL17 (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.

avieira giavera (author)LuisL172015-12-07

You need change in app your URL...

gprilla (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

avieira giavera (author)gprilla2015-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/

RaywardB (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..

Eric.Hyungki.Jung (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.

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

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...

AlanV2 (author)Eric.Hyungki.Jung2015-02-19

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

Eric.Hyungki.Jung (author)AlanV22015-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

JordanL6 (author)2015-03-18

Sensacional! esperando meu shield ethernet chegar para fazer!

splendid87 (author)2015-03-02

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

Would you remedy me?

AlanV2 (author)splendid872015-03-03

Send me a PrintScreen of the error..

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

splendid87 (author)AlanV22015-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!

AlanV2 (author)splendid872015-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

splendid87 (author)AlanV22015-03-06

The problem is same as well.

even though i try 1.0.5 version

AlanV2 (author)splendid872015-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

Mr AbAk (author)2015-01-15

Nice Ible and idea ...

About This Instructable

101,680views

205favorites

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 »
Add instructable to: