This instructable will show you how to make a web-connected mailbox sensor. Besides emailing you when your http://mailboxsensor.com/ is opened, it will also signal a Raspberry Pi sitting in your house to play an audio announcement. There is also a web-accessible Android/iPhone interface for you to check what time mail was delivered, as well as display the battery voltage left on the sensor.
But this could also easily be used as a web-connected security system, one that both plays an audio alarm in your home and emails you when the someone breaks into your house.
Under normal use (a few door openings per day), the battery powered mailbox Arduino should last over a year on a set of 4xAA batteries. The mailbox sensor has a range of over 700 feet through multiple walls, so this should work for most situations.
One strip board Arduino, circuit optimized for low battery power consumption
Strip board components (voltage regulator, capacitor, resistors, etc…), see details later on.
Two wireless transceivers (RFM69HW)
Two Arduino Uno’s with selectable 3.3V/5V switch for the gateways
One Raspberry Pi, but could be replaced with your PC/Mac if you don’t mind running the computer 24/7
I’ll explain how to piece all these parts together and provide all the code needed.
The simple setup should not consume a lot of power, but the Xbee could, so the idea from this guy was to cut the Xbee power when it’s not sending anything, and only power it up when you need to send something (BTW, that implies one-way communication, which I don’t like since I want to be able to reset the mailbox not only with the key, but also remotely, but I will try to achieve this on a further version of the sensor). Another tip from that same post to save some power, was to put the processor to sleep when is not doing anything. Basically the atmega328 has the capability to be put to sleep, and be woken up by interrupts in two pins (2 and 3). More information about this here.