Mailbox Activity Notifications

Last year I started thinking about making this little gadget to let me know when the postal worker drops my mail in the box.  My mailbox is about 40 ft (~13 m) from my front door, and down a hill, so my Ring doorbell doesn't always catch it when it's dropped  - though it does seem to catch every other car on earth going by...

Anyway, rather than walk down to the mailbox multiple times a day looking for mail I though it would be easier if the mailbox notified me when someone opened, then closed it.

That's where my gadget comes in.

The Build


  • Raspberry Pi Zero W (though any wireless capable version should work)
  • SD Card (at least 8 GB, though I suggest 15 GB)
  • Battery Power Supply that can run a Pi Zero W
  • Micro USB cable you can cut to expose the power wires.
  • Magnetic Switch with option to run Normally Open and Normally Closed

Software you'll need

The Process

  1. Install Raspberry Pi OS lite on your SD card.  Use a tool like Balena Etcher to do this.
  2. Setup your PI to have wireless access to your network, and make sure to give yourself SSH access.

a. Wifi Access - You need to create a wpa_supplicant.conf file in the "boot" folder of the SD Card before you put it in the PI for the first time.


ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=<your two character country code, e.g. UK, US, etc>

     ssid="<your wireless ssid (network name)>"
     psk="<your wireless network password>"

b. SSH Access - Create an empty file simply named "SSH" in the "boot" folder of the SD Card before you use it in the PI for the first time.

3. Eject your SD Card from your computer, and put it in the pi, and boot.  Give it about 3 minutes to boot, then find the IP for the Pi on your network. You can use a tool like AngryIPScanner for this, or check your Wireless router control software

4. ssh into your Pi, ssh pi@<your local ip>, and enter the password 'raspberry'.

5. Once logged in, you can run sudo raspi-config and change any configs you want from there.

6. Once logged in, type passwd into the terminal. Enter the current password 'raspberry', and then enter a new password twice to change the password for accessing your pi.

7. Now, you can copy the files from the repo into the pi.

scp pi@<your local pi ip address>:~/

scp sendMailboxAct.service pi@<your local pi ip address>:~/

8. Once copied over, ssh back into your pi.

9. Install Ntfy on your pi.

10. Open the file and make sure to setup Ntfy to use the service you prefer (if not Telegram).

You can test the send using Ntfy by just copying and pasting the command into an empty terminal

Once working, and sedning the message, you can save it to your .sh file.

11. Now, take the sendMailboxAct.service file, and move it to /etc/systemd/system/

12. You may need to change the permissions to make it executable sudo chmod +x /etc/systemd/system/sendMailboxAct.service

13. Start the service with sudo systemctl start sendMailboxAct

NOTE: be ready, when it starts, it will send a message and shutdown the pi.

14. Now setup your pi to work off of the magnetic switch, so when it closes (the two magnets come together) the pi starts, sends the message then shuts back down.