ESP32-CAM Arduino Source Code (CCTV Video Recorder and IP Camera)

Other projects from this group

ESP32-CAM Arduino Source Code (CCTV Video Recorder and IP Camera)

With this source code, an “ESP32-CAM” module and a 5.0v power source, build a CCTV/IP camera with motion sensing.

Arduino ESP32-CAM CCTV, WiFi IP Camera Source Code - Rev 1.2



Other projects from this group


The "AI Thinker ESP32-CAM" module has a 2MP Camera, 10 I/O pins, on-board LED, on-board flash light and a MicroSD slot to store the images and videos. With its tiny sized camera and 240MHz CPU is able to provide a fair quality images. This project is a source code which lets you to handle the camera and use the module’s special features.

Compilation and programming of this source code is compatible with “Arduino ESP32” rev 1.0.6

And all you need to use is just a web browser.

esp32-cam arduino

This project contains two folders ESP32CamProgram (the Arduino source code) and PHP Script (For server use option).

The source code contains 7 files:

  1. ESP32CamProgram.ino – the main program
  2. AC.ino (camera and autoconnect configuration)
  3. AC.h (settings and configuration headerfile)
  4. CamSettings.h (Camera settings)
  5. CamCapture.ino (Capturing and storing the images)
  6. CamMemory.ino (Video player/images gallery)
  7. CamPages.ino (Internal pages)

After upload run the program in “normal mode”.

Then in case you are using ESP32-Cam, the red LED on the board would be turned on for 1 second then turns off. Then you’ll be able to see the module’s hot spot ssid via the WiFi networks in your PC or smart phone.

The default SSID is WiCardAC and the default password is 12345678. Connect and go to with a web browser.

The WiFi autoconnect configuration page:

esp32-cam arduino wifi

In the “Modem Configuration” section, you’re able to view/edit the SSID and password of WiFi modem/router and then click on “Save” after inserting. The module would connect to the modem after about 30 seconds in case of validity of ssid and password.

  • This page is also available via the DHCP IP of the module.

In the “Device Hot Spot Configuration“ section, you can set the module hotspot’s SSID and password. Also you can set a password for the internal page with Secure Link section. (Example: the secure link is ABCD and the root page would be at address)

The “Hidden HotSpot” button will set the module’s hot spot as hidden hotspot and the “Disable HotSpot when is connected to the modem” would disable the module’s hotspot, when is connected to the modem.

The Camera Configuration Section:

esp32-cam arduino settings

With “Enable Recording” button you can enable or disable the motion sensor.

After the configuration click on save button and re-start the module.

Video Streaming Page

This page is at the root address ( or the router’s given IP) and works as a CCTV camera and you can see the live video.

Is case of placing a MicroSD card, with click or tapping on the stream video, the module takes a picture (the stream freezes for 2 seconds).

It you click or tap twice, the white LED of the ESP32-CAM turns on or toggles off.

  • The light of scene increases images quality.
  • Do not keep the white LED on for a long time.
  • Better to use a suitable heatsink for the module’s regulator.
  • Better to use a 5V-2A power source.
  • The WiFi signal strength takes effect on the module capability and the video streams.

Memory Page

The memory page is located at (or with the DHCP IP) and shows the memory’s images and videos.

The video’s format is .JP4 and only just the module can play them. With tap on the image of video, the video would play and pause.

- The WebApp appearance (Web UI) changed
- SPI mode added
- Supports FAT32 and newer microSD cards
- Flash light during recording
- PIR input added
- SecretLink bug fixed


-Motion Sensor

-Recoding videos

-Playing videos and images

-Camera configuration

-Server option

-Internal pages secure link

-Server script

-Shop MAC and IP in config page


-Video stream

-Saving the images

-LED toggle on/off

-Set module hotspot and modem’s ssid and password

-Automatically connection to the modem

-Config page

-Hidden hotspot button

-Disable hotspot button

Similar Projects: