Enhanced Garage Door

Light up a "welcome" sign when you open your garage, and a lamp in the living room whenever you close it (to find your way when it's dark).

IntermediateFull instructions provided3 hours1,054
Enhanced Garage Door

Things used in this project

Hardware components

Photon
Particle Photon
×3
Magnetic Sensor
×1
Relay
×3
Jumper wires (generic)
Jumper wires (generic)
×1
hookup wires
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Maker service
IFTTT Maker service
Google Sheets
Google Sheets

Story

Read more

Schematics

Garage Circuit Hookup

Welcome Sign Circuit Hookup

Living Room Circuit Hookup

Tested Garage Operation Times

Actual Garage Operation on November 23rd, 2016

IFTTT Applets for Data Collection & SMS Notification

The first two applets are used to collect data and send them to google drive in a spread sheet form. The last two applets are used to get notification via SMS when the garage opens or closes.

Code

Garage Code

C/C++
int analogPin = A1; 
int garage = D0;
int val = 0;

void setup(){
  pinMode(garage, OUTPUT);     
  pinMode(analogPin, INPUT);
  Serial.begin( 9600 );

Particle.function("Function_Name",Hello);
}


void loop(){}
 

 int Hello(String command){
  val = analogRead(analogPin);

  if (command=="on" && val<4060) {
         
        digitalWrite(garage,HIGH);
        delay(100);
        digitalWrite(garage,LOW);
        Particle.publish("Event_name_for_when_the_garage_opens","OPEN");
        return 1;
  }
   
    else if  (command=="off" && val>4060) {

        digitalWrite(garage,HIGH);
        delay(100);
        digitalWrite(garage,LOW);
        Particle.publish("Event_name_for_when_the_garage_closes","CLOSED");
        return 0;
  }
  
  else {
      return -1;
  }
  }

Welcome Sign Code

C/C++
int light = D0; 

void setup() {
     pinMode(light,OUTPUT); 
     Particle.subscribe("Event_name_for_when_the_garage_opens",G1);
}


void loop (){}
 
 
void G1(const char *event, const char *data){
    { 
        delay(8000);
         digitalWrite(light,HIGH);
      delay(15000);
      digitalWrite(light,LOW);
      }
 }

Living Room Lamp Code

C/C++
int light1 = D3; 

void setup() {
     pinMode(light1,OUTPUT); 
    Particle.subscribe("Event_name_for_when_the_garage_closes",G1);
}

void loop (){}
 
void G1(const char *event, const char *data){
    { 
        delay(3000);
        digitalWrite(light1,HIGH);
      delay(30000);
      digitalWrite(light1,LOW);
      }
  }

Credits

Abdulmohsen Alsarraf

Abdulmohsen Alsarraf

1 project • 0 followers
Naser Alqattan

Naser Alqattan

1 project • 0 followers
Yousif Alsanea

Yousif Alsanea

1 project • 0 followers

Comments

Add projectSign up / Login