Home-Automation-System-using-Arduino ::::: SDWEBENGINEER..

Home-Automation-System-using-Arduino

(This page includes the complete code and circuit diagram of Home Automation Project.)

App used in this Project: https://play.google.com/store/apps/details?id=com.himanshu.ArduinoAutomation

Note: In Circuit diagram I have just connected 2 Channel Relay and 2 Appliances but according to code you can connect 9 Relay at digital pins 4, 5, 6, 7, 8, 9, 10, 11 & 12. You can increase the number of appliances according to you, there will be no need of changing anything in the code.

For more information regarding the Project you can watch this video: https://youtu.be/i4A1lT43w5g


  • Project Components: 

  1. Arduino UNO Board: 
  2. 2 Channel Relay Module: 
  3. Bluetooth Module HC-05: 
  4. Half Breadboard: 
  5. Jumper Wires: 

Circuit diagram.  (If picture not clear then click on picture.)




Codes for this project..

(Codes are given below. Just copy and paste in ardiuno ide. or click here for codes.  )
     
========================================================
 * This code is for ON/OFF tab of Arduino Automation App.
 * The code is campatible for all Arduino Boards
 * You can use the digiatl pins from 4 to 12 to connect the Relay Module
 
 * Connections of Arduino and Bluetooth Module HC-05 for this Code:
 *      Arduino  |  Bluetooth Module (HC-05)
 *            3  |  RX
 *            2  |  TX
 *           5V  |  5V
 *          GND  |  GND
 */


/* Code starts from below */
=======================================================================

#include <SoftwareSerial.h>   //including library for Software Serial communication

SoftwareSerial mySerial (2, 3);    //(RX, TX)

//defining all the pins of Arduino
#define s1 4
#define s2 5
#define s3 6
#define s4 7
#define s5 8
#define s6 9
#define s7 10
#define s8 11
#define s9 12

void setup() 
{
  //setting all the pins 
  pinMode(s1, OUTPUT);
  pinMode(s2, OUTPUT);
  pinMode(s3, OUTPUT);
  pinMode(s4, OUTPUT);
  pinMode(s5, OUTPUT);
  pinMode(s6, OUTPUT);
  pinMode(s7, OUTPUT);
  pinMode(s8, OUTPUT);
  pinMode(s9, OUTPUT);

  //defining baudrate
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop() 
{
  if(mySerial.available() == 1)   //if communication is going on
  {
    char val = mySerial.read();   //Read the data recieved
    Serial.println("Recieved data is " + (String) val);
    if(val == 'A')    
    {
      digitalWrite(s1, HIGH);
      Serial.println("Switch 1 is ON");
    }
    if(val == 'a')
    {
      digitalWrite(s1, LOW);
      Serial.println("Switch 1 is OFF");
    }
    if(val == 'B')
    {
      digitalWrite(s2, HIGH);
      Serial.println("Switch 2 is ON");
    }
    if(val == 'b')
    {
      digitalWrite(s2, LOW);
      Serial.println("Switch 2 is OFF");
    }
    if(val == 'C')
    {
      digitalWrite(s3, HIGH);
      Serial.println("Switch 3 is ON");
    }
    if(val == 'c')
    {
      digitalWrite(s3, LOW);
      Serial.println("Switch 3 is OFF");
    }
    if(val == 'D')
    {
      digitalWrite(s4, HIGH);
      Serial.println("Switch 4 is ON");
    }
    if(val == 'd')
    {
      digitalWrite(s4, LOW);
      Serial.println("Switch 4 is OFF");
    }
     if(val == 'E')
    {
      digitalWrite(s5, HIGH);
      Serial.println("Switch 5 is ON");
    }
    if(val == 'e')
    {
      digitalWrite(s5, LOW);
      Serial.println("Switch 5 is OFF");
    }
     if(val == 'F')
    {
      digitalWrite(s6, HIGH);
      Serial.println("Switch 6 is ON");
    }
    if(val == 'f')
    {
      digitalWrite(s6, LOW);
      Serial.println("Switch 6 is OFF");
    }
    
     if(val == 'G')
    {
      digitalWrite(s7, HIGH);
      Serial.println("Switch 7 is ON");
    }
    if(val == 'g')
    {
      digitalWrite(s7, LOW);
      Serial.println("Switch 7 is OFF");
    }
    if(val == 'H')
    {
      digitalWrite(s8, HIGH);
      Serial.println("Switch 8 is ON");
    }
    if(val == 'h')
    {
      digitalWrite(s8, LOW);
      Serial.println("Switch 8 is OFF");
    }
    if(val == 'I')
    {
      digitalWrite(s9, HIGH);
      Serial.println("Switch 9 is ON");
    }
    if(val == 'i')
    {
      digitalWrite(s9, LOW);
      Serial.println("Switch 9 is OFF");
    }
  }
}


=========================================================================


                ..................................THANK'S FOR COME OUR PAGE....................................




If you have any question then ask me in comment section....

So have fun and have fun..

Click home button ⬇️ to visit/redirect our home page......

                  🏠


--------------------------------------------------------------

Comments

Popular posts from this blog

DIY ARDIUNO GESTURE CONTROL ROBOT