Introduction: Raspberry Pi Doorbell

I recently bought a home with a broken doorbell chime. So I built one that can do custom sounds.

I used the Adafruit Stereo Bonnet Pack with RPI Zero W

Additional Parts:

SD card

USB power outlet - Or could use a Pi power adapter if you have a power outlet at the doorbell

Small USB to micro USB cable

Small proto board to solder connections

1 - 10k resister

1 - 1k resister

1 - 104 (0.1uf) capacitor

3 jumper cables

2 alligator clip cables

Step 1: Solder Parts

The Adafruit Speaker Bonnet and Zero need the pin connectors soldered. Adafruit has instructions for this.

This is a reliable circuit that uses hardware resistors. It doesn't get phantom inputs from static electricity or from flipping a light switch. The GPIO gets a constant voltage and hitting the switch connects the circuit to ground dropping the voltage. The capacitor acts as a short duration uninterrupted power supply, it prevents what is called button bounce. This where a circuit will make make multiple fluctuations in voltage when a button is pressed because the metal is actually making contact multiple times in a fraction of a second. The Python script has a 5 second time out that also helps with this and impolite ringers.

  • Solder the black jumper to a ground connector on the Speaker Bonnet
  • Solder red jumper to 3.3v connector
  • Solder blue jumper to 22 on the Speaker Bonnet (Which is GPIO 22)
  • Bridge solder red power jumper to 10k resistor
  • Bridge solder other end of 10k resistor, GPIO jumper, capacitor and 1k resistor
  • Bridge solder other end of 1k resistor to the alligator clip wire.
  • Bridge solder other end of capacitor, ground and other alligator clip wire.

Step 2: Setup Raspberry Pi

I used Raspbian Lite, because you can't control the speaker volume on the Adafruit board with the full GUI version of Raspbian. If you use the Adafruit hardware, follow their directions for setup.

Create a folder for doorbell files

pi@raspberrypi ~ $ mkdir doorbell
pi@raspberrypi ~ $ cd doorbell

Download python script and wav file(s) you want to use.

wget -O doorbell.py https://cdn.instructables.com/ORIG/FDZ/52RL/JEIV2AVA/FDZ52RLJEIV2AVA.py

wget -O doorbell.wav https://cdn.instructables.com/ORIG/F1S/WIX6/JDOUPDST/F1SWIX6JDOUPDST.wav

wget -O gong.wav https://cdn.instructables.com/ORIG/FMI/ZSTF/JDOUPDRK/FMIZSTFJDOUPDRK.wav

wget -O bird.wav https://cdn.instructables.com/ORIG/FSG/084L/JDOUPDO4/FSG084LJDOUPDO4.wav


Make doorbell.py executable

chmod +x doorbell.py

I edited these sounds with Creative Commons Licensed sounds I got from Freesound

The python script uses ring.wav, so copy the one you want it to play

pi@raspberrypi ~ $ cp gong.wav ring.wav

Setup startup service

pi@raspberrypi ~ $ sudo nano /lib/systemd/system/doorbell.service

[Unit]
Description=Doorbell Program

[Service]

ExecStart=/home/pi/doorbell/doorbell.py

StandardOutput=null

[Install]

WantedBy=multi-user.target

Alias=doorbell.service


Save, then active the service

pi@raspberrypi ~ $ sudo systemctl enable doorbell.service

pi@raspberrypi ~ $ sudo systemctl start doorbell.service

Step 3: Installation

The installation will have to be customized to your existing doorbell system. I used a reciprocating saw to cut open the sound chambers in the old doorbell housing and put in the speakers. I used some electrical tape to keep things in place. I striped the ends of the doorbell switch wire and connected it with alligator clips. I covered the bare copper with electrical tape.