Things used in this project

Software apps and online services:
Ide web
Arduino Arduino IDE
proteus
Virtual Serial Port Driver
this driver connectes the ports (COM ports) virtually

Schematics

Schematics for Home System
Screenshot (15) de3l5snmve
Schematics for Control System
Screenshot (16) mwxklfa4lq

Code

Code for Home SystemArduino
#include<LiquidCrystal.h>

LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);

for(int i = 2;i<=7;i++){
  pinMode(i,OUTPUT);
}
pinMode(9,INPUT);
pinMode(10,INPUT);
}

int i,state = 0;
int high9 = 0,high10 = 0;
void loop() {
  // put your main code here, to run repeatedly:
 if(Serial.available()>0){
  
  i  = Serial.parseInt();

  changeState(i);
 }
 if(digitalRead(9)==1 && high9 ==0){
  Serial.print(91);
  high9 = 1;
 }
 else if(digitalRead(9)==0 && high9 == 1){
  Serial.print(90);
  high9 = 0;
 }
 else if(digitalRead(10)==1 && high10 ==0){
  Serial.print(101);
  high10 = 1;
 }
 else if(digitalRead(10)==0 && high10 == 1){
  Serial.print(100);
  high10 = 0;
 }
}
void changeState(int i){
  state = digitalRead(i+2);
    digitalWrite(i+2,!state);
    Serial.print(12);
}
Code for Control SystemArduino
#include <Keypad.h>
#include<LiquidCrystal.h>

LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'#','0','*'}
};
byte rowPins[ROWS] = {2,3,4,5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6,7,8}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
  for(int i=2;i<9;i++){
    pinMode(i,OUTPUT);
  }
}

void loop(){
  char key = keypad.getKey();

  if (key != NO_KEY){
    Serial.print(key);
  }
  if(Serial.available()>0){
    int k = Serial.parseInt();
    if(k == 91){
      lcd.setCursor(0,0);
      lcd.print("GAS DETECTED");
    }
    else if(k == 90){
      lcd.setCursor(0,0);
      lcd.print("GAS NOT DETECTED");
    }
    else if(k == 101){
      lcd.setCursor(0,1);
      lcd.print("FLAME DETECTED");
    }
    else if(k == 100){
      lcd.setCursor(0,1);
      lcd.print("FLAME NOT DETECTED");
    }
  }
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlog