🔔 Smart Video Doorbell
Build a DIY Ring-style doorbell that sends a photo to your phone via Telegram.
Overview
This project combines the ESP32-CAM with a PIR motion sensor to build a smart doorbell. When someone approaches, the PIR triggers the ESP32-CAM to capture a JPEG snapshot and instantly send it to your Telegram account via a bot — no subscription required.
What you'll learn: ESP32-CAM initialization, HTTPS POST requests to the Telegram Bot API, camera frame buffer management, deep sleep between events for battery saving, and PIR interrupt-driven wake-up.
Estimated time: 2–3 hours. Difficulty: ⭐⭐⭐ Intermediate.
Components Needed
| Component | Specification | Qty | Notes |
|---|---|---|---|
| ESP32-CAM Module | AI-Thinker OV2640 | 1 | Camera + MCU combined |
| HC-SR501 PIR Sensor | Digital output | 1 | Motion trigger |
| FTDI Programmer | 3.3V/5V | 1 | For flashing only |
| Doorbell Button | Momentary | 1 | Optional manual trigger |
| 18650 Battery + TP4056 | 3.7V LiPo | 1 | Portable battery pack |
Step-by-Step Tutorial
1
Create Telegram Bot
Open Telegram, search for @BotFather, send /newbot, follow instructions. Copy the Bot Token. Then send a message to your bot and use the getUpdates API to find your Chat ID.
2
Wire PIR Sensor
Connect PIR VCC → 5V, GND → GND, OUT → GPIO 13 on the ESP32-CAM. The PIR outputs HIGH for 3s when motion is detected.
3
Configure Camera
Use the AI-Thinker pinout constants to init the camera at FRAMESIZE_VGA with JPEG quality 10 for a fast, compact snapshot.
4
Send Photo via Telegram
On PIR trigger, capture a frame buffer with
esp_camera_fb_get(). POST the raw JPEG bytes to https://api.telegram.org/bot{TOKEN}/sendPhoto with multipart/form-data.5
Add Deep Sleep
After sending the photo, enter deep sleep for 10 seconds:
esp_sleep_enable_timer_wakeup(10e6); esp_deep_sleep_start(); to conserve battery.Telegram photo uploads require HTTPS, and the ESP32-CAM needs to verify the Telegram server certificate. Use
client.setInsecure() during development, but for production add the Telegram root CA certificate.Code / Configuration
smart_doorbell.ino
INO
// Smart Video Doorbell - Volt X
#include "esp_camera.h"
#include <WiFi.h>
#include <WiFiClientSecure.h>
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
const char* botToken = "YOUR_BOT_TOKEN";
const char* chatID = "YOUR_CHAT_ID";
#define PIR_PIN 13
// AI-Thinker ESP32-CAM pins (abbreviated)
#define PWDN_GPIO_NUM 32
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
void initCamera() {
camera_config_t cfg = {};Reviews & Ratings
—0 reviews
Sign in to leave a review
Loading reviews...