Introduction: Raspberry Pi Smart Doorbell: Who's at My Door?
This project is intended to replicate some of the smart doorbells that are on the market. This version will detect when someone has touched the doorknob or doorbell and either tweet, text, or email a picture of the person at the door. The photo will be taken with a Raspberry Pi camera through the door viewer (peep hole).
I am going to post the hardware instructions and some basic code and then your code will vary depending on whether you want to email, tweet, or text the results to yourself. There are many different ways to do that and I cannot cover them all here.
Raspberry Pi: http://www.gearbest.com/development-boards/pp_1561...
Raspberry Pi accessories if you don't already have them:
Powered USB Hub: http://www.gearbest.com/cables-connectors/pp_16535...
Raspberry Pi Camera: http://www.gearbest.com/development-boards/pp_6884...
Capacitive Touch Hat: http://amzn.to/1tppiKC
Keybaord/Mouse (if you don't already have one): http://amzn.to/1tppEAV
You'll also need a HDMI monitor or television.
Step 1: How It Works
A Capacitive Touch Hat is a board that sits on top of the raspberry pi. It is very sensitive to touch to the point that you can connect up to 8 slightly conductive objects to its connectors and use them as buttons. Many people online have videos where they use different fruits to play drums. Here's one:
With the touch hat connected to the metal frame around to doorbell and one of the screws on your door handle, it will detect touches of either one. This could be adapted to window frames, hotel room doors, car doors, or anything else you'd like to secure. If you don't like the idea of taking the picture, you could also have it sound an alarm and send you a text that there has been an intruder.
Step 2: Building the Smart Doorbell
This project begins as any other Raspberry Pi project, setting up the Pi. You'll need to build the case, install the operating system on the memory card (unless it came with NOOBS), and connect everything up.
When you turn the Pi on, it will ask you for a username and password. The username is pi and the password is raspberry. You can do all of your programming through the command prompt if you please. There are several text editors (vim, nano, etc.) for writing code. Assuming that you're using Python and calling your file Doorbell, simply type "sudo nano Doorbell.py" to start programming. After saving your file (ctrl-o) and exiting (ctrl-x), you run the program by typing "sudo python Doorbell.py."
When you first run the raspberry pi operating system, it will take you through configuration. If this is not your first time, you can type sudo raspi-config to call it up. Click "Advanced Options" and "Enable I2C."
You'll need to make sure that the Raspberry Pi and your version of Python are up to date, so type:
sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus python-pip git
Then, follow this thorough tutorial to turn on I2C and install all of the CTH libraries and dependencies:
Step 3: Programming
You programming will depend upon whether you want to text, tweet, or email the photo to yourself. There are plenty of instructions how to use apps like Tweepy or use gmail through the raspberry pi.
The parts of the programming that everyone will have are:
Import mpr121 library:
Set up to use mpr121 on I2C port
Detect a touch:
mpr121.readData(0x5a) where "0" is touch and "1" is not touch
Then, just write an if/then statement to take the photo and text, tweet, or email it.
Step 4: Share Your Code
When you write code for your project, please share it in the comments section.
Don't forget to hide any personal information like gmail passwords and such before posting in the comments section.