
I have a fairly old house (built in 1958) in which the mailbox is just a "hole in the wall". Mail ends up in my meter cabinet, which is of course behind a door. That's also where the Raspberry Pi running Domoticz resides, so I decided to build a simple snail mail notifier.
To minimize the risk of mail not being detected I used two sensors. The placement of these sensors is such that they cover most mail sizes; only very small leaflets can sometimes be missed. You could of course add more sensors, but for me this sufficed.


I used simple and cheap China-sourced IR sensors (search for "ir avoidance sensor" on AliExpress and you'll find lots of them). The sensors that I have output an "active low" signal. I therefore made a simple NAND circuit (the middle board) to combine them into one "active high" output. The power just comes from the Pi's 3.3V rail, so I could hook up the output directly to a GPIO pin.
Don't forget to enable the GPIO pin during startup of your Pi. I added the following to /etc/rc.local:
Code: Select all
LOGPREFIX="`basename $0`[$$]:"
# GPIO 17 (sensor brievenbus)
# Input, active high, pulldown, trigger both edges
logger "$LOGPREFIX Enabling GPIO 17"
echo 17 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio17/direction
echo 0 > /sys/class/gpio/gpio17/active_low
echo both > /sys/class/gpio/gpio17/edge
raspi-gpio set 17 pd
And that's it; now my phone notifies me whenever there's mail
