mohammadsohail0008
Published © GPL3+

Home Automation Device

Home Automation Device using GSM Module

IntermediateFull instructions provided429
Home Automation Device

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
GSM SIM 900
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Relay Module (Generic)
×1
Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms
×1
Resistor 330 ohm
Resistor 330 ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1
12v 1 amp DC Adapter
×1
Hologram Global IoT SIM Card
Hologram Global IoT SIM Card
×1
Android device
Android device
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Circuit Diagram

Operation Table

Code

Code

Arduino
// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //
// Home Automation Device using GSM Module //
// By MOHD SOHAIL //


#include<LiquidCrystal.h>
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
#define Fan 3
#define Light 4
#define TV 5

int temp=0,i=0;
int led=13;
char str[15];
void setup()
{
  lcd.begin(16,2);
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  pinMode(Fan, OUTPUT);
  pinMode(Light, OUTPUT);
  pinMode(TV, OUTPUT);
  
  lcd.setCursor(0,0);
  lcd.print("  GSM Based  ");
  lcd.setCursor(0,1);
  lcd.print("Home Automation");
  delay(2000);
  lcd.clear();
  lcd.print(" EIF - SOHAIL ");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("System Ready");
  Serial.println("AT+CNMI=2,2,0,0,0"); // Auto opened message Receiving.
  delay(500);
  Serial.println("AT+CMGF=1"); //Selecting Text mode
  delay(1000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Fan   Light  TV ");
  lcd.setCursor(0,1);
  lcd.print("OFF    OFF   OFF "); 
}
void loop()
{
  lcd.setCursor(0,0);
  lcd.print("Fan   Light  TV");
  serialEvent();
  if(temp==1)
  {
    check();
    temp=0;
    i=0;
    delay(1000);
  }
}
 void serialEvent() 
 {
  while(Serial.available()) 
  {
    if(Serial.find("#S."))
    {
      digitalWrite(led, HIGH);
      delay(1000);
      digitalWrite(led, LOW);
      while (Serial.available()) 
      {
      char inChar=Serial.read();
      str[i++]=inChar;
      if(inChar=='*')
      {
        temp=1;
        return;
      } 
      } 
    }
   }
 }
void check()
{
   if(!(strncmp(str,"tv on",5)))
    {
      digitalWrite(TV, HIGH);
      lcd.setCursor(13,1); 
      lcd.print("ON    ");
      delay(200);
    }  
   
   else if(!(strncmp(str,"tv off",6)))
    {
      digitalWrite(TV, LOW);
      lcd.setCursor(13,1); 
      lcd.print("OFF    ");
      delay(200);
    }
  
    else if(!(strncmp(str,"fan on",5)))
    {
      digitalWrite(Fan, HIGH);
      lcd.setCursor(0,1); 
      lcd.print("ON   ");
      delay(200);
    }
 
    else if(!(strncmp(str,"fan off",7)))
    {
      digitalWrite(Fan, LOW);
      lcd.setCursor(0,1); 
      lcd.print("OFF    ");
      delay(200);
    }
 
    else if(!(strncmp(str,"light on",8)))
    {
      digitalWrite(Light, HIGH);
      lcd.setCursor(7,1); 
      lcd.print("ON    ");
      delay(200);
    }
 
    else if(!(strncmp(str,"light off",9)))
    {
      digitalWrite(Light, LOW);
      lcd.setCursor(7,1); 
      lcd.print("OFF    ");
      delay(200);
    } 
    
    else if(!(strncmp(str,"all on",6)))
    {
      digitalWrite(Light, HIGH);
      digitalWrite(Fan, HIGH);
      digitalWrite(TV, HIGH);
      lcd.setCursor(0,1); 
      lcd.print("ON     ON    ON  ");
      delay(200);
    }
 
    else if(!(strncmp(str,"all off",7)))
    {
      digitalWrite(Light, LOW);
      digitalWrite(Fan, LOW);
      digitalWrite(TV, LOW);
      lcd.setCursor(0,1); 
      lcd.print("OFF   OFF    OFF  ");
      delay(200);
    }
    }

Credits

mohammadsohail0008

mohammadsohail0008

42 projects • 31 followers

Comments