Overview: DIY Surveillance CCTV Camera
In this project, we will make our own DIY Surveillance CCTV Camera using ESP32 CAM & Blynk Application. In the previous project, we learned about the ESP32 CAM Module and also about the streaming of video online via a Web Server.
This time we will be making a DIY CCTV Camera for home security system applications. For making the CCTV Camera, we will use the ESP32 CAM Module again. The ESP32 CAM Board will cost lower than CCTV cameras. You can fix it and watch the live streaming on any online platform. To monitor the video online and stream the data, the Blynk Application is the best option. The Blynk Application is available for both IOS & Android platforms. The real-time video streaming data can be monitored online on Blynk Server. So let us see how we can implement this entire system.
Bill of Materials
Following are the list of components for making ESP32 Based DIY Surveillance CCTV Camera. You can purchase all the components online from Amazon.
| S.N. | Components | Quantity | Purchase Links |
|---|---|---|---|
| 1 | ESP32-CAM Board AI-Thinker | 1 | Amazon | AliExpress |
| 2 | FTDI Module | 1 | Amazon | AliExpress |
| 3 | Micro-USB Cable | 1 | Amazon | AliExpress |
| 4 | Jumper Wires | 10 | Amazon | AliExpress |
ESP32 CAM Module
The ESP32 Based Camera Module developed by AI-Thinker. The controller is based on a 32-bit CPU & has a combined Wi-Fi + Bluetooth/BLE Chip. It has a built-in 520 KB SRAM with an external 4M PSRAM. Its GPIO Pins have support like UART, SPI, I2C, PWM, ADC, and DAC.
The module combines with the OV2640 Camera Module which has the highest Camera Resolution up to 1600 × 1200. The camera connects to the ESP32 CAM Board using a 24 pins gold plated connector. The board supports an SD Card of up to 4GB. The SD Card stores capture images.
To learn in detail about the ESP32 Camera Module you can refer to our previous Getting Started Tutorial.
ESP32-CAM FTDI Connection
The board doesn’t have a programmer chip. So In order to program this board, you can use any type of USB-to-TTL Module. There are so many FTDI Module available based on CP2102 or CP2104 Chip or any other chip.
Make a following connection between FTDI Module and ESP32 CAM module.
| ESP32-CAM | FTDI Programmer |
|---|---|
| GND | GND |
| 5V | VCC (5V) |
| U0R | TX |
| U0T | RX |
| GPIO 0 | GND |
Connect the 5V & GND Pin of ESP32 to 5V & GND of FTDI Module. Similarly, connect the Rx to UOT and Tx to UOR Pin. And the most important thing, you need to short the IO0 and GND Pin together. This is to put the device in programming mode. Once programming is done you can remove it.
Project PCB Gerber File & PCB Ordering Online
If you don’t want to assemble the circuit on a breadboard and you want PCB for the project, then here is the PCB for you. The PCB Board for ESP32 CAM Board is designed using EasyEDA online Circuit Schematics & PCB designing tool. The PCB looks something like below.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from ALLPCB at 1$ only.
You can use this Gerber file to order high quality PCB for this project. To do that visit the ALLPCB official website by clicking here: https://www.allpcb.com/.
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
You can assemble the components on the PCB Board.
DIY CCTV Camera Source Code/Program
Let us see the source code/program for ESP32 CAM & Blynk Application. You can visit the following Github Link & find download the Code.
Download the entire folder and unzip it. Then finally open the ino file for esp32-cam-mjpeg.
You need to modify this code a little bit. Select the Camera Module by uncommenting the model that you are using. If you are using AI-Thinker Board uncomment the AI-Thinker Part and comment rest of the part.
|
1 2 3 4 5 6 7 8 |
//#define CAMERA_MODEL_WROVER_KIT // Has PSRAM //#define CAMERA_MODEL_ESP_EYE // Has PSRAM //#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM //#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM //#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM //#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM #define CAMERA_MODEL_AI_THINKER // Has PSRAM //#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM |
You also need to change your WiFi SSID and Password.
|
1 2 |
const char* ssid = "*********"; const char* password = "*********"; |
Go to tools. Then select the ESP32 Board. And from the list select AI-Thinker ESP32-CAM.
Then connect the FTDI Module to your Computer and select the COM Port.
Now you can upload the code.
Monitoring Video Streaming on WebServer
Once uploading is done open the Serail Monitor. Remove the IO0 & GND Jumper Connection. Press the reset button on the board. The device will get connected to the WiFi Network.
And it will display some type of link that has an IP address and MJPEG link like http://192.168.1.75/mjpeg/1. Copy the link and open the link in your favorite web browser. After you hit enter, the video streaming will start.
DIY Surveillance CCTV Camera using ESP32 CAM & Blynk
Now let’s use the Blynk Application to stream the video online. So download the Blynk Application from the Playstore (Android) or Appstore (IoS).
Then open it. Create a New Project. Name it anything. Then select the ESP32 Board from the list. Then click on create. An authentication token will be created here but is of no use in this project.
From the widgets list, select the video streaming. Click on this blank space and here you need to enter the IP Address complete link starting from the HTTP.
Once done, click on this play pause button. The video will appear now on the widget. But the problem is there is a lag in the video and the reason is unknown. But anyway the ESP32 CAM is working with Blynk and you can use it as a CCTV or Surveillance Camera.
Using DIY CCTV Camera as a Security Device
Now let’s place this device outside the house gate and use it as a security system device. So I made a small battery-powered PCB and placed it at the main door. All the batteries and accessories are placed inside except the camera part.
Whenever someone comes and rings the doorbell, you don’t have to go outside and check who is there. Rather you can monitor it on your mobile phone. The ESP32 CAM will do the video streaming regularly when connected to the WiFi Network.
Simply pick your mobile phone & open Blynk Application and check who is there. This is the simplest and easiest way to make a CCTV Camera at your home. Instead of spending hundreds of dollars, you can get it done at 10 dollars only.
You can also automatically upload ESP32 CAM captured images to Google Drive or build an ESP32 AI Camera for object detection.























