Mailbox Delivery Notification System

Updated 07 February 2024

Introduction

  • During the Covid lockdown, I needed something to do. The Postman or woman does not deliver mail every day as most bills come online. So I built this to notify me when the Postman or woman has been.

This is the insert I built to fit in my mailbox and it houses the Infrared Proximity sensor. I then have a 4-wire telephone cable (I am ex-Telstra) in the garden that runs to a small shed next to my carport that has a power point in it. This 4-wire cable connects to an Arduino ESP8266 that has a USB plug pack to power it.

When a letter falls on the sensor it triggers the Arduino to connect to my Wifi and send a message using IFTTT, the code will sit in a loop until the letter is removed and then re-arm itself for the next letter.

 

Components:

 

 

 

Pinout & Connection Diagram

SEN0556 Proximity Sensor Pinouts

Colour Name Descriptions
Red VCC Power +
Black GND Power -
Green OUT Signal Output

Build

Mount for the Proximity sensor are some 3D printed keyboard stands that I printed for my iMac keyboard but did not use so I used them here. But any sort of wedge would do the same thing either plastic or wood.

The insert enclosed before installing in the mailbox.


The Arduino ESP8266 box that hangs in the shed.


Code

I wrote my Arduino code and tested that with a different Proximity Sensor and I had a lot of problems with false notifications. I think there were spiders in the box, the spider webs blowing in the breeze and maybe moisture in the air, so when it went off at 2:00 in the morning my wife was not very happy. I am now using the SEN0556 IR Proximity Sensor and there are a few versions. I think that this sensor being waterproof will help and it seems to be more accurate than my original. Here is the final version I am using now, it is currently stable, only time will tell.

//
#include 
#include 
#include 
// Set IFTTT Webhooks event name and key
#define KEY “###############”
#define EVENT "Mail_box"
Webhook webhook(KEY, EVENT);    // Create an object.
// Set GPIO 4 or D2 as input
#define SENSOR 4
//int SENSOR;
#define DEBUG true
#define Serial if(DEBUG)Serial
void setup()
{
  Serial.begin(115200);
  Serial.println();
 
  pinMode(SENSOR,INPUT);
}
void loop() 
{
  
   short val=0;
   val=digitalRead(SENSOR);
    Serial.println("Wait for mail");
    Serial.println(val);
    //Serial.println();   
    delay (1000);
    
    if(1==val)
    {
      for (int i = 0; i <= 1; i++) {
    
    //delay(2000);
   // Serial.print("val=");
   //Serial.println((int)val);
    val=digitalRead(SENSOR);
    if(0==val) {
    goto bailout; 
    }
    
    
  }
    Serial.println("Sensor is triggered!");
    // Connect Wifi 
  WiFi.begin(“SSID”, “Passcode”);
  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();
  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
  
   Serial.println("Sending WebHook");
   // Send Webhook to IFTTT
 delay(1000);
  // Trigger without any value and get response.
  int response = webhook.trigger();
  if(response == 200)
    Serial.println("OK");
  else
    Serial.println("Failed");
  
  delay (2000); 
 WiFi.disconnect();
 Serial.println("Wifi Disconnected");
 //delay (1000);
 //If mail sitting on Sensor, loop until cleared.
 while (val==1)
  {
    val=digitalRead(SENSOR);
    delay(1000);
    Serial.print(".");
    //Serial.println((int)val);
    
  }
    }
    bailout:
    delay(100);
  }

IFTTT

Using ifttt.com, create a login and do the following. 

Conclusion

In summary, I am 67 years old and these were all new skills for me, learning to code in Arduino, and learning how IFTTT functioned but Google is a great thing for ideas. I had 39 years of service with Telstra as a Technical Officer, 14 years in Telephone maintenance, and 25 years in IT with exposure to X25, Novel Netware, and Unix of many varieties as a System Admin, and have been retired for 10 years after being retrenched.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.