Smart Doorbell using ESP32 Camera: Door bell are used from houses very important now. This project is simple and effective. This also needs few components and it is easy to build by any beginner level hobbyist or student.

Components List:
Below parts are needed for building this project.
1. ESP32 Camera Module
2. Single channel Relay
3. Resistor 1KΩ x 1
4. Push Button Switch
5. Jumper cables
6. Breadboard
7. Mobile charger 5V/1A as power supply

How it Works?
When anyone presses the call bell it send an notification to your Blynk app Installed on your smartphone. You can open the Blynk app and tap on Take Picture to take a pick of the person who is standing outside. After seeing the person you can open the door by tapping on the blynk app. This is a simple but very effective project to build. The ESP32 camera resolution is good to take pics. It also has an addition flash to take the pictures in better way.

Connection Diagram:
This project needs few components to build it. With few easily available components, you can build esp32-cam blynk project. If you want you can also mount these components on a circuit board or design your own circuit board.

board or design your own circuit board.

Blynk Project Setup:
You can download the Blynk app for Android form here and for iOS here. Its free for building and testing. You can also build you own Blynk Local server easily. For setting up this blynk projects we will use below widgets

1. Image Gallery
2. Notification

2 Stylish Button
Open Blynk App and Tap on New Project

Enter a name for your project and select ESP32 Dev Board as a device. Then tap on Create

Once you tap on create an email will be sent to your registered email id with Auth Token

Now we need to add widgets. Tap on the highlighted icon.

Scroll down and select Image Gallery

Then select Notification

Select Styled Button twice

Once all the widgets are added, now its time to resize, position and configure them.

Configure the Image Galley with below settings

Now configure first styled button with below settings. This will be used for taking picture.

For another styled button will be used for opening the door lock. Configure it as per below settings

Finally your configuration is complete and Blynk project is ready.

Smart Door Bell ESP-32 Camera Code:

#include "esp_camera.h"
#include "esp_camera.h"
#include "WiFi.h"
#include "WiFiClient.h"
#include "BlynkSimpleEsp32.h"
#include "camera_pins.h"

#define call_bell 13
#define photo 14
#define relay 12
#define led 4
const char* ssid = "Your SSID"; // Enter your Wifi name
const char* password = "Your Network Password"; // Enter wifi password
char auth[] = "Auth Token"; // Enter the Auth Token provied by Blynk app
String local_IP;
void startCameraServer();
void capture_photo()// This function will capture the photo
digitalWrite(led, HIGH);
uint32_t randomNum = random(50000);
Serial.println("http://"+local_IP+"/capture?_cb="+ (String)randomNum);
Blynk.setProperty(V1, "urls", "http://"+local_IP+"/capture?_cb="+(String)randomNum);
digitalWrite(led, LOW);
void setup() 
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
// camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
sensor_t * s = esp_camera_sensor_get();
// initial sensors are flipped vertically and colors are a bit saturated
if (s->id.PID == OV3660_PID) 
s->set_vflip(s, 1); // flip it back
s->set_brightness(s, 1); // up the brightness just a bit
s->set_saturation(s, -2); // lower the saturation
// drop down frame size for higher initial frame rate
s->set_framesize(s, FRAMESIZE_QVGA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
Serial.println("WiFi connected");
Serial.print("Camera Ready! Use 'http://");
local_IP = WiFi.localIP().toString();
Serial.println("' to connect");
Blynk.begin(auth, ssid, password);
void loop() // put your main code here, to run repeatedly
if(digitalRead(call_bell) == HIGH)
Serial.println("Send Notification to Blynk");
Blynk.notify("Door Bell Pressed, Please Check"); // This notification will be sent to Blynk App
if(digitalRead(photo) == HIGH)
Serial.println("Capture Photo");
if(digitalRead(relay) == HIGH)
Serial.println("Unlock Door");

About the Author


Hello! My Dear Friends. I am Subramanian. I am writing posts on androiderode about Electronics testing and equipments.

View All Articles