smart home with arduino

16
http://www.instructables.com/id/Smart-home-with-arduino/ Food Living Outside Play Technology Workshop Smart home with arduino by Nikus on October 6, 2014 Table of Contents Smart home with arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Intro: Smart home with arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 1: Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 2: Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Step 3: Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 4: How it works? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 5: Appliaction for android. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 6: Application configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 7: Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Step 8: Port forwarding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Step 9: NO IP (optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Step 10: Test it! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Step 11: EDIT: android app source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Upload: marius-danila

Post on 07-Feb-2016

65 views

Category:

Documents


15 download

DESCRIPTION

Smart Home With Arduino

TRANSCRIPT

Page 1: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Food      Living       Outside        Play        Technology       Workshop

Smart home with arduinoby Nikus on October 6, 2014

Table of Contents

Smart home with arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro:   Smart home with arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1:   Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2:   Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 3:   Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 4:   How it works? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 5:   Appliaction for android. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Step 6:   Application configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Step 7:   Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Step 8:   Port forwarding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Step 9:   NO IP (optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Step 10:   Test it! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Step 11:   EDIT: android app source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Page 2: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Author:Nikus    arduino polandHi. My name is Nikodem. I live in Poland, I'm 15 years old. I like to program and invent new things. In the future, I want to start a company that inventing newthings.

Intro:  Smart home with arduinoHello.

I will show you how to build your own smart home. It shows the temperature both inside and outside, if the window is open or closed, shows when it rains and makealarm when the PIR sensor senses move. I made the application on the android to display all the data (you can also watch it on browser). You can see temperature inyour home and other information from all over the world! Application is translated to english and polish. I built it because I wanted to make my own smart home andcontrol it. If you want, you can make your own smart home, all you need is parts (listed below) and a lot of desire. So let's get started.

Explanation of acronyms for beginner:

GND - ground

VCC - power

PIR - move sensor

Step 1: PartsAll the parts cost me $90

-arduino

-ethernet module ENC28J60

-thermometer DS18B20 x2

-microphone module

-rain sensor

-PIR sensor

-reed switch

-relay

-resistor 4,7k ?

-twisted-pair cable

-ethernet cable

-tools (soldering, screwdriver)

Page 3: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Image Notes1. rain sensor2. relay3. ENC28J604. DS18B20 thermometer5. resistor 4,7 k6. microphone module7. reed switch8. PIR sensor9. breadboard10. Arduino11. DS18B20 thermometer

Step 2: ConnectionAbove I added picture from fritzing with connection. If you have a problem with it leave a comment.

Page 4: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Step 3: ProgramFirst you need to do is download, extract and import this library to arduino IDE. You can upload this program to your arduino. In the comment is an explanation of thecode.

File Downloads

smart_home.ino (5 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'smart_home.ino']

libraries.rar (21 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'libraries.rar']

Step 4: How it works?When you click refresh in your app or in browser Arduino sends data to smartphone/browser. Application gets source code from each page ( /tempin, /tempout, /rain,/window, /alarm) and displays it on your phone.

Step 5: Appliaction for android.To instal app on your android phone you need to make this (you can see it on the picture above):

1. the firs first step is download smartHome.apk file

2.Send apk file to your phone

3.Open file manager and locate smarthHome.apk file

4.Click on it and click install (if you have enabled the option to install applications outside the google play you need to turn it on)

5.You have finished the installation, you can enable the application

Application is translated to english and polish. In browser you can turn on and off light but in app not because I can't do that, sorry.

Page 5: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Image Notes1. settings

Page 6: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Image Notes1. click file manager

Image Notes1. click smartHome.apk

Page 7: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Image Notes1. click package installer

Image Notes1. and click install

File Downloads

smartHome.apk (374 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'smartHome.apk']

Step 6: Application configurationI'll explain how the application works. It's shows all data from your home. You can click on settings icon to edit your IP address and turn on or off alarm. When you turn onalarm, app get data from PIR sensor in service and if it's detected move in your home it's make a notification. App retrieves the data from the motion sensor every minute.In IP field you must enter your IP address. You can check it here.

Page 8: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Page 9: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Page 10: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Page 11: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Step 7: BrowserType in your browser your ip / all. There you can see all the data and turn on and off light.

You can use this instead of the application on android.

Page 12: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Step 8: Port forwardingYou need to open port on your router. Open your router configuration and set arduino ip and open port 80. You can see it on image above.

Image Notes1. click on port forwarding2. click on advanced3. and set this4. click save

Step 9: NO IP (optional)You can set up an account at no ip but this is not necessary. In the picture above you can see how to configure it.

Image Notes1. enter your ip2. Choose hostname

Step 10: Test it!If you want to see the data on your computer you can do this by typing into your browser yourip / all (e.g. 12.345.678.901/all) or use android application.

Remember to leave a comment and click favourite if you like my project :)

Step 11: EDIT: android app source codeBecause many people asked me about android source code I add it below.

File Downloads

smartHome.rar (1 MB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'smartHome.rar']

Page 13: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

Related Instructables

Send SMS fromArduino overthe Internetusing ENC28J60and Thingspeakby lucasxavier11

Arduino BasedAutomatedLighting Controlby rmagtibay

Cheap and EasyArduino Wi-FiHack (Photos) byddoss

Webserver forhomeappliancescontrol by Milen

How to useArduino to turnon a lampremotely,directly fromyouriPhone/Androidby jackbell16

Add Ethernet toany Arduinoproject for lessthan 10$ byhansc44

Advertisements

Comments

41 comments Add Comment

 pshrn says:  Jan 6, 2015. 3:41 AM  REPLYfor how much maximum distance from the mobile will this circuit work ?

 Nikus says:  Jan 6, 2015. 6:01 AM  REPLYYou can read data from all over the world (if you have internet)

 VimalP says:  Dec 24, 2014. 8:02 AM  REPLYhi nikus , its vimal pandey from nepal. I am a BE computer student.I`m stucked...

I`m using arduino uno compatible (quite bigger) ethernet shield with sd slot too.

can u plz guide me to use that shield with this project???

 ahmedsaad.zizou says:  Dec 22, 2014. 8:25 AM  REPLYWe are in the process done an excellent project and thank you and hope to stay in touch with us

Thank you thank you thank you thank you Nikus

 pshrn says:  Dec 15, 2014. 8:59 PM  REPLYhey

can i use arduino uno instead of arduino leonardo?

 Nikus says:  Dec 16, 2014. 6:37 AM  REPLY

Yes, you can use uno but you need to download library enc28j60.zip from here and connect it like on image below.

Page 14: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

 Max_valentine says:  Nov 26, 2014. 10:26 AM  REPLYThanks for sharing . Its a Great Project !!!I have been long looking for something like this .The part where the sensor sends the data and is received and interpreted by the smart phone is commendable . I am planning to build the same .As of now i have been sending data to Arduino using BC-05 Bluetooth module and it worked fine. Connecting to Local LAN would be my next step :)

 iam_maker_leo says:  Nov 20, 2014. 12:16 AM  REPLYwow.... actually it can be a nice smart home....

AND... how about use Wiznet's ethernet shield instead ENC28J60...

Hahaha just kiding.... (I am working for Wiznet...)

 Sasando_Rote says:  Nov 17, 2014. 12:36 PM  REPLYmantap neh...

 aymen.mhili says:  Nov 16, 2014. 11:11 AM  REPLYI can design the data on smartphone long distance????

 aymen.mhili says:  Nov 16, 2014. 10:41 AM  REPLYhow to control Arduino board long-distance

 thanos.boutros says:  Nov 14, 2014. 11:39 AM  REPLYHello, very good job! I have a problem how can I run the app code. I am doing the import the programm with eclipce but I have two errors!

error1:The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project.

error2:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class filesSettings.java/smartHome/src/com/example/smarthome

Please you can help me?

 zx lee says:  Nov 10, 2014. 3:56 PM  REPLYhi, first of all, great job on your project. I would like to ask, since your ethernet has an IP address depending on your network. does this count as a local areanetwork. or is it possible to access your IP address out of your local network. thanks

 DOA_Brain says:  Nov 10, 2014. 11:43 PM  REPLYto access the arduino from the Internet you need to enable port forwarding in you router. like the instructions mentions.

 rbright says:  Nov 11, 2014. 5:02 PM  REPLYI'm having a lot of Port Forwarding problems with a NetComm router/modem so can you advise the specific model of router you have used.

 DOA_Brain says:  Nov 13, 2014. 2:20 AM  REPLYmost current router/modems support port forwarding but in some ISP block ports as well so check with your ISP first before getting a newrouter/modem

Page 15: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

 Nikus says:  Nov 12, 2014. 5:14 AM  REPLYI use D-Link DIR-615.

 zx lee says:  Nov 11, 2014. 2:02 AM  REPLYThanks for the info.

 Nikus says:  Nov 11, 2014. 7:21 AM  REPLYHi!

First of all, thank you. DOA_Brain is right you need to open ports on your router.

 uzziah0 says:  Nov 11, 2014. 8:57 AM  REPLYThis is great. I've seen some but always seem to have problems with the ability to see status or do anything from phone or web. This is great, and not toomuch in one go; I'm thinking of starting with what you have, and using other Instructibles to add to it. The other Instructibles use an Arduino Uno. You use theLeonardo.

Can you explain why you picked that one, and will the program you include run on an Uno (this will be my first Arduino)

 Nikus says:  Nov 12, 2014. 5:47 AM  REPLYFirst of all thanks!

I used Leonardo becouse I have it. Yes, you can use uno but you need to download library enc28j60.zip from here and connect it like on image below.

good luck!

 geekOmat says:  Nov 11, 2014. 11:55 PM  REPLYLove it, voted for, thanks!

 Nikus says:  Nov 12, 2014. 5:16 AM  REPLYThanks for your vote :-)

 Build_it_Bob says:  Nov 11, 2014. 4:33 PM  REPLYVery nice Nikus , I enjoyed your Instructable very much. Very nice fritzing sketch too!

Build_it_Bob

 Nikus says:  Nov 12, 2014. 5:14 AM  REPLYThanks :)

 andreyeurope says:  Nov 11, 2014. 11:56 AM  REPLYHi. I would be really grateful if you will show us and explain the android code.

Page 16: Smart Home With Arduino

http://www.instructables.com/id/Smart-home-with-arduino/

 Nikus says:  Nov 11, 2014. 12:32 PM  REPLYI added it in last step :)

 andreyeurope says:  Nov 11, 2014. 10:34 PM  REPLYThanks. That helps me developing new applications and understanding better Android code.

 infomaniac50 says:  Nov 11, 2014. 6:55 PM  REPLYI downloaded the source and cleaned up the code a bit. The source code for it is at https://github.com/infomaniac50/smartHome-Android. The two mainthings were spelling for the refresh button and a unicode escape character for the degree symbol. I got the unicode escape from here.http://www.fileformat.info/info/unicode/char/b0/index.htm. Very nice project. I don't have the parts for the Arduino side, thermometers, reed switch, etc, but I'llhave to go fetch some and try it out. Almost everything was sourced from Amazon too, which by the way is awesome.

 gmbandeira says:  Nov 11, 2014. 11:44 AM  REPLYPretty nice project! I hope I can do this in the next months. What about tThe Android source code, you wouldn't give us, would you?

 Nikus says:  Nov 11, 2014. 12:32 PM  REPLYThank you, I added it in last step :)

 gmbandeira says:  Nov 11, 2014. 2:00 PM  REPLYThanks a lot! :D

 markche says:  Nov 1, 2014. 2:37 PM  REPLYI'm doing something very similar, but am very new to java. Do you have your Android code posted somewhere? I would like to see how it's done and modifyit a bit to fit my needs.

 Nikus says:  Nov 11, 2014. 12:34 PM  REPLYI added it in the last step :)

 koney says:  Nov 11, 2014. 1:25 AM  REPLYsame here :-)

 Ghild.Zero says:  Nov 11, 2014. 6:01 AM  REPLYplease make Instructables how to make Android Software

 Nikus says:  Nov 11, 2014. 7:46 AM  REPLYI know too little about Java. In internet you find a lots of tutorials about making android app. Here is link with good explanation all thing:

http://developer.android.com/training/index.html

 69fordf100 says:  Nov 11, 2014. 5:58 AM  REPLYI'm in the process of making this also. What did you do with your relays? You only mentioned then in the parts and design drawing.

 Nikus says:  Nov 11, 2014. 7:25 AM  REPLYRelays control light. When you claps or click on button in browser light change.

 seamster says:  Oct 30, 2014. 2:07 PM  REPLYWell done! Thanks for sharing your smart home ideas!

 Nikus says:  Oct 31, 2014. 7:23 AM  REPLYThank you :-)