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)

PCB Design

After designing the schematic diagram of the WiFi Security Camera, the assembled components and wiring are too clumsy and looked very unprofessional. In fact, the wiring also has a chance of loose connection. To give it a clean and professional look and also to compress the size, I decided to build its PCB prototype using EasyEDA software as it is so simple to use. Now come to the main part, where we need to order our PCB prototype. I always prefer PCBWay for their quality assurance, fastest delivery and also for 24/7 customer support.

PCB View

ESP32-CAM Security Camera 2D View
2D View
ESP32-CAM Security Camera 3D View
3D View

Why I Choose PCBWay as My First Preference?

I’ve done several runs with PCBWay and am happy with the results, it’s good quality. It is one of the most experienced PCB manufacturing companies based in China with an experience of more than a decade in the field of PCB prototype and fabrication. PCBWay has always been committed to technological innovation and meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. The etching, solder mask, and hole sizes are all done well and that is what matters to me. It takes a few hours for a design to get approved and then a couple of days to finish and ship.

With more than a decade in the field of PCB prototypes and fabrication, PCBWay has proved its assurance from time to time. They always look at the customer’s needs from different regions in terms of quality, on-time delivery, cost-effectiveness and any other demanding requests.

PCBWay Gold Finish
PCBWay Thickness

These PCBs were manufactured by PCBWay and the finish quality really impressive, especially with the gold finish path. If you want to finish your product faster you could also ask PCBWay to make a panelized order where you receive multiple PCBs in a single panel. With this, you will also receive SMT Stencil from PCBWay, saving you time and effort. All the orders are high quality and could select a lot of settings such as thickness, flexible PCB, the colour of the solder masks, the number of layers, material, surface finish and more.

PCBWay different types of solder masks

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