Drop me a line

Made by K P ·

Use this IoT to remove the guesswork and anticipation for when your mail arrives by getting pushed notifications sent to your smartphone.

Created: January 29th, 2016

0

Intention

A common and frequent homeowner problem is anticipating when mail will arrive. Taking inspiration from complaints about having to check mail unnecessarily, I realized there was an opportunity to create a solution that removes the guesswork if and when mail has been delivered. Mailmen arrive at different times everyday, creating confusion and additional effort for recipients to check for their mail. This solution provides a way for mail recipients to save the time spent checking their mailbox repetitively or unnecessarily before the mailman arrives.  

0

Goal

The goal is to create an IoT device to monitor mailbox activity. The smart mailbox removes the guesswork about when mail is delivered.

0

Process

You will need:

1 Breadboard

1 photoresistor

1 PIR sensor

10 – Jumper wires

1 – Red LED

1 – Green LED

2- 1kΩ Resistor

1 - 10kΩ Resistor

0
Circuit Diagrams
Circuits.thumb
0
Code
//Want to set a variable for photoCell and set it to map to A0
    int photoCellPin = A0;

    //Create a varibale to store readings from the photoCell
    int photoCellReading = 0;

    //Set a varible for LED that maps to D0
    int ledPin = D0;

    //threshold of being covered
    int threshold = 3000;

    //Create a varible that will track and store brightness of the LED
     int ledBrightness = 0;

     //Define LED on pin D1
     int ledPIR = D1;

     //Define the PIR sensor on D7;
     int PIR = D7;

     //store PIR readings
     int PIRReading = 0;
     int pirState = LOW;             // we start, assuming no motion detected
     int val = 0;                    // variable for reading the pin status

     int calibrateTime = 1000;  // wait for calibration

     //track publishing process
     bool published;

     long publishTimeout = 60000;
     long lastPublishTime = -60000;

 void setup ()
 {
   //Configure D0 pin as output
   pinMode (ledPin, OUTPUT);

   //create a cloud variable interger called light that is mapped to the photoCellReading
   Particle.variable("light", &photoCellReading, INT);

   Serial.begin(9600);

   // set ledPIR pin to output
   pinMode(ledPIR, OUTPUT);

   //set ledPIR pin to input
   pinMode(PIR, INPUT);

   //ledPIR is on
   digitalWrite(ledPIR, HIGH);

   //ledPir is off
   digitalWrite(ledPIR, LOW);

   // set the timezone to EST!!!
   Time.zone( -5 );

   Serial.begin( 9600) ;

 }

 void loop ()
 {

   //Use the analogRead to provide photoCellReading
   photoCellReading = analogRead(photoCellPin);


   if(photoCellReading < threshold){
     digitalWrite(ledPin, HIGH);
   }else{
     digitalWrite(ledPin, LOW);
   }
   Serial.print("Analog reading = ");
   Serial.println(photoCellReading);

   //Make LED brighter, the darker the sensor is
   photoCellReading = 4095 - photoCellReading;

   //ledBrightness = map( photoCellReading, 0, 4095, 0 , 255 );

   //fade LED to desired brightness
   //analogWrite(ledPin, ledBrightness);

   //wait for x seconds and then loop
   //delay(100);

    //motion detection, then turn LED on as an indicator
    // if the sensor is calibrated
    if ( calibrated() )
    {
      Serial.println( "calibrated and reading" ) ;

    // get the data from the sensor
      readTheSensor();

      // report it out, if the state has changed
      reportTheData();
    }


    //wait for 5 seconds delay before reading again
    delay(500);
}



void readTheSensor() {
  val = digitalRead(PIR);
}

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

void reportTheData() {

  // if the sensor reads high
  // or there is now motion
  if (val == HIGH) {
      Serial.println( "there's motion" ) ;

    // the current state is no motion
    // i.e. it's just changed
    // announce this change by publishing an eent
    if (pirState == LOW) {
        Serial.println( "changed" ) ;
      // we have just turned on
      // Update the current state
      pirState = HIGH;

      if (Time.hour()>=6 && Time.hour()<=18 && (lastPublishTime + publishTimeout) < millis() ){
        Serial.println( "announcing" ) ;
        Particle.publish("kpanchma/s16/motion", "You've Got Mail");
        lastPublishTime = millis();
      }

    }


  } else {
    if (pirState == HIGH) {
      Serial.println( "used to be high" ) ;
      // we have just turned of
      // Update the current state
      pirState = LOW;
    }
  }

  digitalWrite( ledPIR , pirState );
}
Click to Expand
0

Outcome

When the motion sensor detects the mailbox opening between 6 am - 6pm, it will send a notification to the mail recipient notifying them of mail. The Red LED will turn on when motion is detected.  The Green LED becomes brighter at nightfall with the use of the photocell and only turns on if motion was detected between 6 am - 6pm. 
0
Mail Delivery Demo Video
k4n56jk - https://youtu.be/i5gEWeLF31I
0
IFTTT Notifications
Mail notification.thumb
0

Reflection

There are many things in our everyday lives that still require human conscious effort. However, any of these daily tasks can be simplified by unloading decisions, work and guesswork onto IoT technology. By introducing aspects such as the photoreceptor, gives an opportunity to tweak notification delivery. For example, if recipients check mail at nighttime when arriving home from work, the user can glance at the photoreceptor LED (that is turned on if motion has been detected during the day time and if it is dark out). This provides a glanceablility and decreased effort from the user. If I could perform things differently, I would want to make this device self – sustainable and implementable.
x
Share this Project

This project is only accessible by signed in users. Be considerate and think twice before sharing.


Courses

49-713 Designing for the Internet of Things

· 4 members

This course charts the emergence of the now "connected world" to explore the possibilities for future products and connected spaces.


About

Use this IoT to remove the guesswork and anticipation for when your mail arrives by getting pushed notifications sent to your smartphone.