John FraelloMax BarattaKateland Wilhite
Published

Open Door Detector

Keep your peace of mind by knowing when someone is entering your home.

BeginnerFull instructions provided3 hours181
Open Door Detector

Things used in this project

Hardware components

Argon
Particle Argon
×3
Breadboard (generic)
Breadboard (generic)
×3
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×2
Acxico Laser Transmitter/Receiver
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Photo resistor
Photo resistor
×1
Resistor 330 ohm
Resistor 330 ohm
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Maker service
IFTTT Maker service

Story

Read more

Schematics

Laser Emitting Circuit

Laser Emitting Circuit

Laser Receiving Circuit

Laser Receiving Circuit

Data Acquisition Circuit

Data Acquisition Circuit

Google Sheets Data

Code

Laser Emitting Code

Arduino
int laser = D4; 
int ledstate=LOW; 


void setup() {
 
  pinMode(led, OUTPUT);
  pinMode(laser, OUTPUT);
  pinMode(buzzer, OUTPUT);
  Particle.subscribe("jmfraello", Heisenberg, ALL_DEVICES);
  Particle.subscribe("mbaratt1", Rick, ALL_DEVICES); 
    
}


void loop(){
     
digitalWrite(laser, HIGH);

ledstate= digitalRead(D7);

if (ledstate == HIGH){
 

}
}   


int Heisenberg(const char *event, const char *data) 
{
    if(strcmp(data, "Door Open")==0){
        digitalWrite(led, HIGH);
        Particle.publish("mbaratt1", "broken"); 
      
    }
    else if (strcmp(data, "Door Closed")==0){
        digitalWrite(led, LOW);
        Particle.publish("mbaratt1", "intact");
    }
    else{
        
    }
}

int Rick(const char *event, const char *data)
{
    if(strcmp(data, "broken")==0){
        
    }
    if(strcmp(data,"intact")==0){
        
    }
}

Laser Receiving Code

Arduino
int phor = D2;
int lastsensorreading = LOW;
int sensorreading = LOW;
int val;
int bing = D4;

void setup() {
pinMode(ledwr, OUTPUT);
pinMode(led, OUTPUT);
pinMode(phor, INPUT_PULLUP);
Particle.subscribe("jmfraello", brokenfunc, ALL_DEVICES);
Particle.subscribe("mbaratt1",doorfunc, ALL_DEVICES);
Particle.subscribe("katelandw", dataaquisitionfunc, ALL_DEVICES);


{void loop()
    {lastsensorreading = sensorreading;
    sensorreading = digitalRead(phor);
    val = digitalRead(bing);    
    if (sensorreading == LOW && (lastsensorreading == HIGH)) {
        Particle.publish("Heisenberg", "Door is Closed");}    
    if (sensorreading == HIGH && (lastsensorreading == LOW)) {
     Particle.publish("Heisenberg", "Door is Open");
    }
    else {
        
    }
}

int brokendoorfunc(const char *event, const char *data)
{
    if (strcmp(data,"Door Open")==0){
      
    }
    else if (strcmp(data, "Door Closed")==0){
        
    }
    else{
        
    }

Data Acquisition Code

Arduino
This code is communicating with the laser emitting circuit to then have a notification sent to a phone when the door it is attached to is opened.
void setup() {

}

void loop() {

}

    
  Particle.subscribe("jmfraello", heisenberg, ALL_DEVICES);
  Particle.subscribe("mbaratt1", rick);
  Particle.subscribe("katelandw", KupKake, ALL_DEVICES);
  
}


void loop() {

   if(val == HIGH){
        }
            
     else{
         
       }
       
}


int brokendoorfunc(const char *event, const char *data)
    {
     
    if (strcmp(data, "Door Open") == 0){ 
         digitalWrite(led, HIGH);
         Particle.publish("jmfraello", "alarm");
         Particle.publish("mbaratt1", "1");
    
    }
     
    else if (strcmp(data, "Door Closed") == 0){ 
         digitalWrite(led, LOW);
         Particle.publish("jmfraello", "safe");
         Particle.publish("mbaratt1", "Alarm Off");
    }
     
    else{ 
        
    }
    
}


int fhawkinsiftttfunc(const char *event, const char *data)
    {
    }


int alarmonfunc(const char *event, const char *data)
    {
        
     if (strcmp(data, "Alarm On") == 0){ 
     
    }
     
     else if (strcmp(data, "Alarm Off") == 0){
        
     }
     
    else{
        
    }
    
}

Credits

John Fraello
1 project • 0 followers
Max Baratta
1 project • 1 follower
Kateland Wilhite
1 project • 1 follower

Comments