wireless mailbox sensor

I normally check my wireless mailbox sensor (snail mail) every day before entering my apartment. One day I thought “Wouldn’t it be nice if I know if I have new letters without having to check the mailbox?” That’s how I came up with the idea to install a wireless sensor that will notify me when somebody leaves something from me in the mailbox.

The idea itself it’s nothing new and it’s very common among Arduino enthusiasts. What I think is unique is the combination of tools I used (or at least I couldn’t find a similar solution to the setup I have).

In this posts I will just describe the wireless mailboxsensor.com sensor. It’s basically one home-made Arduino (you can see this post on how you can build your own one) with an Xbee Series 1 transmitter and a couple of sensors: A DFRobot DFR0028 Tilt Sensor and a Snap-Action switch (similar to this one).
The tilt sensor will detect when a new letter arrives and it’s placed in the small cover of the mailbox. It will trigger when the mailbox lid is lifted. Originally I thought of having a light sensor in there, but it was just easier to have an on-off sensor because I only need to recognize these two states. The snap-action switch will detect when I open the mailbox with the key (to reset the detection) and it’s placed right where the lock mechanism is resting. The snap-action switch is normally closed and when I use the key and rotate the lock mechanism, the switch will open, thus triggering the sensor. Every time a sensor is triggered, the Arduino will send a message to the coordinator (i.e. another Arduino I have in my apartment also with an Xbee attached).

The power source

I started my prototype based on this post from the adafruit forum. It also provided me with a solution to run the sensor on batteries. Originally I had no idea how to deal with that. 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. This way, the Arduino will wake up every time a sensor triggers, the it will give some power to the Xbee and send the corresponding message, then cut the power again to the Xbee and finally it the will go back to sleep.

.