Contactless IoT Doorbell Security System with Raspberry Pi & Camera
Build a smart contactless doorbell with facial recognition, motion detection, and instant mobile notifications using Raspberry Pi and camera module from Ghumti Pasal.
Required Hardware & Component Checklist
Curated components verified for this project. Check the items you need, adjust quantities, and add straight to cart:
Contactless IoT Doorbell Security System with Raspberry Pi & Camera
Educational Notes
This project is designed to be accessible to students from Class 4 to Masters level, with complexity scalable to match different age groups and skill levels.
Learning Objectives:
- Understand basic electronics and circuitry principles
- Learn sensor applications and data collection techniques
- Develop problem-solving skills through hands-on building and troubleshooting
- Apply programming concepts to control hardware and process data
- Connect projects to real-world Nepalese contexts and challenges
Adaptability:
- For younger students (Class 4-8): Focus on assembling pre-built circuits, observing results, and understanding basic concepts
- For intermediate students (Class 9-12): Modify code, experiment with parameters, and explore underlying principles
- For advanced students (Undergraduate/Masters): Optimize designs, add features, conduct research extensions, and analyze performance
Safety Note: Always supervise younger students when working with electricity, heat, or moving parts.
Enhance home security with a contactless IoT doorbell that captures visitor photos, performs facial recognition, and sends instant alerts to your smartphone via Telegram or WhatsApp.
Hardware Bill of Materials (In Stock at Ghumti Pasal):
- Controller: Raspberry Pi 4 Model B 4GB / 8GB
- Camera: Raspberry Pi Camera Module V2 / HQ Camera
- Motion Sensor: HC-SR501 PIR Motion Sensor Module
- Button: Tactile Push Button 12x12mm
- Audio: Active Buzzer + Small Speaker
- Power: 5V 3A USB-C Power Adapter
- Storage: MicroSD Card 32GB Class 10
Circuit Pinout & Wiring Connections:
| Component / Sensor Pin | Raspberry Pi GPIO Pin | Function / Description |
|---|---|---|
| Camera Ribbon | CSI Port | Camera Module Connection |
| PIR VCC / GND | 5V / GND | Motion Sensor Power |
| PIR OUT | GPIO 17 | Motion Detection Signal |
| Doorbell Button | GPIO 27 (Pull-up) | Visitor Press Detection |
| Buzzer (+) | GPIO 22 | Local Chime Sound |
| Speaker | 3.5mm Jack / USB | Two-way Audio |
Firmware Source Code (Python 3)
import cv2
import face_recognition
import requests
import RPi.GPIO as GPIO
import time
from datetime import datetime
from picamera2 import Picamera2
# Telegram Bot Configuration
BOT_TOKEN = "YOUR_BOT_TOKEN"
CHAT_ID = "YOUR_CHAT_ID"
# GPIO Setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN) # PIR Sensor
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Doorbell Button
GPIO.setup(22, GPIO.OUT) # Buzzer
# Camera Setup
picam2 = Picamera2()
config = picam2.create_still_configuration(main={"size": (1920, 1080)})
picam2.configure(config)
picam2.start()
known_face_encodings = []
known_face_names = []
def send_telegram_alert(image_path, message):
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendPhoto"
with open(image_path, 'rb') as photo:
files = {'photo': photo}
data = {'chat_id': CHAT_ID, 'caption': message}
requests.post(url, files=files, data=data)
def capture_and_process():
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
image_path = f"/home/pi/doorbell_{timestamp}.jpg"
picam2.capture_file(image_path)
# Face recognition
image = face_recognition.load_image_file(image_path)
face_locations = face_recognition.face_locations(image)
face_encodings = face_recognition.face_encodings(image, face_locations)
recognized_names = []
for face_encoding in face_encodings:
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
name = "Unknown Visitor"
if True in matches:
first_match_index = matches.index(True)
name = known_face_names[first_match_index]
recognized_names.append(name)
message = f"๐ช Doorbell Alert! {datetime.now().strftime('%H:%M:%S')}\n"
if recognized_names:
message += f"Recognized: {', '.join(recognized_names)}"
else:
message += "No known faces detected"
send_telegram_alert(image_path, message)
# Local chime
for _ in range(3):
GPIO.output(22, True)
time.sleep(0.1)
GPIO.output(22, False)
time.sleep(0.1)
try:
print("Contactless Doorbell System Active...")
while True:
# Check PIR motion
if GPIO.input(17):
print("Motion detected - capturing...")
capture_and_process()
time.sleep(5) # Debounce
# Check doorbell button
if not GPIO.input(27):
print("Button pressed - capturing...")
capture_and_process()
time.sleep(2)
time.sleep(0.1)
except KeyboardInterrupt:
GPIO.cleanup()
Cloud Integration & Mobile App
- Telegram Bot: Instant photo alerts with visitor identification
- WhatsApp Integration: Use Twilio WhatsApp API for broader reach
- Local Storage: Photos saved on Pi with timestamped filenames
- Web Dashboard: Optional Flask web interface for live view
Nepal-Specific Applications
- Kathmandu Apartments: Contactless entry for multi-family buildings
- Remote Villages: Solar-powered doorbell with LoRa mesh network
- Elderly Care: Family notifications when caregivers visit
- Small Businesses: Shop visitor analytics and security logging
Troubleshooting Guide
| Issue | Solution |
|---|---|
| Camera not detected | Check ribbon cable, run sudo raspi-config enable camera |
| Face recognition slow | Use model='hog' instead of CNN, reduce resolution |
| False motion triggers | Adjust PIR sensitivity potentiometer, add software debounce |
| Telegram not sending | Verify bot token, chat ID, and internet connectivity |
Cost Breakdown (NPR)
| Component | Est. Price | Source |
|---|---|---|
| Raspberry Pi 4 4GB | 12,000 | Ghumti Pasal |
| Pi Camera V2 | 3,500 | Ghumti Pasal |
| PIR Sensor | 150 | Ghumti Pasal |
| Push Button | 50 | Ghumti Pasal |
| Buzzer | 80 | Ghumti Pasal |
| 5V 3A Adapter | 600 | Ghumti Pasal |
| 32GB MicroSD | 1,200 | Ghumti Pasal |
| Total | ~17,580 |
Future Enhancements
- Add RFID/NFC tag reader for authorized entry
- Integrate with Home Assistant for smart home automation
- Implement visitor logging with SQLite database
- Add night vision IR LEDs for 24/7 operation
- Solar panel + battery for off-grid deployment
