IOT

DIY Surveillance CCTV Camera using ESP32 CAM & Blynk

In this blog, we will design our own DIY Surveillance CCTV Camera by using the ESP32 CAM and the Blynk Application in this project. We learned about the ESP32 CAM Module and video streaming over the internet using a Web Server in the last project.

This time, we’ll make a DIY CCTV camera for use in home security systems. We’ll use the ESP32 CAM Module to build the CCTV Camera once more. CCTV cameras will be more expensive than the ESP32 CAM Board. Any web platform can be used to fix it and view the live feed. The Blynk Application is the greatest solution for online video monitoring and data streaming. The Blynk app is compatible with both iOS and Android devices. Data from real-time video streaming can be viewed.

Hardware Required:

  • ESP32-CAM Board-AI-Thinker ESP32 Camera Module
  • FTDI Module-USB-to-TTL Converter Module
  • USB Cable-5V Mini-USB Data Cable
  • Jumper Wires-Female to Female Connectors

ESP32 CAM Module

The ESP32 Based Camera Module was developed by AI-Thinker.  The controller contains a Wi-Fi + Bluetooth/BLE chip and is powered by a 32-bit CPU. It has a 520 KB internal SRAM and an external 4M PSRAM. UART, SPI, I2C, PWM, ADC, and DAC are all supported by its GPIO Pins.

The module is compatible with the OV2640 Camera Module, which has a camera resolution of 1600 x 1200 pixels. A 24-pin gold plated connector links the camera to the ESP32 CAM Board. A 4GB SD Card can be used on the board. The photographs captured are saved on the SD Card.

ESP32-CAM Features 

  • The smallest 802.11b/g/n Wi-Fi BT SoC module.
  • Low power 32-bit CPU, can also serve the application processor.
  • Up to 160MHz clock speed, summary computing power up to 600 DMIPS.
  • Built-in 520 KB SRAM, external 4MPSRAM.
  • Supports UART/SPI/I2C/PWM/ADC/DAC.
  • Support OV2640 and OV7670 cameras, built-in flash lamp.
  • Support image WiFI upload.
  • Supports TF card.
  • Supports multiple sleep modes.
  • Embedded Lwip and FreeRTOS.
  • Supports STA/AP/STA+AP operation mode.
  • Support Smart Config/AirKiss technology.
  • Support for serial port local and remote firmware upgrades (FOTA).

ESP32-CAM FTDI Connection

There is no programmer chip on the PCB. So, any form of USB-to-TTL Module can be used to program this board. FTDI Modules based on the CP2102 or CP2104 chip, or any other chip, are widely accessible.

  • Connect the FTDI Module to the ESP32 CAM Module as shown below.
ESP32 CAM FTDI Module Connection
ESP32-CAMFTDI Programmer
GNDGND
5VVCC
U0RTX
U0TRX
GPIO0GND

Connect the ESP32’s 5V and GND pins to the FTDI Module’s 5V and GND. Connect the Rx to UOT and the Tx to UOR Pin in the same way. The most crucial thing is that you must connect the IO0 and GND pins. The device will now be in programming mode. You can remove it once the programming is completed.

Project PCB Gerber File & PCB Ordering Online

If you don’t want to put the circuit together on a breadboard and instead prefer a PCB. EasyEDA’s online Circuit Schematics & PCB Design tool was used to create the PCB Board for the ESP32 CAM Board. The PCB appears as seen below.

The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from https://www.nextpcb.com/

Download Gerber File: ESP32-CAM Multipurpose PCB

Now you can visit the NextPCB official website by clicking here: https://www.nextpcb.com/. So you will be directed to the NextPCB website.

  • You can now upload the Gerber File to the Website and place an order. The PCB quality is excellent. That is why the majority of people entrust NextPCB with their PCB and PCBA needs.
  • The components can be assembled on the PCB Board.

DIY CCTV Camera Source Code/Program

Let’s look at the ESP32 CAM and Blynk Application source code/program. You may grab the code from the following Github link.

Download Source Code/Program

Unzip the entire folder after downloading it. Then, finally, open the esp32-cam-mjpeg into the file.

You’ll need to tweak this code a little. Uncomment the model you’re using to select the Camera Module. Uncomment the AI-Thinker Portion and comment on the rest of the part if you’re using AI-Thinker Board.

//#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 should also change the SSID and password for your WiFi.
const char* ssid = “*********”;
const char* password = “*********”;
  • Go to the toolbox. After that, choose the ESP32 Board. Select AI-Thinker ESP32-CAM from the list.
  • After that, connect the FTDI Module to your computer and choose the COM Port.
  • You may now upload the code.

Monitoring Video Streaming on WebServer

Open the Serial Monitor once the upload is complete. Disconnect the IO0 and GND jumpers. On the board, press the reset button. The WiFi network will be established on the device.

And it will show a link with an IP address and an MJPEG link, such as http://192.168.1.75/mjpeg/1. Copy the URL and paste it into your preferred browser. The video will begin to stream after you press enter.

DIY Surveillance CCTV Camera using ESP32 CAM & Blynk

Let’s now use the Blynk App to watch the video online. So go to the  Playstore (Android) or Appstore (IoS).and get the Blynk app (IoS).

After that, open it. Make a new project and name it anything. Then choose the ESP32 Board from the select-down menu. Then select Create. This will generate an authentication token, but it will be useless in this project.

Select video streaming from the widgets list. Click on this blank space and type in the IP address in its entirety, beginning with HTTP.

After that, use the play/pause button. The widget will now display the video. However, there is a delay in the video that has yet to be determined. However, the ESP32 CAM is compatible with Blynk and can be used as a surveillance or CCTV camera.

.

Using DIY CCTV Camera as a Security Device

Let’s put this device outside the front gate and use it as a security system. Thus, I had designed a battery-powered PCB and installed it at the main door. Except for the camera, all batteries and supplies are placed inside.

You don’t have to go outside to see who is at the door when someone rings the doorbell. You can instead keep track of it on your phone. When connected to a WiFi network, the ESP32 CAM will transmit video on a regular basis.

Simply pick up your phone and open the Blynk application to see who is around. This is the simplest and most straightforward method for installing a CCTV camera in your home.

Conclusion
I hope all of you understand how to design DIY Surveillance CCTV Camera using ESP32 CAM & Blynk. We MATHA ELECTRONICS will be back soon with more interesting blogs.

Leave a Reply

Your email address will not be published.