Video Capture Using the ESP32-CAM Board




Introduction: Video Capture Using the ESP32-CAM Board

About: #BnBe is a platform to help teach electronics no matter what the age or skill level. We’re currently designing a wide range of products from beginner level kits to industry-standard microcontroller platforms.

We take a look at a very interesting GitHub repository that enables video recording on the ESP32-CAM board. A video is nothing but a series of carefully timed images, and this sketch is based on that. The team have also added FTP functionality to the sketch which means that you can retrieve the files remotely, over the same WiFi network, without having to retrieve the microSD card.

The video above covers everything you need to know and also explains how to use the FTP feature.

Step 1: Gather the Electronics

The ESP32-CAM board already contains the camera module, and microSD card slot that we need for this sketch. In addition to this, you will need a microSD card, a microUSB breakout board (optional), and also a USB to serial converter to upload the sketch.

Step 2: Edit & Upload the Sketch

You can download the sketch using the following link:

The ESP32-CAM board does not have an onboard USB connector so you need to use an external USB to serial converter to upload the sketch. You can use the wiring connections shown above but make sure that the USB to serial converter is connected in the 3.3V mode.

It is recommended to use an external 5V supply to power the board, particularly if you are using an FTDI breakout board. For the external 5V supply, a simple USB breakout board will do just fine. There has been some success in powering the board directly from the CP2102 breakout board so you can try that first. The board also has a 3.3V power pin if needed.

The jumper is needed to put the board in the download mode. Once you have everything connected, power up the board, open a serial terminal (Tools->Serial Monitor) with a baud rate of 115, 200 and press the reset button. You should obtain the debug output as shown in the image and this will indicate that everything is working as expected.
You can now upload the code by pressing the upload button. Wait for it to complete, then remove the jumper and press the reset button to obtain the final output which will indicate that the recording has started.

Step 3: Disable Flash by Modifying the Board

This bit is optional but you can disable the onboard LED flash by lifting a transistor pin on the board. Since the LED flash control line is shared with the microSD card, it will light up and toggle when the microSD card is being accessed. The GitHub page shows you how to make this change and it is completely reversible so you can always enable it later.

If you don't feel like making this change then you can simply block the LED flash if it is causing a disturbance.

Step 4: Control the Board

The board will print out the IP address once it connects to the WiFi network. You can type this into the web browser to access the control pages. The sketch also associates the hostname desklens.local to the board and you can type this into the address bar instead of the IP address. The pages contain hints to get you started and you can even specify the recording settings directly into the address bar.

The sketch also creates a basic FTP server and you can access the microSD card contents by using this feature. It is recommended to use a FTP client for this and the video walks you through the steps of using FileZilla.

If you've liked this post, then don't forget to follow us using the links below as we will be building many more projects like this one:

Be the First to Share


    • First Time Author Contest

      First Time Author Contest
    • Sculpt & Carve Challenge

      Sculpt & Carve Challenge
    • Backyard Contest

      Backyard Contest



    3 months ago

    你好,为什么avi 写入时出错


    8 months ago

    Hi, even the sketch didn't load, it shows errors. Please give someone a correct sketch. Or I misunderstood something ...
    (exit status 1
    suggest explicit braces to avoid ambiguous 'else' [-Werror=parentheses]
    (exit status 1
    no return statement in function returning non-void [-Werror=return-type]
    When correcting the first errors, the second appear.
    There are many such mistakes, they are repeated.


    1 year ago

    Hey there, I understand there are various forums that revolve around this issue, but I haven't been able to get anywhere.

    The problem is that the program says, "E (13023) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107Failed to mount SD card VFAT filesystem. Error: ESP_ERR_TIMEOUT".

    I've tried a different micro SD card and wire and FTDI and still nothing. I've checked my wiring and have used the reset button accordingly. I've formated the SD card to FAT32 correctly and have made sure to use 3.3v logic to the FTDI and an external 5v power supply.


    1 year ago

    Sadly the given program doesn't work at all! Wifi never works! Uploading the ino code was no problem but the given code somehow is incomplete or bugged! These instructions on Youtube and other websites look so easy but if the presented code doesn't work they are nothing more then useless instruction videos!


    Question 2 years ago

    hello dear,
    I'm are trying to create a webcam related project for my mca final year projects, in which we are trying to do a simple auto video stream when the server started and record & auto saved video into SD card on a server off, In UI lIke one I given in screenshot, I'm trying the code that you are provided in the tutorial. it's working very fine as you mention, not as I'm expecting. I'm trying to modify your code but I didn't get success. Please modify the code and remove the unnecessary code from that....please help me out...


    Annotation 2020-07-05 162727.pngAnnotation 2020-07-07 122247.png