For a few weeks I kept tweaking and playing around with my new mailbox event notifier, based on Moteino. It all started as a joke, then when I saw it actually works, I decided to beef it up and do a writeup and a video:
UPDATED hardware for this project: I modified the circuit and added an enclosure and battery voltage readings. Also a standalone LCD receiver. More details here. The rest of this post is for reference only, you should follow the details in the new post.
UPDATED Schematic: For stability you should add a 10K pull-up resistor between the OUTPUT and POWER pins of the hall effect sensor. I omitted that in the video and added that later. Also a battery POWER switch is very helpful. You should always disconnect POWER from the battery when you try to load the program to Moteino using your FTDI adapter!
The details are simple. A hall effect sensor detects a magnetic field from an earth magnet. The earth magnet is placed inside the mailbox, while the Moteino/sensor/battery pack sits on the door. When the door is opened, the magnetic field is interrupted, the sensor flips state and the Moteino sends a “DOOR OPEN” message, or “DOOR CLOSED” when it’s closed.
The hall sensor uses ~2.5mA of power which is a lot for low power battery operation. So I added a 2N3904 NPN transistor (driven from a digital pin through a 2K resistor) to switch the sensor off when it’s not being used. When I need to read the hall sensor, I just turn on the transistor, read the sensor value, then turn it back off. That brings the total power consumption down to to an average of about 60uA, so the 9V battery should last a long time. To save power overall, the Moteino “sleeps” most of the time and only checks for events every 250ms using an interrupt timer. Every ~5s it reports when the mailbox door was last opened and last closed. This way I can distinguish between these 2 events and tell if the door was left open , or if someone else is messing with my mailbox.
The receiver simply runs my RFM12B receiver sketch. It passes incomming messages through to the serial output. I can capture that on a PC or a RaspberryPi, running a python script which sends me an email or SMS message when a DOOR-OPEN message is received. This works great. To send an SMS, I simply send an email to my cell carrier sms mailbox, in my case that is firstname.lastname@example.org
The python code to send an email/sms from python, and the arduino sketches that run on the sensor side and receiver are in my GitHub repository.