Intro: Dr Who Tardis Doorbell
This is a project I came up with to create a Tardis doorbell. It is a wireless doorbell that when pressed plays audio from the show. I have recorded and used audio from the Matt Smith series because this is a gift for my step sister and that is her favorite dr. I made the following youtube video of the finished product.
Step 1: Order Case Parts
The first thing that needs to be done is the case. This is the wooden Tardis that the electronics will sit inside. You can find this on Etsy. There is a shop called Lazer Models that sell the lazer cut wooden model. You will need wood glue and a little time to put everything in place and glue it together.
*** When you are at the end of putting the model together do not glue or use the top pieces where the top light goes in the show. An led will go here that lights up later. you need that hole there****
Step 2: Drill Hole for LED
The top of the Tardis should have a small hole where we left pieces out. Use a drill to drill a hole that goes through that hole to the center of the Tardis. There is a wooden piece used for stability in the middle that is solid. The drill hole should go through this piece so that the bottom hidden compartment and the top connect. This will allow two small wires to run from the bottom compartment up through the top where the LED will be placed.
Step 3: Painting
This was the hardest part for me. I got the paint I used from hobby lobby. The official Tardis paint is hard to find and the pieces on the wooden Tardis are small so you need fine tip paint brushes. I bought craft paint and brushes at hobby lobby. You will need the Blue for the outside and black for the top where the white lettering is and also the white. I only painted the lettering on the front since it is very small and hard to do without messing up. I had to go back over mistakes with the black or blue a few times. After the coats of paint are finished you will need a can of polyurethane. I did three coats of paint to get it the way I wanted. Then sprayed 3 coats of polyurethane to seal and gloss the Tardis. This helps with warping and also gives it a nice shine.
Step 4: Drill Side Holes
Now you will need to drill and cut a few holes in the side of the Tardis case. You need a hole big enough for the squid push button for the power. You also need a hole for the power cord and USB cord that will connect to the Sound board. I drilled the initial hole then used an exacto knife to smooth the holes out large enough and circular.
Step 5: Raspberry Pi's
Now you will need to set up the Raspberry Pi's. To do this I purchased a Raspberry pi 3, power cord, heat sink for a Raspberry Pi, 32gb micro sd card, female to female jumper cables, a 10 ohm resistor, two pack squid push buttons, a 10v to 5v power converter, jumper cables and a jumper cable maker kit, and a USB sound board and if you have it a wireless keyboard with a USB dongle makes this easier. You will also need a second Raspberry Pi and sd card. This will need to be a Raspberry Pi zero and a gpio pinout to solder in.
*** the SD card does not need to be 32gb an 8gb will do fine***
You will need to download an image onto the SD card to use in the Raspberry Pi. Then you can use any freeware to write the image to the sd card. I use Win32DiskImager.. This is a pretty straight forward process. You simply insert the sd card which will be assigned a drive letter. Then browse to the image you downloaded and write to disk then select the SD card. I use the Raspian image on there site. A google search of Raspian and write image to sd card will give you anything you need.
Once the image is written to the SD card plug it into the port on the Raspberry Pi 3 and plug the power cord in for first boot. The Raspian image opens to the pixel desktop environment. There is an image of a black square this is the terminal where we will work on our scripts to make this work. click on that image to open the terminal.
*** At this point it is important to note I obtained audio files by recording the show with my phone then uploading the videos to youtube and using the yt2mp3 site to convert them to mp3s. Then download them to the Raspberry Pi and place them in the /home/pi directory. you can do this with the folder icon and dragging the files over from the downloads folder.
I have attached an image of a GPIO board which tells you what pins do what. For simplicity i recommend using the pins I did. Pin 3 is my power button. Pin 14 is my led and pin 18 is the program pin. There is nothing attached to this because this is done wirelessly. There is also an image of my MP3's in the home/pi directory.
Step 6: Power Shell Script
The way this works is there are two shell scripts. The scripts run a bootup and start the python scripts. The python scripts run and await input either from the button press or fluctuation in the pin voltage. The shell scripts are pretty simple the following is the first one. which is going to start the python script once created.
sudo python3 power.py
This script will start power.sh which is the name of the python script we will also be creating. The way we create this script from the terminal is by typing cd /home/pi then enter. Then we need to create a directory for our scripts so type sudo mkdir bin then enter. This will create a bin folder that we can use for our scripts. Then type cd /home/pi/bin then enter. Then type sudo nano power.sh then enter. This will open a blank document where the script above will be typed in. To save press cntrl and x then it will ask if you want to save press y for yes then it will confirm the location and press enter. This creates the script but we need it to be executable. So press cd /home/pi enter. Then sudo chmod+x /home/pi/bin/power.sh then enter. This will make the power script we just created executable to all users. Now we need this script to run at reboot. Meaning it will automatically run at start which will start our other script we will create. Type cd /home/pi then enter. Then type sudo crontab -e then enter. It will ask you what editor to use select nano which is 2 I believe then enter. This document already has writing in it. Just scroll to the bottom and type the @reboot sh /home/pi/bin/power.sh then save with cntrl and x, confirm with y then enter. Now the shell script will run at reboot.
Step 7: Power Python Script
Now that the shell script is ready to start the python script we need to create the python script. From the terminal type cd /home/pi then enter. The python scripts do not need their own directory saving them into this main directory with the mp3's is fine. Type sudo nano power.py then enter. This will open the blank text editor again. The scripts in python are very spacing dependent so if you get any syntax errors its the spacing.
import RPi.GPIO as GPIO
GPIO.setup(3, GPIO.IN, pull_up_down = GPIO.PUD_UP)
buttonState1 = GPIO.input(3)
if buttonState1 != oldButtonState1 and buttonState1 == False:
subprocess.call("sudo shutdown -h now",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
oldButtonState1 = buttonState1
Then save with cntrl and x then confirm with Y then enter. Now what will happen is the shell script will run at startup and start this python script which will await a button press on pin 3 to shut the raspberry pi into sleep mode and start it up. Now shut the raspberry pi down from the terminal with sudo shutdown -h now and enter. Once the pi is shut down and the green light is off then unplug it. Now connect the squid switch to pin 3. The pin count starts with low numbers on the end where the sd card is. Pin 3 and ground are pin 5 and 6 when counting down from that end. Count down 2 then 4 then 6. Those two pins are pin 3 and ground. Plug the squid switch into those pins. They slide right on. Which one goes on which pin does not matter. Once the switch is on, plug the pi back in and it will start up. Since our script runs at startup press the button to test and it should shutdown into sleep mode. Then press it again and it will start up again. Some of the buttons can be loose if it doesn't work check your connection at the pins and also some of the buttons are loose and need to be pressed and held a second for the connection to be flush. You can test this a few times.
Step 8: Led Jumper Cables
Now we can run this cable but it does not get connected yet. The small led you bought has two aluminum pins coming off of it. The longer one is the positive. Connect the 10 ohm resistor to the positive end. Then take the jumper cables you bought and connect one to the positive and one to the negative. Then run the cables through the hole at the top of the Tardis case through the middle hole and into the bottom compartment. You can use electrical tape if you want to hold some of this together. It is not really needed though. None of this is very heavy. Just be careful not to pull to hard it they will pop out. We are not connecting this to the Raspberry pi yet.
Step 9: Dr-who Shell Script
This is the shell script just like the other one that is going to run at reboot and start the Dr-who python script we will be writing. This is done the exact same way. from the terminal cd /home/pi/bin and enter. Then sudo nano dr-who.sh and enter. Then type the following:
#dr who startup script
sudo python3 dr-who.py
Then cntrl and x then Y then enter. Then press cd /home/pi then enter.
Then sudo chmod+x /home/pi/bin/dr-who.sh then enter. Then sudo crontab -e then scroll to the bottom and type
@reboot sh /home/pi/bin/dr-who.sh then save with cntrl and x then Y and then enter. There should now be two lines on the crontab which start both the power shell script and the dr-who shell script at startup.
***While we are here there are two more entries to add that will come into play later**
enter the following:
@reboot sudo systemct1 enable pigpiod
@reboot sudo systemct1 start pigpiod
Then save the pigpiod is a needed package to use the wireless button that we will be using. It is not installed by default. After saving exit to the terminal. Press sudo apt-get install pigpiod then enter. You must be connected to the internet to download this. This can be done from the desktop of the Raspberry pi.
Step 10: Dr-who Python Script
This is the real guts of the doorbell. This is the main program itself that runs. This runs on pin 18 but the output is on pin 14 and 18. This program will make the led light up then a mp3 will be selected it will play then the led will blink again. The file names of the mp3's are just what I named them to remember them. You can name them whatever you want. Just remember that they cannot have any python command in the name for example I named a file with the word sort in the name and it confused python and so it was changed. Remember from the terminal cd /home/pi then enter. Then sudo nano dr-who.py then enter. In the text enter the following script that will be written.
**This is my script yours will be different if you have a different number of MP3's or if they are named differently**
import RPi.GPIO as GPIO
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
number = random.randint(1, 6
***selects a random number between 1 and 6, needs changed if your number of MP3's is different***
if number == 1:
elif number == 2:
elif number ==3:
elif number ==4:
elif number ==5:
**MP3 name may be different depends on what you named them**
GPIO.setup(14, GPIO.OUT) ** sets output to pin 14 as well**
GPIO.output(14, False) **Led is on pin 14 sets it to off initially**
input_state = GPIO.input(18) **pin 18 is the input**
if (GPIO.input(18) == False):
What this does is when pin 18 is interacted with the led on pin 14 at the top of the tardis will blink then an audio file will be selected and play then the led will blink twice and go off. This is what will happen any time the doorbell is rung. We will also need the IP address of this raspberry pi for the script in the other one so the wireless signal will be received so make sure to connect the raspberry pi to your wifi through the GUI desktop then go back into the terminal and enter sudo hostname -I then enter. write down the ip address given you will need it later. You can also now plug the cables in for the led to pin 14 follow the GPIO pin out for pin 14 and the ground pin that is diagonal from it.
Step 11: Front Button Raspberry Pi
The Raspberry pi zero needs a few things done to it. first the pins need to be soldered in. Use a soldering iron and some solder to solder the pins in for a solid connected. There are a mountain of resources on how to do this online. Youtube is a great one. Once the pins are soldered in the sd card will need the raspian image written to it just like before. We will not need a power button here. we will need a shell script that runs at boot again and it will start our python script that will wirelessly signal pin 18 on the other raspberry pi to run our program.
Step 12: Doorbell Shell Script
This script will be almost identical to the other two. From the terminal enter cd /home/pi then enter. sudo mkdir /home/pi/bin then enter. cd /home/pi/bin then enter. sudo nano doorbell.sh then enter.
sudo python3 doorbell.py
Then save with cntrl and x then Y then enter. Then sudo chmod+x /home/pi/bindoorbell.sh then enter. then cd /home/pi then enter. Then sudo crontab -e then enter select nano then enter. At the bottom enter
@reboot sh /home/pi/bin/doorbell.sh then save with cntrl and x then Y then enter. This will run the shell script at startup and next we will create a python script with our front doorbell attached that when pressed will signal the other raspberry pi.
Step 13: Doorbell Python Script
This is the script that is going to enable wireless communication between the front doorbell and the chime that we have created. The script to run the audio on the first Raspberry pi runs based on low voltage. Its set to high so once that changes it runs the script blinks the light and plays the audio. This script sends a low signal to that Raspberry pi and to that pin then sets it back to high so it will run once when pressed. The script is as follows:
from gpiozero import LED
from gpiozero import Button
from gpiozero.pins.pigpio import PiGPIOFactory
from signal import pause
factory = PiGPIOFactory(host = '192.168.1.13')
led = LED(18, pin_factory=factory)
button = Button(3)
The LED module is not being used for the led its just signaling that pin on the first Raspberry pi which runs the program. Once this is saved to the /hom/pi directory and since the shell to start this was already created. We can now power off both Raspberry pi's with sudo shutdown -h now. Then the first Raspberry pi needs to be turned on first which because of the crontab entry will start the pigpiod which needs to start first. Then the second raspberry pi for the doorbell can be started. Then as long as your soldering for the physical button is done correctly and plugged in right. A button press will start the led and audio.
*** A speaker is now needed or the audio will not work. I found a soundboard online that draws power from the Raspberry pi through the USB port. Which is perfect so it does not need its own plug. I recommend it. The audio output is through the 3.5mm jack. The soundboard will be plugged into the chime Raspberry pi through the hole we made in the case and one wire will go into the 3.5 mm jack and the other into the USB. The default audi is the HDMI port so you need to force the pi into the 3.5 mm jack. This is done from the terminal with sudo raspi-config then enter. A menu will pop up select advanced options then audio then 3.5 mm then save and exit. Once you have done this and your speaker is plugged in you can test your chime a few times, you are finished the only thing left is to wire the doorbell Raspberry pi into the house.
Step 14: Power Converter
This is the last step. First make sure that the chime Raspberry pi is turned on. Behind your current doorbell there are two wires a positive and a negative. The voltage is either 10 or 12 volts. What you will need is a power converter that converts this down to 5 volts which is what the Raspberry pi uses. If you look at the ends of the jumper cables that we used the ends are female and male aluminum with a cover on it. You can get these ends by themselves in kits to create your own cables. Pick which side you want to be female and male the strip the wires back to expose the copper. Then put the female ends on the house wires or vice versa. Then the power converter has two wires as well. Red for positive and black for negative. Now we do the same thing strip the wires back to expose the copper. Place the male ends on them and use pliers to crimp it down. You can place the plastic covers on if you want. Then you can plug the power converter into the house wires. Positive to positive and negative to negative. You can tape this connection with electric tape so it holds better. If done correctly when you plug the 5v end into the Raspberry pi it will power on. You can test that the doorbell works by pressing the button. The chime audio should start up. Once it does you can place the power converter, the doorbell Raspberry pi all inside the wall hole behind your previous doorbell. Use screws to screw the new doorbell cover on. Now anytime anyone presses the front doorbell the Tardis will blink then play the audio then blink again. This can technically be done with any audio and any case. The next one I will build will be a Darth Vader one. Happy building