Project tutorial
Home Automation with Arduino Uno and SmartEdge Agile

Home Automation with Arduino Uno and SmartEdge Agile © GPL3+

Saves electricity and makes your home a smarter one with the security of Avnet.

  • 499 views
  • 0 comments
  • 1 respect

Components and supplies

Necessary tools and machines

Apps and online services

About this project

Main video

HISTORY

I started this project as a school project. Actually, I wanted to create something that would benefit the society. Therefore, I started examining what are the different problems that are exiting in the world that could be solved. Then, I found out that "Misuse of Electricity" and "Shortage of electricity" are some of the problems faced by the people of India. Therefore, I designed this system for the above mentioned purpose. I made it without any nxp rapid iot rapid prototyping kit and Smart Edge Agile but here I am using them.

Introduction Video

BILL OF MATERIALS

The materials used in my project are given below along with their respective price (all price are in INR per piece);

  • Breadboard - INR 60
  • Four Channel Relay Module- INR 130
  • HC-SR04 Ultrasonic distance sensor - INR 80
  • Arduino Uno - INR 1500
  • Generic Jumper wire Male to Male - INR 5 (about 50-70 required)
  • Generic Jumper wire Male to Female - INR 5 (about 50-70 required)
  • 9v Power Adapter - INR 100
  • HC - 05 BLUETOOTH MODULE - INR 250

Therefore, The total Cost of my project is around INR 4000

PRINCIPLE

The working principle of this whole system is that:

1)The ultrasonic sensor will detect human presence

2) Relay module will control all the appliances but it will not be connected to sockets as there may be a need to turn it on when there are no people in a room

3) Smart Edge will take various sensors values display via Brainium server since this kit has sensor with high accuracy

*The relay module will be installed between the appliances and switch so to run the appliances there will an automated switch (run by Arduino Uno) and a normal manual switch

** If there is a need to run any appliance without human presence it can be achieved for 2 hrs via a customized app.

***To run the fan ( or ac) there will be two conditions first the human presence and second the temperature should be high enough(22 degree Celsius)

****To run the light there will be two conditions first the human presence and second the light intensity should be high enough (4.5 analog value)

You may refer to the video for more details.

STEPS FOR MAKING

STEP 1: MAKING THE PROTOTYPE OF HOUSE

You can use any kind of model for this purpose, but the condition is that you need to have a house made of any material withoutanyroof. I am enclosing the pictures of my (made) house.

STEP 2: MAKING THE CONNECTIONS

The Smart Edge Agile needs no wiring while the remaining components may be wired as follows:

STEP 3: WRITING THE CODE:

The Code for Arduino IDE is given below in the attachment part and for more details please see the comments. A detailed description of the app is given in the the video in the last video in testing part.

STEP 4: MAKING APP

I used the MIT App Inventor to make the app. For detailed description please refer to the second video in the principle part. Here are the screenshots of the blocks:

STEP 5: TESTING

You may proceed for testing the prototype by following the video as under.

The most important part of project that displays the code and working.

Code

CODEArduino
/***************** INCLUDING LIBRARIES****************/
#include <SoftwareSerial.h> // SoftwareSerial library
#include <DHT.h>    //DHT library
#include <DHT_U.h>
/******************* DEFINING PINS********************/
#define r1l 7    
#define r2l 8
#define r1f 5
#define r2f 6 
#define ldr A0
#define Trig1 10
#define Echo1 11 
#define dhtPin 9
#define Trig2 12
#define Echo2 13
#define DHTTYPE DHT11
/************************* INTITIATING VARIABLES****************/
int distance2 = 0;
int duration2 = 0;
int distance1= 0;
int ldrv = 0;
int duration1=0;
char bt =0;
int h=0;
int t = 0;
/************************* INTITIATING DHT SENSOR****************/
DHT dht(dhtPin, DHTTYPE);
/******************** Intitiating softwareSerial ************/
SoftwareSerial btSerial(3,2);
// void setup
void setup()
{
  btSerial.begin(9600);
  Serial.begin(9600);
  dht.begin();
  pinMode (r1l,OUTPUT);
  pinMode(r1f,OUTPUT);
  pinMode (r2f,OUTPUT);
  pinMode (r2l,OUTPUT);
  pinMode (Trig1,OUTPUT);
  pinMode (Echo1,INPUT);
  pinMode (Trig2,OUTPUT);
  pinMode (Echo2,INPUT);
  pinMode (dhtPin,INPUT);
  pinMode(ldr,INPUT);
  
}
void loop()
{
  Measure();
  delay(25);
  CheckAction(); 
}


void Measure()
{ 
  // Measuring Temperature and Humidity
    h = dht.readHumidity();
    t = dht.readTemperature();
     if (isnan(h) || isnan(t)) 
     {
     h = 0;
     t = 0;
     return;
     }
     Serial.println("humidity = ");
      Serial.println(h);
  Serial.println("temperature = ");
       Serial.println(t);
  // Measuring Ultrasonic distance
    

 digitalWrite(Trig1, LOW); 
 delayMicroseconds(2); 
 digitalWrite(Trig1, HIGH);
 delayMicroseconds(10); 
 digitalWrite(Trig1, LOW);
 duration1 = pulseIn(Echo1, HIGH);
 distance1 = duration1/58.2;
 Serial.print("ROOM 1 = ");
 Serial.println(distance2);
 
 digitalWrite(Trig2, LOW); 
 delayMicroseconds(2); 
 digitalWrite(Trig2, HIGH);
 delayMicroseconds(10); 
 digitalWrite(Trig2, LOW);
 duration2 = pulseIn(Echo1, HIGH);
 distance2 = duration2/58.2;
 Serial.print("ROOM 2 = ");
 Serial.println(distance2);
 
delay(10);

 ldrv= analogRead(ldr);
 Serial.println("ldr = ");
 Serial.println(ldrv);
delay(10);
 bt = btSerial.read();
 Serial.print("bt =");
 Serial.println(bt);

 delay(50);
 }


 void CheckAction()
 {  
   // checking fans ......
   if(t>22 && h>40)
    {
       // checking room 1 fans ......    
       if (distance1 > 5)
         digitalWrite(r1f,HIGH);
       else  
         digitalWrite(r1f,LOW);
         
       // checking room 2 fans .......
         if (distance2 > 5)
         digitalWrite(r2f,HIGH);
       else  
         digitalWrite(r2f,LOW);
    }

    // checking lights ......
    if(ldrv > 4.5)
      {
          // checking room 1 lights ......    
       if (distance1 > 5)
         digitalWrite(r1l,HIGH);
       else  
         digitalWrite(r1l,LOW);
         
       // checking room 2 lights .......
         if (distance2 > 5)
         digitalWrite(r2l,HIGH);
       else  
         digitalWrite(r2l,LOW); 
      }
        
       //Checking Bluetooth..........
     if (bt == '0')
{
 digitalWrite(r1l,HIGH);
  digitalWrite(r1f,HIGH);  // ROOM 1 APPLIANCES ON
   Serial.print('a');
}
    if (bt == '1')
    {   
      Serial.print('b');
  digitalWrite(r1f,LOW);   // ROOM 1 APLLIANCES OFF
  digitalWrite(r1l,LOW);
    }

    if (bt == '2')
{
 digitalWrite(r2l,HIGH);
  digitalWrite(r2f,HIGH);  // ROOM 2 APPLIANCES ON
   Serial.print('c');
}   


    if (bt == '3')
{ 
  Serial.print('d');
  digitalWrite(r2f,LOW);  // ROOM 2 APPLIANCES OFF 
  digitalWrite(r2l,LOW);
}
 } 

Schematics

SCHEMATICS
Follow the same connections
Uploads2ftmp2fe35f5af1 78e6 4aa0 8d05 de0bc64317cc2fhomeautomation wlsywz3ngw

Comments

Similar projects you might like

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 40,219 views
  • 21 comments
  • 116 respects

Simple Home Automation Using Bluetooth, Android and Arduino

Project tutorial by Prasanth K S

  • 26,319 views
  • 3 comments
  • 22 respects

Aquarium Automation

Project showcase by Team GUT

  • 17,144 views
  • 9 comments
  • 31 respects

Tito - Arduino UNO 3D-printed robot

Project tutorial by Camilo Parra Palacio

  • 15,772 views
  • 14 comments
  • 46 respects

Octopod: Smart IoT Home/Industry Automation Project

Project tutorial by Saksham Bhutani

  • 10,948 views
  • 9 comments
  • 38 respects

Home Automation With Arduino 101 Using Bluetooth Low Energy

Project tutorial by naveen manwani

  • 2,097 views
  • 0 comments
  • 6 respects
Add projectSign up / Login