Go Down

Topic: My 1st Home Automation system (Read 18196 times) previous topic - next topic

RobV15

hi, I was just introduced to the Arduino systems this past November. My first project consist of an UNO board, paired with an ethernet shield along with a 4 channel relay board. Additionally, i made a simple Android app to accommodate my setup. As a newcomer, I would gladly help any other newcomer who are trying to build a home automation system. Here are some pics of my setup. What do you guys think?





draythomp

Nice job.  How hard was the android app?
Trying to keep my house under control http://www.desert-home.com/

RobV15


Nice job.  How hard was the android app?


not too hard, really. I made a website with the IP addresses for each function. i then transferred that webpage to an html based app. i can show you how i made it if you like.

scouris

I'd love to hear how you did it - as someone who can build web apps fairly easily, the phone app process has always been a little daunting to me. If there's an easy transition available  you will have made my day/week :)

RobV15


I'd love to hear how you did it - as someone who can build web apps fairly easily, the phone app process has always been a little daunting to me. If there's an easy transition available  you will have made my day/week :)


try this.... http://www.appsgeyser.com
i know this is not the best method to creating an app, but it works perfect!

RobV15

as for the buttons, i used an iframe within the webpage which i directed all links to. That way, new tabs arent opened every time a button is pressed.

julzzzninja

im doing the same project as yours, can you help me bro? im also a newbie in arduino, just bought it last 3weeks ago and im trying to do a home automation project using web and arduino.. :) :) :) :)

giladbob

hi ' im doing the same project and i love your work can u help me?
im new to this , schematics ,code , everything will help

thx
gilad

johnft

Very well done. Have you considered trying out teleduino for off-site remote control?
https://www.teleduino.org/
http://www.freetronics.com

sert00

wel done robv15...care to share the app fro mobile?for which OS you coded that?
the mobile side for me is abosolute impossible,and i'm looking for a good apk file to use on my android devices (nexus 7 tablet and galaxy nexus phone)
thanks

RobV15

#include <SPI.h>
#include <Ethernet.h>
#include <mcp9700a.h>


byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xBE }; // leave as is
byte ip[] = { 192 ,168 ,0 ,177 }; //this is the assigned ip address to the arduino ethernet shield.
byte gateway[] = { 192 ,168 ,0 ,1 }; //your routers ip address goes here. (change if your router has a different ip address)
byte subnet[] = { 255 ,255 ,255 ,0 }; // leave as is
EthernetServer server(80); // port no. assigned here (leave as is)

String readString = String(30);


void setup(){
Ethernet.begin(mac, ip, gateway, subnet);
delay(1000);
pinMode(3, OUTPUT);
digitalWrite(3, HIGH);
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
pinMode(6, OUTPUT);
digitalWrite(6, HIGH);
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
Serial.begin(9600);
}

void loop(){
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (readString.length() < 30)
{
readString = readString + c;
}
if (c == '\n') {
Serial.print(readString);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();


if(readString.startsWith("GET /?out=3&status=1"))
{Serial.print("\n 3 LOW \n");
digitalWrite(3, LOW);
client.print("{\"status\" : \"1\" , \"out\" : \"");
client.print(3);
client.print("\"}");
}
if(readString.startsWith("GET /?out=3&status=0"))
{Serial.print("\n 3 HIGH \n");
digitalWrite(3, HIGH);
client.print("{\"status\" : \"0\" , \"out\" : \"");
client.print(3);
client.print("\"}");
}


if(readString.startsWith("GET /?out=5&status=1"))
{Serial.print("\n 5 LOW \n");
digitalWrite(5, LOW);
client.print("{\"status\" : \"1\" , \"out\" : \"");
client.print(5);
client.print("\"}");
}
if(readString.startsWith("GET /?out=5&status=0"))
{Serial.print("\n 5 HIGH \n");
digitalWrite(5, HIGH);
client.print("{\"status\" : \"0\" , \"out\" : \"");
client.print(5);
client.print("\"}");
}


if(readString.startsWith("GET /?out=6&status=1"))
{Serial.print("\n 6 LOW \n");
digitalWrite(6, LOW);
client.print("{\"status\" : \"1\" , \"out\" : \"");
client.print(6);
client.print("\"}");
}
if(readString.startsWith("GET /?out=6&status=0"))
{Serial.print("\n 6 HIGH \n");
digitalWrite(6, HIGH);
client.print("{\"status\" : \"0\" , \"out\" : \"");
client.print(6);
client.print("\"}");
}


if(readString.startsWith("GET /?out=7&status=1"))
{Serial.print("\n 7 LOW \n");
digitalWrite(7, LOW);
client.print("{\"status\" : \"1\" , \"out\" : \"");
client.print(7);
client.print("\"}");
}
if(readString.startsWith("GET /?out=7&status=0"))
{Serial.print("\n 7 HIGH \n");
digitalWrite(7, HIGH);
client.print("{\"status\" : \"0\" , \"out\" : \"");
client.print(7);
client.print("\"}");
}


if(readString.startsWith("GET /?out=all"))
{
Serial.print("\n OUT ALL\n");
client.print("{\"ip\" : \"192.168.0.1\", "); //enter your WAN ip address here if using your arduino over WAN, otherwise, leave as is
client.print("\"devices\" : ");
client.print("[{ \"type\" : \"lights\", \"name\" : \"Light1\", \"out\" : \"");
client.print("3");
client.print("\"}");
client.print(",{ \"type\" : \"lights\", \"name\" : \"Light2\", \"out\" : \"");
client.print("5");
client.print("\"}");
client.print(",{ \"type\" : \"lights\", \"name\" : \"Light3\", \"out\" : \"");
client.print("6");
client.print("\"}");
client.print(",{ \"type\" : \"lights\", \"name\" : \"Light4\", \"out\" : \"");
client.print("7");
client.print("\"}");
client.print("]}");
}
readString="";
client.stop();
}
}
}
}
}

RobV15

use the code above with the DomoticHome app on the android market. It should work perfectly!


cgrace

This is exactly what my boyfriend wants to get into! His birthday is coming up, can someone tell me / direct me to what I need to buy to get home started? Please:)

Go Up