Who wants to go outside to see if the mail has arrived? In the cold winter or rain I’d rather not have to put on a jacket and shoes, only to find that there was no mail. This project will notify you of the mail carrier’s visit, and as a secondary function it will remind you that the garage door has been left open. It can even be expanded to include other sensors
Step 1: Schematic
The project is based on the Atmega 168 chip. Since the design requires only minimal resources, most of the AVR chips would be acceptable substitutes. But having extra resources means adding functionality is easier than a redesign.
The device contains only a minimum number of parts (see schematic) .
The design has two sensors, the Garage door magnetic reed switch, and the Mailbox Light Dependent Resistor (LDR).
Step 2: Design
Garage Door feature
The garage door sensor is a magnetically operated reed switch. The magnet is placed on the garage door and is in close proximity to the reed switch when the door is fully closed. I chose a reed switch since it was easier to accommodate the loose mechanical tolerances of the garage door’s movement.
When the garage door opens, the magnet moves away from the switch. The switch opens which signals the microcontroller to turn on the LED and gives a short beep. This is so simple, you may ask “why bother using a microcontroller when a simple circuit will accomplish the task. But here’s where the power of the microcontroller can be quickly applied to make a more useful device without changing any hardware. What I really wanted was a feature to remind me when I forget to close the door. If the door opens and stays open for an hour, I probably forgot to close it. I may not notice the LED, so at that point it will beep once every 10 minutes to get my attention until I close the door.
I used a Light Dependent Resistor (LDR) for the mailbox sensor. Once again I could have used a mechanical switch, but I was concerned with the loose mechanical tolerances of the door hinge. I wasn’t convinced that I could get the switch to operate reliably with a wobbly door. The LDR works great and is easy to install in the back of the mailbox. When the door is closed it reads as a very high resistance - several mega ohms , and about 10K when the door opens – even on an overcast day. If it’s the middle of the night it probably won’t register, but the mail carrier doesn’t come then anyway.
The handling of the mailbox is significantly different from the garage door. The Mailbox is only active for a second or two, but I want to remember that an opening was detected, beep the speaker once and then keep the LED illuminated until I reset it – or it will automatically reset after 8 hours.
Since there are several more analog and digital pins available on the AT Mega chip, so I could definitely see adding more features to my little project. One idea would be a light beam and LDR sensor mounted on the path to the front door, so I could get advance notice of someone approaching the house. Any suggestions?
Step 3: Project Case and Wiring
I wanted a small case to mount the circuit board, and I found a used surface mount RJ45 Box that is just the right size for my project. I installed the LEDs and the reset button so that they would extend up through the top of the case - this means that the case can be removed without any connecting wires.
This is the unfortunately the most time consuming part – running a pair of wires out to your mailbox may be a bit of a hassle. I would recommend using either a twisted pair or shielded cable. This will reduce any stray electromagnetic fields from causing an induced current in your wiring which would upset the microcontroller. I had a sufficient run of coaxial cable on hand, so that's what I used.
My mailbox is at the end of my driveway - perhaps 40 feet from the house. I was fortunate in that when I had my driveway re-paved, I ran the wire under the concrete before it was poured, so that saved me a lot of digging.
Then there is the matter of the wiring through the house which may also be time consuming.
Hummm.... perhaps a wireless solution...
Step 4: Source Code
Here's the source code - it's short and simple.
.PDE files are Arduino source code files (they call them 'sketches' for some reason) - It's almost identical to 'C'.
You can view the code by downloading and opening in a text editor.
Updated Feb 14, 2011 Workaround for compiler math bug. and change mailbox tones to ascend in frequency
Newer versions of the Arduino development system use the .ino extension instead of .pde so just rename the file.