Wyatt SullivanSam DixonAlex Baber
Published

Welcome Home :)

Our project helps you keep piece and mind while having a motion-activated sensor at your front door.

IntermediateFull instructions provided181

Things used in this project

Hardware components

Argon
Particle Argon
×3
Breadboard (generic)
Breadboard (generic)
×6
Jumper wires (generic)
Jumper wires (generic)
×40
Standard LCD 16x2 with Extras
×1
Resistor 220 ohm
Resistor 220 ohm
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×2
Mini Photocell
×1

Software apps and online services

Maker service
IFTTT Maker service
Google Sheets
Google Sheets
Particle Build Web IDE
Particle Build Web IDE
Fritzing

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

LCD Screen Circuit

PIR Sensor Circuit

Photocell Circuit

Code

3PHOTOCELL_LED CODE

C/C++
This code uses a photocell to sense a major decrease in light as the LED moves away when the door is opened. From there, it publishes a "door-open" event for 1LCD_LED_BUZZER to subscribe to.
int led1 = D7;
int photocell = A0;
int analogValue;

void setup() {

  pinMode(photocell, INPUT);
  pinMode(led1, OUTPUT);

}

void loop() {
  
  analogValue = analogRead(photocell);
  
  if (analogValue < 100) {
      Particle.publish("door-open", PRIVATE);
      digitalWrite(D7, HIGH);
      delay(2500);
      
  } else {
      digitalWrite(D7, LOW);
      delay(3000);
  }

}

2MOTIONSENSOR

C/C++
This code uses a PIR motion sensor to detect motion and publish a "motion-detected" event for 1LCD_LED_BUZZER to subscribe to.
int motionPin = D0;      
int motionsensorInput = 0;      
int temp = 0;

void setup() {
pinMode(D0, INPUT);

delay(5000); 
}

void loop() {
 motionsensorInput = digitalRead(D0);  
 if (motionsensorInput == HIGH){	       
    Particle.publish("motion-detected", PRIVATE);   
    delay(4000);
  }
  else {
      delay(1000);
  }
}

1LCD_LED_BUZZER CODE

C/C++
This code uses an LCD screen and LED to subscribe to the "motion-detected" event to display a message and blink an LED. It also uses a buzzer to subscribe to the "door-open" event and buzz for auditory notification
// This #include statement was automatically added by the Particle IDE.
#include <LiquidCrystal.h>
// This #include statement was automatically added by the Particle IDE.
#include "LiquidCrystal/LiquidCrystal.h"

LiquidCrystal lcd(5, 4, 3, 2, 1, 0);

int buzzPin = D6;
int ledPin = D8;

void setup() {
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print ("STARTING");
  delay(3000);
  lcd.clear();
  pinMode(D6, OUTPUT);
  pinMode(D8, OUTPUT);
  Particle.subscribe("motion-detected", motiondetected, MY_DEVICES);
  Particle.subscribe("motion-detected", screenprint, MY_DEVICES);
  Particle.subscribe("door-open", buzzer, MY_DEVICES);
}

void loop() {
    lcd.setCursor(0,0);
    lcd.print("CLEAR");
}

void motiondetected(const char *event, const char *data) {
    digitalWrite(D8, HIGH);
    delay(1000);
    digitalWrite(D8, LOW);
    delay(1000);
}

void screenprint(const char *event, const char *data) {
    delay(1000);
    lcd.clear();
    delay(1000);
    lcd.setCursor(0,0);
    lcd.print("MOTION DETECTED");
    delay(1000);
    lcd.clear();
    delay(1000);
}

void buzzer(const char *event, const char *data) {
    beep();
    delay(1000);
    digitalWrite(D6, LOW);
}

void beep() {
    tone(D6, 3000, 4000);
    delay(50);
}

Credits

Wyatt Sullivan

Wyatt Sullivan

1 project • 0 followers
Sam Dixon

Sam Dixon

1 project • 0 followers
Alex Baber

Alex Baber

0 projects • 0 followers

Comments

Add projectSign up / Login