Snail mail notifier project
January 23, 2011
Initial thoughts
Got a new mailbox, and I got the choice of putting a switch on the lid or something longer in.
My previous one had a switch on the lid, but this time, I am going for something longer inside.
How to sense new mail
To trigger when new mail arrives, I ordered 5 of these Universal 3A Microswitch With Long Arm Micro Switches.
Switch details

The reason I chose these is that with the arm on, they are very sensitive to the smallest weight touching the arm.
Inside the mailbox they are going to be mounted with the arm pointing upwards, on a little slope, so the mail will slide down and hit the arm before falling down inside the storing compartment inside the mailbox.
To mount them, I am making a bracket like this, where I can screw the switches on each side of it.
Mailbox Arduino
Sourcecode
#include <VirtualWire.h> //Constants const int buttonPin = 0; // Interrupt 0 = digital pin 2 const int debounce = 3000; // How long debounce we want before sending a new message about mail arrived //Variables unsigned long lastMail = 0; // Store when the message was send last time void setup() { pinMode(buttonPin, INPUT); // Set pinmode as a input attachInterrupt(buttonPin, mail, HIGH); // Attach the interrupt pin connected to the switch } void loop() { //We don't need to loop anything } void mail() //Will be used when the interrupt on digital pin 2 is triggered { if (millis() - lastMail >= debounce) // Debounce { lastMail = millis(); //Store when this last triggered rfSend("mail"); } } void rfSend(String message) { digitalWrite(13, HIGH); char output[100]; message.toCharArray(output, 99); vw_setup(1000); vw_send((uint8_t *)output, strlen(output)); vw_wait_tx(); // Wait for message to finish vw_setup(40); digitalWrite(13, LOW); }