ESP32-CAM Wireless WiFi Security Camera

In this tutorial, we will learn how to build a wireless ESP32-CAM WiFi Security Camera which is very popular today to monitor our home, surrounding environment, office, shop, etc.

Even decent commercial WiFi Security Cameras aren’t also expensive, but they still cost quite a bit especially when you’re planning to buy several of them for a home security system. In this project, you will learn how to make your own DIY Surveillance Camera for under $10 depending on the supplies you used for clarification. This project will be based on the $8 ESP32-CAM AI thinker WiFi camera module, one of the best and cheapest camera development boards in the market.

With a unique IP address, you can directly log into the web server through your web browser, and view exactly what the camera sees. In future, we will add recording features as well (WiFi CCTV Camera with advanced controls). The security camera has some more features which will be discussed in another tutorial.

So without taking up any more time, let’s make this incredible project for our home.


ESP32-Cam WiFi Security Camera

Circuit Diagram

ESP32-CAM Security Camera Circuit Diagram

Components Required

  • ESP32-CAM Board
  • FTDI USB to Serial Converter
  • 5 Volt AC to DC Converter
  • Connection Wire
  • Container (Dummy CCTV Camera Kit)

Programming ESP32-CAM WiFi Security Camera

First, to program the ESP32-CAM module, first, connect the module to a USB-to-Serial FTDI converter as shown in the schematic below.

ESP32-CAM Security Camera To FTDI Converter Connection Circuit Diagram
ESP32-Cam To FTDI Module Connection

To program and be ready to upload the code to the ESP32-CAM module, connect GPIO pin 0 to the ground as mentioned above schematic. Also need to press the reset button to set it to flash mode before uploading the code.

Before uploading the code, make sure that you have the “” link pasted into the preferences tab of the Arduino IDE. This link provides you access to example codes, libraries you need, etc.

Make sure your ESP32 board library version is at 2.0.2 or higher

Copy the whole Security Camera’s code from below and paste it into the Arduino IDE software. After that fill in all the necessary parameters such as selecting your camera model (uncomment “CAMERA_MODEL_AI_THINKER” if that’s your board and comment the unnecessary board type), and enter your WiFi credentials, and password.

ESP32-CAM Code

Make sure you select “ESP32 Dev Module” with partition scheme “Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)”, enable PSRAM, and select your COM port. Then press upload. If any errors occur, then make sure that all the necessary libraries are installed.

ESP32-CAM Arduino IDE Settings

When you start to see these connection dots on the debugging window as shown below, press the ESP32-CAM on-board reset button.

ESP32-CAM Code Compile

ESP32-CAM Code

Make sure to unplug the wire between IO0 and GND and press the reset button. Then insert a Micro SD card into the SD card slot (Min 4GB), then obtain a unique IP address from the Arduino IDE serial monitor.

Preparing ESP32-CAM and Getting IP Address


Troubleshooting of ESP32-CAM Security Camera

  • Failed to connect to ESP32: Timed out waiting for packet header
  • Camera init fell with error 0x20001 or similar
  • Brownout detector or Guru meditation error
  • Sketch too big error – Wrong partition scheme selected
  • Board at COMX is not available – COM Port Not Selected
  • Psram error: GPIO isr service is not installed
  • Weak Wi-Fi Signal
  • No IP Address in Arduino IDE Serial Monitor
  • Can’t open web server
  • The image lags/shows lots of latency

Leave a Comment