Cart 0

Raspberry Pi Doorbell & Letterbox Automation Project

Posted by LiveHouse Automation on

This was the first major Raspberry Pi (rPi) automation project I embarked on and learnt many things along the way.

This project was initially born out of a need to have an outdoor waterproof doorbell. There weren’t many on the market at the time and those that existed:
  • Couldn’t be integrated into my existing Z-wave home automation system;
  • Weren’t weather/waterproof
  • Only had one function (doorbell only) and no other functions like camera; and
  • If camera existed, it has a very low resolution.
The below figure shows the internal side of my external fence that houses the Raspberry Pi, doorbell and the parcel chute letterbox.

    (Click to see full size picture)

    What you need:

    • Raspberry Pi.
    • PoE Hat (bought one made by dotnetdan on eBay. It’s a Raspberry Pi Board with useful Prototyping Area.)

      (Click to see full size picture)

      • Waterproof Housing. I used a gutted aluminium housing from a Trendnet TV-IP322P outdoor camera. You could use anything for this.

      • Reed switch. I got a decent quality one since it needs to suit an outdoor application and may be subject to water/corrosion. It was about $24 for this quality.

      • Waterproof Metal Pushbutton with White LED Ring - 16mm White Momentary $8

      • rPi camera module $43 - you may need an extended ribbon cable depends on the housing you go for.

      • Shielded 2-core cable to/from the reed switch

      • Ferrite Bead to suppress any EMI the wires pick up.

      • 0.1μF Capacitor



      • Waterproof connectors - 2 Pin Way Car Waterproof Electrical Connector Plug with Wire. Got these on eBay (5 for $6)

      • Waterproof outdoors junction box

      This was $37 at Bunnings and if you aren’t restricted by space I would recommend one of these. I used it purely for the cable connections but you could just as easily use it to house the actual rPi as well. The only issue with that is you’d have to somehow run your camera module cable from the rPi to the point at which you wanted to take photo, and this can be challenging to make it waterproof.


      Surface mounted speaker ($25)

      • Audi amplifier to go with speaker above ($13.25). Stereo 3.7W Class D Audio Amplifier - MAX98306.


      There are two main codes here. “Doorbell” and “Letterbox”. The doorbell runs a while loop and as soon as it’s pressed it:
        1. Takes snapshot
        2. Email these snapshots
        3. Sends a notification of the event to PushOver and VERA

        PushOver is one of the several push notification services so you could choose which one to use. I have both PushOver and VERA notifications because I can tie it into another scene events and have the related voice alert be generated on a central tablet.

        Doorbell Script  - Download Script Here 

        Letterbox Script - Download Script Here 

        Tell VERA that someone pressed the Doorbell - Download Script Here 

        Snapshot Script - Download Script Here

        Tell VERA that there's something inside the Letterbox - Download Script Here

        Problems with Reed switch and signal error
        I have a 12V cable running, it has some house number lights with LED backlights on them.

        I began having a bizarre effect occur when the house light numbers came on, the letterbox reed switch on the letterbox flap was triggered (i.e. Closes the open circuit from the rPi).

        I couldn’t figure this out until, thanks to Antony, I tried a combination of hardware mods including installing a:

        • Shielded cable;

        • Ferrite beads; and

        • 0.1μF capacitor between the GPIO and Ground

        This seems to have solved the problem and if you have a similar occurrence, I would recommend doing the same in the first instance.

        If that fails, then look at software mods including:


        • Modifying script to check the value of the GPIO for HIGH/LOW after it's been initially triggered. ie. Event, wait (5 ms), check GPIO again and if still tripped then process your action.

        • Change to the PIGPIO library - it has additional functions for setting noise filters on a GPIO.

          (Credit to Antony again for these recommendations). 

          Future and improvements

          • Video from the rPi camera to inside tablet
            I want to be able to do this so that when a person press the doorbell, it will instantly stream a live video from the rPi camera into the indoor kitchen tablet. There is a wall switch at this location which un-latches the gate lock so if it is armed with the video stream the user can then decide whether to open the momentary gate lock or not.

          • Bigger speaker
            The surface mounted speaker works “okay” however, being an outdoor application and requiring a decent amount of amplification, this wasn’t really suitable. Note that a Stereo 3.7W Class D Audio Amplifier - MAX98306 was used, I would perhaps need to look at alternative amplifier since this one might be the reason for the issues.

          • On/off functionality
            During this project, I managed to fry an SD card as a result of disconnecting the power supply abruptly from the rPi. I have plans at some point to somehow deliver a shut-down sequence code to the rPi from a switch to avoid this from happening again. I can always add the VNC to the rPi and shutdown anytime I have to disconnect the Ethernet/power, but this can be a bit cumbersome.

          • Motion sensing input
            The beauty of having a central rPi in a location like this is that multiple sensors can be used. Originally I integrated a motion sensor in the front face of the gutted IP camera (side-by-side with the rPi camera module) but things got very crowded so I ended up removing it. In the future, I could perhaps relocate this motion sensor and have it operating in an independent location. I’ve already written the script for this and the motion trigger could be used to run scenes to the Vera such as the front lights turns on if it’s night time, or when photos are taken.

          • Snail-Mail Sender Identification
            Another thing is when a snail mail has arrived; it’s important to know who sent it over. With a low light camera built into the parcel chute I can imagine the possibility of taking a photo of the package and (assuming orientation is in favour) then applying text recognition software to know where the letter came from.


          Final thoughts

          Despite the problems I’ve encountered along the way, this project has been quite rewarding and I think with a front fence quite far away from the main house, it has been “comforting” knowing that I am aware of the things that has been happening at this location from inside the house.

          I’ve also found it useful to know when urgent deliveries have landed or who has arrived at the house, no matter where in the world I am. 
            By Jeremy Goodchild. 


            Share this post

            ← Older Post Newer Post →