ESP32CAM Blynk Motion Sensor Security Camera with Notification


In this ESP32CAM Blynk project, I have made a DIY Home surveillance system with ESP32 CAM, PIR motion sensor, and Blynk app. If any motion detected by PIR sensor, the ESP32-CAM Motion Sensor Security Camera will send a notification to smartphone with the photo.

ESP32-CAM PIR Blynk Security Camera

Circuit Diagram of ESP32CAM project:

Circuit of ESP32CAM PIR motion sensor camera

The circuit is very simple. So you can easily make this motion sensor security camera using the ESP32 CAM board, PIR motion sensor.

Component Required for this ESP32CAM Blynk project:

SP32CAM PIR Security Camera components
  1. ESP32-CAM (AI Thinker)
  2. PIR Motion Sensor Module
  3. BC547 NPN Transistor
  4. 220ohm, 1k, 10k Resistor.
  5. LED
  6. FTDI 232 USB to Serial Interface board
  7. 5 volt DC supply

Breadboard Schematic for this ESP32CAM Blynk project

circuit esp32cam PIR circuit on breadboard

This the breadboard schematic of the motion sensor camera using ESP32-CAM. This will help you to design the ESP32CAM PIR motion sensor camera circuit on the breadboard.

Programming ESP32-CAM board

Circuit esp32cam program

To program the ESP32CAM, I have used FTDI232 USB to Serial interface board. I have connected the FTDI232 with ESP32CAM as per the above circuit.

While uploading the code we have to connect GPIO 0 with the GND pin of ESP32CAM.

Before uploading the code to ESP32CAM, please check the following setting:

ESP32-CAM PIR Blynk Security Camera code
  • Update the Preferences –> Aditional boards Manager URLs:,
  • Board Settings:
    • Board: “ESP32 Wrover Module”
    • Upload Speed: “921600”
    • Flash Frequency: “80MHz”
    • Flash Mode: “QIO”
    • Partition Scheme: “Hue APP (3MB No OTA/1MB SPIFFS)”
    • Core Debug Level: “None”
  • COM Port: Depends On Your System
  • GPIO 0 must be connected to GND pin while uploading the sketch
  • After connecting GPIO 0 to GND pin, press the ESP32 CAM on-board RESET button to put the board in flashing mode

Tutorial video of this IoT project

In this esp32cam tutorial video, I have shown how to make this DIY Home surveillance system using ESP32-CAM step by step. For better understanding please watch the complete video.

Blynk App setup for this ESP32CAM Blynk Project

ESP32CAM PIR Blynk app setup

In the tutorial video, I have explained how to use the Blynk app to control the motion sensor security camera in detail.

Steps for the Blynk App setup:
Open the project in the Blynk AppClickon the “+” icon on the top.

  1. Select the Image Gallery Widget from the Widget Box
    (Setting: Pin- V1) (Function: show the image)
  2. Select the Styled Button from the Widget Box
    (Setting: Pin- GP14, Mode- PUSH) (Function: capture photo)
  3. Select the Notification from the Widget Box
    (Function: get the notification)

Testing the ESP32CAM security camera

ESP32CAM PIR Blynk motion sensor Camera

After the Blynk app setup I have tested the circuit.

Supply 5V DC to this security camera circuit and connect your smartphone with the same WiFi network.

Now if the PIR sensor detects any motion, you should get a notification on the mobile phone.

After that click on the ‘Take Picture’ button to get the picture.

The camera can also take pictures in the dark as the inbuilt LED on the ESP32-CAM will provide sufficient light.

ESP32-CAM PIR Blynk Security Camera pic1

I hope you like this Smart home IoT project using ESP32-CAM and Blynk app

You can also subscribe to our newsletter to receive more such useful electronics projects through email.

Please do share your feedback on this ESP32 project. Thank you for your time.

This Post Has 15 Comments

  1. farah

    my blynk show offline

    1. techstudycell

      Please check in the serial monitor, if the ESP32CAM is connected with wifi.

  2. Kartik

    It take continuous photo how to it on pir sensor

    1. techstudycell

      Please check for any loose connection. And I have used an active high PIR sensor. So when it senses any motion the output pin will be high. Check your PIR sensor is Active high or active low.

  3. STKK

    Hi, the info is very useful, thanks a lot.
    The code works. However, I found a problem when setting my blynk(or my phone) is not using the same WIFI(home wifi), the image in the blynk app never be updated again, but the take-picture button can still control the esp32 cam to capture photo(white LED flash). What is the likely reason? Thank you in advance!!!

    1. techstudycell

      To get the photo, the Blynk and ESP32CAM should be connected with the same WiFi.

  4. chandan

    How to save images received in blynk application?

  5. jason

    so when not connected to home wifi on your mobile you wont get notifications/

  6. chrysanthemum juice

    I always ᥙsed to reаⅾ article in news рapers but now as I am
    a user of web thus from noᴡ I am using net for contеnt, thankѕ
    to web.

  7. Dippa

    Hi, Would this work without:

    BC547 NPN Transistor
    220ohm, 1k, 10k Resistor.

    thus direct connecting to the pir sensor

  8. tasneem

    if it is possible to connect a relay to out pin of pir to on ac bulb instead of for better lighting for cam

  9. khush

    Arduino: 1.8.15 (Windows 10), Board: “ESP32 Wrover Module, Huge APP (3MB No OTA/1MB SPIFFS), QIO, 80MHz, 921600, None”

    esp32cam:37:25: fatal error: camera_pins.h: No such file or directory

    Multiple libraries were found for “WiFi.h”

    compilation terminated.

    Used: C:\Users\DELL\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi

    Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

    exit status 1

    camera_pins.h: No such file or directory

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    1. techstudycell

      Please check if the camera_pins.h file present in the same folder

  10. suvethaa

    what is the function of transistor BC54?

Leave a Reply