Harrison Murray
Created April 19, 2016 © MIT

Door Alarm

IOT System to monitor in real time the statues of a door

IntermediateShowcase (no instructions)12 hours219
Door Alarm

Things used in this project

Hardware components

Adafruit Magnetic Contact switch
×1
Photon
Particle Photon
×1
Prototype Board
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Project Box
×1

Software apps and online services

Maker service
IFTTT Maker service

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit Diagram

Code

Door Alarm Code

Arduino
This was the code written in order to communicate the response of the magnetic sensor to the Particle Photon.
int DAP = D0;
int DAR = D1;
int boardLed = D7;

void setup() {

pinMode(DAP,OUTPUT);
pinMode(DAR,INPUT);

    digitalWrite(DAP,HIGH);

  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);

}

void loop() {

while (Particle.connected()){

if(digitalRead(DAR)==LOW){

Particle.publish("doorStatus","DOOR OPEN",60,PRIVATE);
delay(2000);
}
else{
    delay(400);
}
}
}

Credits

Harrison Murray

Harrison Murray

1 project • 1 follower
UNCC Mechanical Engineering student

Comments