Who can it be now? How to Build a Raspberry Pi Doorbell that Recognizes Friends
Create a camera that identifies and announces your friends by name.
I want to buy a smart doorbell, but the cost of them is a little outside of my budget. Instead, I’m using a Raspberry Pi, a speaker system, and a camera to build a smart doorbell system for a fraction of the cost.
In our last project, we created a doorbell system which rang when a person was at the door. This time we’ll expand on the code to allow the project to identify when people we know are at the door, and announce it accordingly. This will let us choose to either run to the door, or hide upstairs when our friends or inlaws drop by unexpectedly.
What You’ll Need For This Project
- Raspberry Pi 4 or Raspberry Pi 3 with power adapter
- Desktop speakers or a megaphone with a 3.5mm input and 3.5mm cable
- Wyze Cam V2 (Wyze Cam V3 is not yet compatible)
- 2x8 GB (or larger) microSD cards, one for Raspberry Pi, another for the camera.
- Monitor with HDMI and power cables. (Optional)
How to Turn a Raspberry Pi into a Facial Recognition Doorbell System
Before you get started, get your Raspberry Pi set up. If you haven’t done this before, see our article on how to set up a Raspberry Pi for the first time or how to do a headless Raspberry Pi install (without the keyboard and screen). For this project, we recommend a headless Raspberry Pi install.
1. Install git. We’ll need it to download the code from GitHub.
sudo apt-get update
sudo apt-get -y install git
2. Clone the repository to your home directory. This will ensure we have all the code and audio files we need to run the project.
cd ~/
git clone https://github.com/rydercalmdown/facial_recognition_doorbell.git
3. Run the “make install” command to install all project dependencies. This script will take care of installing lower level dependencies, as well as the Python libraries you need for the project to run. This should take about 10-15 minutes on a Raspberry Pi 4.
cd ~/facial_recognition_doorbell/
make install
4. Set the 3.5mm audio output to be the default audio output in raspi-config. You do this by launching raspi-config (entering sudo raspi-config at the command prompt) and navigating to System Options -> Audio -> Headphones 1. The pi allows for audio to be outputted to either the 3.5mm analog output, or over the HDMI port. If you do not have a monitor attached, headphones may be the only option.
Stay On the Cutting Edge: Get the Tom's Hardware Newsletter
Get Tom's Hardware's best news and in-depth reviews, straight to your inbox.
sudo raspi-config
# Navigate to System Options -> Audio -> Headphones 1
5. Plug your speakers into your Raspberry Pi using a 3.5mm cable.
6. Test your speakers by playing the doorbell audio file. You should hear a doorbell sound from your speakers. In my case I’m using a megaphone, but feel free to use whatever speakers you have available.
mpg321 /home/pi/facial_recognition_doorbell/src/audio/doorbell.mp3
7. Test text to speech on your pi by running the following command. You should hear the text spoken out loud through your speakers.
say ‘hello there’
# Press Ctrl + C to exit if stuck
8. Flash the custom RTSP firmware to your Wyze camera using this tutorial. Installing RTSP support allows us to connect to the camera and grab frames directly with Python. You will need a Wyze V2 camera and a microSD card.
9. Get the RTSP URL value from your Wyze application, and edit the RTSP_URI variable in the Makefile to point the Raspberry Pi to your camera. You can find the RTSP URL in the “Advanced Settings” section of your Wyze application on your phone.
cd ~/facial_recognition_doorbell/
nano Makefile
# STREAM_URI=rtsp://your_username:your_password@camera_ip_address/live
10. Install your camera facing outwards from your front door. Keep in mind the Wyze V2 is not weather proof, so I’m keeping mine in a covered area. Ideally the camera should be mounted above the door pointing directly towards any person who would approach. This allows the facial recognition to work best.
11. Download photos of known people and save them with their file names. Any .jpeg, .jpg or .png photo with someone’s face will work. There should be only one face per photo, and it’s not necessary to use more than one photo for each person. I have one for each one of my friends that comes by my house.
ryder.jpeg
12. Copy the photos of known people into the src/faces directory.
mv ryder.jpeg /home/pi/facial_recognition_doorbell/src/faces/
13. Run the “make run” command on the pi to start the doorbell system. The system will first look for the detection of a person. When a person is detected, the doorbell will ring, and the system will start identifying any known faces from the faces directory. If a face is found, the system will announce the person at the door using text to speech.
We now have a system that will ring whenever a person is at the door, and announce their name if we have their photo on file.
Ryder Damer is a Freelance Writer for Tom's Hardware US covering Raspberry Pi projects and tutorials.
-
velocityg4 More importantly. The system needs to recognize if your friend has beer with them. 🍺Reply -
King_V Well, I don't want just a text-to-speech "hello there" . . I would totally need it to be a scary, metallic voice saying "HALT AND IDENTIFY" to whomever shows up at the door.Reply
Because... uh... reasons! -
USAFRet
For that, you just need motion detection.King_V said:Well, I don't want just a text-to-speech "hello there" . . I would totally need it to be a scary, metallic voice saying "HALT AND IDENTIFY" to whomever shows up at the door.
Because... uh... reasons!
"HALT! Enter your passcode on the keypad, or turn around and leave. You have 10 seconds to comply."
Of course, the sensor needs to be very robust and focused.
Any passing cat or rabbit might trigger it. -
Mikeunif Whish if I can use a telegram bot to open the door if anyone in the photos come near the cameraReply -
SkRThatOneDude You may wish to add a disclaimer that some states (such as Illinois) have biometric privacy laws that would make collecting the data for this system without the subject first opting in illegal.Reply
This is why Nest does not have this feature enabled for users in some states. -
USAFRet
Not disputing your comment, but what specific law or regulation speaks to this?SkRThatOneDude said:You may wish to add a disclaimer that some states (such as Illinois) have biometric privacy laws that would make collecting the data for this system without the subject first opting in illegal.
This is why Nest does not have this feature enabled for users in some states. -
SkRThatOneDude
For Illinois specifically, the Biometric Information Privacy Act of 2008 is the law preventing the collection of facial recognition data. I'm not sure of any specific criminal damages relating to small operations, but I personally got a sizeable settlement from when I worked at Walmart and wasn't given an opt out from biometric login on the cash recycler machines.USAFRet said:Not disputing your comment, but what specific law or regulation speaks to this? -
USAFRet
https://www.ilga.gov/legislation/ilcs/ilcs3.asp?ActID=3004&ChapterID=57SkRThatOneDude said:For Illinois specifically, the Biometric Information Privacy Act of 2008 is the law preventing the collection of facial recognition data. I'm not sure of any specific criminal damages relating to small operations, but I personally got a sizeable settlement from when I worked at Walmart and wasn't given an opt out from biometric login on the cash recycler machines.
Doesn't seem to 'prevent the collection'.
The subject must be notified and agree.
So in this context, these are your 'friends'.
"Hey, Fred, sign this and my my door will automaticaly see and know you, and open upon seeing your face."
Anyone "Not Fred" is not recognized or saved. As such, presumably not afoul of the regulation.