home mailbox sensor

home mailbox sensor here!
To create a device that sends an email every time my mailbox is opened.

My roommates and I hardly check our mailbox. Sometimes, the mails stack up. After a while, the mails stack up. A simple device that alerts us about new mail would be helpful.

The goal is to create a device that sends an email every time my mailbox is opened.


The device uses an LED and a PIR sensor. Every time the PIR sensor detects motion, the LED lights up. The Particle photon is connected to the Wi-FI at home. So, the device sends an email notifying me about this event.


Particle Photon

PIR Sensor

LED ( Red ) : Motion Indication

1 Resistors 1k ohms

Jumper wires



This is my first IOT project. There are lots of room for improvement. For example, the time of day when a mailbox is opened could be used to make the sensor more efficient. The sensor can be dormant at night. The sensor and particle photon could be housed in a well designed box.

I look forward to creating cool home automation based projects in the future.

Stay tuned.

mail box sensor on our site!
I normally check my mailbox (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 mailbox 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.

The Xbee communication

Because I’m thinking this sensor will be just a component of a bigger mesh of sensors, I wanted to avoid using broadcast messages and direct my messages to a particular Xbee (so called the coordinator). I’m using the xbee-arduino library for doing this. For using API mode (i.e. this library) you will need to configure manually the Xbees on your mesh. In windows you can use the X-CTU application Digi provides to configure and update Xbee firmware. For mac, you can use moltosenso iron which is free and provides the basic functionalities to configure your Xbees. I use DFRobot Basic Breakout to program my microcontrollers, and it is also useful to configure the Xbee. I also use the Sparkfun’s Xbee Explorer Regulated to manage the 5V to 3.3 Voltage conversion is needed to power the Xbees. It’s also handy to plug some headers into the board that fit for example a breadboard. If you want to configure the Xbee using this two boards, you just need to connect the VCC of the Basic Breakout to 5V of the Explorer, GND to GND, RX of the Breakout to DOUT (CAREFUL: RX in the DFROBOT Breakout is actually TX), and TX to DIN. Doing this, you would normally get access to the Xbee configuration.

Once you have access to the Xbee on your computer, you need to set up the following parameters in your Xbee (this information is for Series 1 which I use):

For the coordinator:

PAN: 965 -> This is you network id, the number you use here should be use in all Xbees in the network for communicate with each other.
MY: 1000 -> This will be the 16-bit address of this particular Xbee.
CH: C -> This is the newtork channel, this value will need also to be the same for all Xbees in the network.
CE: 1 -> This indicates this Xbee is a Coordinator.
AP: 2 -> This indicates this Xbee will use API mode.

For all other Xbees the configuration would be the same except for:

MY: 1001 -> This will be the 16-bit address of this particular Xbee.
CE: 0 -> This indicates this Xbee is NOT a Coordinator.

More information here http://mailboxsensor.com/!

Вы можете оставить комментарий, или ссылку на Ваш сайт.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *