Smart Doorbell using ESP32 Camera

Smart Doorbell using ESP32 Camera

Door bell are used from several decades now. A traditional door bell is very simple to connect and use. In this era of communication we have developed and made our door bell smart. In this tutorial we will learn how we cab build a smart doorbell using ESP32 camera.

This project is simple and effective. This also needs few components and it is easy to build by any beginner level hobbyist or student. Lets quickly see what are the components needed to build this project.

Parts List

Below parts are needed for building this project, You can click on the best buy links to buy the products which will help out channel to grow.

  • ESP32 Camera Module (BEST BUY)
  • Single channel Relay Module (BEST BUY)
  • Resistor 1KΩ x 1
  • Push Button Switch
  • Jumper cables
  • Breadboard (BEST BUY)
  • 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.

Smart Doorbell using ESP32 Camera

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.

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

  • Image Gallery
  • Notification
  • 2 Stylish Button

Open Blynk App and Tap on New Project

Blynk config

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

Blynk Token

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

Scroll down and select Image Gallery

Smart Doorbell using ESP32 Camera

Then select Notification

Smart Doorbell using ESP32 Camera

Select Styled Button twice

Smart Doorbell using ESP32 Camera

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

Configure the Image Galley with below settings

Smart Doorbell using ESP32 Camera

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

Smart Doorbell using ESP32 Camera

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

Smart Doorbell using ESP32 Camera

Finally your configuration is complete and Blynk project is ready.

Smart Doorbell using ESP32 Camera


We are using default code with some changes. you can get the default code form ESP32 examples. You can open the default code and delete it. Copy the code below and make necessary changes as marked.

For uploading the code you can refer to this article.

#include "esp_camera.h"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

//Ensure ESP32 Wrover Module
//Partial images will be transmitted if image exceeds buffer size

//camera model

#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;

// if PSRAM IC present, init with UXGA resolution and higher JPEG quality
// for larger pre-allocated frame buffer.
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");


We have arrange all the components on a breadboard and connected it as per the circuit diagram.

Suggested Projects:

Video Tutorial

You can refer to this complete video tutorial and comment in case of any problem.


Using ESP32 camera this a simple and nice project, which can be implemented at home. This required some basic components to build and it can be easily mounted on a pcb and a box. This project will also help you to understand the interfacing of ESP32-cam projects. You can also build and modify this project as per your needs. Try this project and let me know your views.

10 thoughts on “Smart Doorbell using ESP32 Camera”

    • Hi Ede,

      This project is exclusively made with ESP32 camera and if you want to use IP camera then the code has to be changed.

  1. 1)I have problem in connection once after the esp32 camera and arduino connection is done and code is been uploded to pc after that how does that code works if we remove esp32 camera from arduino and if we try connect esp32 to the bread board power supply

    2) we ar facing issue with the how to connect the power supply to the bread board

    3) sir you have used 2 register one is resister 330 ohms and resister 10k ohms we are not getting which register pin is connected near push button and which register is connected near led light

    • Hi Harshavathi. T,

      Thanks for your questions!
      Here Arduino is used for uploading the code and once the code is uploaded in ESP32 CAM then ESP32 will start working independently and will take complete control.
      The power supply is simple and easy to connect. You need to use 5 V power supply and connect it as per circuit diagram.
      As per diagram 10Kohms is used with the pushbutton switch and for current limiting 330ohms resistor is used with LED.

      Hope we answered your quarries.

      • Sir before uploading the code under tools programmer it’s showing no “programs available for this board” it’s also it’s showing a fatal error occurred :Failed to connect to ESP32:timed out waiting for packet hearder what shall I do sir i have select this project as mini project please help me.. Sir, sir there are quite confusion in blynk app working how we will get notification and all that’s the problem if u give ur contact num that will be helpfull please help me in this mini project please sir if don’t want to publish ur number pls send it to my mail I’d sir because I have short period of time please sir

  2. Is this works on the local area network i mean esp32 and device with blynk app must have been connected to the same wifi?

    • Your esp32 must be connected to a network which has internet. Then you can use blynk from your smartphone which has internet and access the ESP32. It is not necessary to have these devices connected within the same network. It can be connected to any network but it should have internet availability.


Leave a Comment