My mailbox is on the gatepost, and the erratic timing of mail deliveries round these parts means sometimes several trips per day out in the pouring rain to check if there is mail. I built a detector from a Velleman kit to let me know when there was mail in the box, and this is how I did it.
The Velleman kit is an MK120 IR light barrier kit, available from Maplins in the UK and a number of other suppliers for around £10. It creates an infra red barrier, and sets off a squawker when the beam is broken. The kit needs to be soldered together, and for my purposes I needed to modify the kit slightly, as follows:-
1. make the infra red LEDs separate from the circuit boards
2. remove the squawker and replace it with a bright LED
3. also make the device send a signal to my Arduino based monitoring system.
First, the easy part - mounting the circuit boards in a weather-proof box. I had a spare aluminium box left over from another project and simply marked out the position of the holes and drilled and tapped them, then mounted the circuit boards on small plastic spacers to ensure that they couldn't touch the box.
The wires all come through the bottom of the box, and I put rubber grommets in the holes to seal them from the weather and stop the cables from chafing against the edges of the holes. Once all the holes were drilled, I sprayed the box and lid with satin black from an aerosol can.
In the picture, the green and yellow cables are the feeds to the IR LEDs, the other loose wires feed the LEDs that are fitted into the lid of the box.
To mount the LEDs remotely from the circuit boards I used a short length of coaxial cable (from and old audio lead) for each one. I tried CAT5 twisted pair cables and they were very prone to false alarms, I think because they picked up noise from each other and from the power cable - the coax solved that problem.
The LED end of these cables is exposed to the weather, so I encapsulated the end of the cables and the soldered connections in epoxy resin.
The 'mail waiting' alert is a bright orange LED that is fixed into the lid of the box (drill a 5mm diameter hole and secure the LED in it with a dab of super glue) with a short length of flexible cable to connect it to the squawker connection on the PCB. Note that a 220 ohm resistor is used to limit the current to the LED, and the LED was selected to give a bright light from around 5 volts - the box sits in direct sunlight most of the day, and a standard brightness LED can't be seen easily. Keep the unused squawker in your spares box for another day :-)
To seal the box from the weather I ran a small bead of silicone sealer around the edge of the lid and screwed it down tight. The sealer gets squeezed out of the joint, so the excess needs to be cleaned off before it dries (scrape most of it off with a screwdriver, then scrub it down with a wet cloth)
I feed the device with power from a central 12 volt power supply fitted in my central Arduino box, and a second (green) LED fitted into the lid of the box shows that power is present. This power supply also feeds the water leak detectors in the house (more on these later). The Velleman kit is designed to run on a 9 volt PP3 battery, but will happily work on 12 volts. When I built the house, I had a duct laid under the driveway to the gatepost and laid both CAT5 cabling and a mains power cable in it, so power is fed to the mailbox via the CAT5. This is not ideal, as the long cable run means that the voltage drops considerably and the 12v at the power supply ends up being around 8v at the mailbox. I plan to modify the power supply to fix that, although the mail detector works fine at this low voltage.
The same CAT5 cable also lets me feed the 'alert' signal back to the Arduino so that I can see on a screen in the house if there is mail in the box. I originally tried just using the raw output from the squawker connections, but could not get the Arduino to reliably read it, then realised that this was because the power supply is separate from the Arduino - instead, I use the squawker output to fire a small 5 volt relay which switches a connection between the Arduino's own 5v power rail and the data pin which monitors the mailbox status. Works a treat, although the low voltage sometimes makes the relay chatter instead of latching solidly.
My mailbox is a simple tin affair with an opening door at the front. I mounted the LEDs into some short plastic tubes glued to an aluminium plate across the back of the box, and angled in towards each other at around 45 degrees. A cheap make-up mirror is fixed to the inside of the door with double sided tape and reflects the beam when the door is closed. Drop a letter into the box and the beam is interrupted and the warning light comes on. Hooray!
It works fine, I just need to jack up the power a little so that the relay latches reliably. No more abortive trips in the rain out to the gatepost for me!