David BoiesNathan Dry
Published

Mail Box Activity Monitor - MEGR 3171 Spring 2018

Using two photons, a PIR sensor, IFTTT, google sheets, and a piezo buzzer, mailbox activity will be monitored and homeowner notified.

BeginnerShowcase (no instructions)8 hours1,217
Mail Box Activity Monitor - MEGR 3171 Spring 2018

Things used in this project

Hardware components

Photon
Particle Photon
×2
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Buzzer
Buzzer
×1
Breadboard (generic)
Breadboard (generic)
×2

Software apps and online services

Maker service
IFTTT Maker service
Google Sheets
Google Sheets

Story

Read more

Schematics

PIR Sensor

Buzzer Schematic

PIR Sensor- Actual

Buzzer- Actual

PIR Sensor in mailbox

Code

Photon with PIR Sensor

C/C++
int pirState = LOW;             //No motion detected
int val = 0;    
int inputpin = D0;             
int calibratetime = 5000;
int Mails_Here = 1;
int LED = D7;


void setup() {
pinMode(inputpin, INPUT);
pinMode(D7, OUTPUT);
Particle.subscribe("Received",Good_Receive, "2f0056000651353530373132");
}

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

void loop() {
    if (calibrated())
    {
    readthesensor();
    reportthedata();
    }}
    
void readthesensor() {
    val = digitalRead(inputpin);
    delay(10000);
}

bool calibrated() {
    return millis() - calibratetime > 0;
}

void reportthedata() {
    if (val == HIGH) {
        Mails_Here = Mails_Here;
        Particle.publish("Mail_Man", String(Mails_Here));
        delay(10000);
    }
    else if (val == LOW) {
        Mails_Here = 0;
    }
}

Photon with piezo buzzer

C/C++
int Buzzer = D0;
int state = 0;
int Good_Receive = 1;


void setup ()
{
    pinMode(Buzzer,OUTPUT);
    Particle.subscribe("Mail_Man",Mails_Here, "410041000e51353532343635");
}

void Mails_Here(const char *Mail_Man, const char *Mails_Here)
{
     Particle.publish("Received", String(Good_Receive));
      digitalWrite(Buzzer,HIGH);
      delay(100);
      digitalWrite(Buzzer,LOW);
}

Credits

David Boies

David Boies

1 project • 2 followers
UNCC Mechanical Engineering
Nathan Dry

Nathan Dry

0 projects • 1 follower
UNCC Mechanical Engineering Student

Comments

Add projectSign up / Login