Project tutorial
How to Automate Your Room With Arduino? ENC28j60 Android ...

How to Automate Your Room With Arduino? ENC28j60 Android ... © GPL3+

Hey all of you! i've been working on automating my room, and i finally got it after a hard coding and many tries, and i'm glad to share w...

  • 342 views
  • 0 comments
  • 3 respects

Components and supplies

Apps and online services

About this project

Hey all of you! i've been working on automating my room, and i finally got it after a hard coding and many tries, and i'm glad to share with you my achievements.

This project consist on a system arduino controlled, that let you control whatever you want remotelly from any device that can get connected to internet, by typing an iP that has a Web app that i designed on the arduino code for my need.

Step 1: Demostration Video

Here you can see some tips, the process, and the demostration of the system working perfectly

Step 2: Materials You Need:

1-Arduino nano

2-ENC28j60 ethernet shield

3-4 Relays

4-2n2222 NPN Transistors

5- 1amp Diodes

6-1k ohm Resistors

7-1x Dual terminal block, 1x triple terminal block

8-PCB board

9-OVC3860 audio bluetooth module

10-2x 3.5mm audio jacks

11-Some wires for conecction

Step 3: Arduino Code and Electronic Schematic

Here is the circuit diagram and the file on Fritzing and the arduino code designed by me.

Step 4: Html App, (it's Coded in the Arduino Code)

This is the web app, typed on html. You can modified as much as you want.

Step 5: If You Want to Do It by a Remote Control (IR)

Here is a video to show you how to comunicate with the arduino.

Just add an IR receiver in the circuit on a free input pin of the arduino and use de library IRremote.

Code

CodeProcessing
Just copy it and upload it to your arduino board
//#include <IRremote.h>

#include <UIPEthernet.h> // Used for Ethernet
int on = 1;
int on1 = 1;
 int spk = 5;
//int RECV_PIN = 6;
int luz = 7;
 int a3 = 8;
 int a5 = 9;
 // void recibir();
 void internet();
// **** ETHERNET SETTING ****
byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x30, 0x31 };                                       
IPAddress ip(10,0,0,14);                        
EthernetServer server(80);
         // stores the HTTP request

//IRrecv irrecv(RECV_PIN);

//decode_results results;

void setup() {
  
 //irrecv.enableIRIn(); // Start the receiver
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  pinMode(spk,OUTPUT);
  pinMode(a3,OUTPUT);
  pinMode(a5,OUTPUT);
  pinMode(luz, OUTPUT);
  
}

void loop() {

   
  // listen for incoming clients
  EthernetClient client = server.available();
  
 if (client) 
  {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    String buffer = ""; 
    while (client.connected()) 
    { 
      if (client.available()) 
      {
        char c = client.read();
        buffer+=c;
     
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) 
        { 
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println(); 
          client.println("<meta name=\'viewport\' content=\'width=device-width, initial-scale=1\'>");
          client.println("<link rel='stylesheet' href='https://goo.gl/wRTxw5'>");
          client.print("<a href='l'><button class='btn btn-info btn-block'><h2>LUZ</h2></button></a>");
          client.print("<a href='3'><button class='btn btn-danger btn-block'><h2>3</h2></button></a>");
          client.print("<a href='5'><button class='btn btn-danger btn-block'><h2>5</h2></button></a>");
          client.print("<a href='0'><button class='btn btn-danger btn-block'><h2>OFF</h2></button></a>");
          client.print("<a href='a'><button class='btn btn-success btn-block'><h2>AUDIO</h2></button></a>");
          //client.print("<a href='u'><button class='btn btn-warning btn-block'><h2><span>&#8679;</span></h2></button></a>"); 
          //client.print("<a href='d'><button class='btn btn-warning btn-block'><h2><span>&#8681;</span></h2></button></a>");    
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
          buffer=""; 
        }
        else if (c == '\r') 
        {
           if(buffer.indexOf("GET /l")>=0)
            { on = !on;
              digitalWrite(luz, on ? LOW:HIGH);
              
              }
          if(buffer.indexOf("GET /3")>=0)
           { digitalWrite(a5, LOW);
            digitalWrite(a3, HIGH);}
          if(buffer.indexOf("GET /5")>=0)
            { digitalWrite(a3, HIGH);
             digitalWrite(a5, HIGH);}
          if(buffer.indexOf("GET /0")>=0)
           { digitalWrite(a5, LOW);
            digitalWrite(a3, LOW);} 
          if(buffer.indexOf("GET /a")>=0)
           { on1 = !on1;
            digitalWrite(spk,on1 ? LOW:HIGH);}
         }
        else
        {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      } 
    }
    client.stop();
  }
}

/*void recibir ()
  {
   //digitalWrite(10,LOW);
  if (irrecv.decode(&results)) {
    
    Serial.println(results.value);
    if (results.value == 4021744257 ||results.value == 88334759) {
      on = !on;
      
      digitalWrite(bocina, on ? LOW : HIGH); //control de audio
      delay(250);
      }
      
    else if (results.value == 2645925549 ||results.value == 88341947) {
      on = !on;
      digitalWrite(luz, on ? HIGH : LOW);   //encender y apagar luz
      delay(250);
    }
    
    else if (results.value == 1180376831) {
      digitalWrite(abanico5, LOW);        //abanico en 3
      digitalWrite(abanico3, HIGH);
      delay(250); 
  }
     else if (results.value == 1190948241||results.value == 88280395) {
      digitalWrite(abanico3, HIGH);       //abanico en 5     
      digitalWrite(abanico5, HIGH);
      delay(250); 
  }
  else if (results.value == 1762767691) {
      digitalWrite(abanico3, LOW);        //apagar abanico   
      digitalWrite(abanico5, LOW);
      delay(250); 
  }
  
  
  irrecv.resume(); // Receive the next value
} 
  }*/
 

Schematics

Schematic
Fritzing archive and image
domotica_FTcJspMCQ4.fzz

Comments

Similar projects you might like

RGB Camera Backlight Control With Android Mobile

Project tutorial by DIY Partners

  • 2,013 views
  • 1 comment
  • 8 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 24,933 views
  • 17 comments
  • 75 respects

Smart Living Room (Home Theatre)

Project showcase by Alex Warsun

  • 5,147 views
  • 3 comments
  • 20 respects

Line Follower Robot - PID Control - Android Setup

Project tutorial by MJRoBot

  • 28,042 views
  • 7 comments
  • 33 respects

Home Automation Using Zone Beacon via Android App

Project tutorial by Team SomeRandomTeam

  • 1,642 views
  • 2 comments
  • 13 respects
Add projectSign up / Login