{"id":88137,"date":"2025-04-11T07:58:00","date_gmt":"2025-04-11T07:58:00","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=88137"},"modified":"2025-04-11T17:12:47","modified_gmt":"2025-04-11T17:12:47","slug":"esp32-cam-pir-motion-detector-photo-capture","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-cam-pir-motion-detector-photo-capture\/","title":{"rendered":"ESP32-CAM PIR Motion Detector with Photo Capture (saves to microSD card)"},"content":{"rendered":"\n<p>In this project, we\u2019re going to make a motion sensor detector with photo capture using an ESP32-CAM. When the PIR sensor detects motion, the ESP32 wakes up, takes a photo, and saves it on the microSD card.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Detector-Photo-Capture.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Motion Detection with Photo Capture (saves to microSD card)\" class=\"wp-image-168850\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Detector-Photo-Capture.jpg?w=1920&amp;quality=100&amp;strip=all&amp;ssl=1 1920w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Detector-Photo-Capture.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Detector-Photo-Capture.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Detector-Photo-Capture.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Detector-Photo-Capture.jpg?resize=1536%2C864&amp;quality=100&amp;strip=all&amp;ssl=1 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclgray\"><em>Updated 11 April 2025<\/em><\/p>\n\n\n\n<p>This project <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-take-photo-save-microsd-card\/\">is very similar to a previous one<\/a>, but after many requests, we added a PIR motion sensor to the circuit. So, when motion is detected a picture is taken and saved on the microSD card.<\/p>\n\n\n\n<p>Other ESP32-CAM projects and tutorials:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-face-recognition-arduino-ide\/\">ESP32-CAM Video Streaming with Arduino IDE<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-take-photo-save-microsd-card\/\">ESP32-CAM Take Photo and Save to MicroSD Card<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-take-photo-display-web-server\/\" target=\"_blank\" rel=\"noreferrer noopener\">Take Photo, Save to SPIFFS and Display in Web Server<\/a> <\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-troubleshooting-guide\/\">ESP32-CAM Troubleshooting Guide<\/a><\/li>\n<\/ul>\n\n\n\n<p>We have a similar project using a Raspberry Pi and a camera module:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-motion-detector-photo-capture\/\">Raspberry Pi Motion Detector with Photo Capture<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Watch the Video Tutorial<\/h2>\n\n\n\n<p>You can watch the video tutorial or continue reading for the complete project instructions.<\/p>\n\n\n<p style=\"text-align:center\"><iframe width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/LBoM_Uoq_nA?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts Required<\/h2>\n\n\n\n<p>For this project, you&#8217;ll need the following parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/makeradvisor.com\/tools\/esp32-cam\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP32-CAM with OV2640<\/a><\/strong> &#8211; read <a aria-label=\"Best ESP32-CAM Dev Boards (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/esp32-camera-cam-boards-review-comparison\/\" target=\"_blank\" rel=\"noreferrer noopener\">Best ESP32-CAM Dev Boards<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/microsd-card-raspberry-pi-16gb-class-10\/\" target=\"_blank\" rel=\"noreferrer noopener\">MicroSD card<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/mini-hc-sr505-pir-motion-sensor\/\" target=\"_blank\" rel=\"noreferrer noopener\">PIR motion sensor<\/a> <\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/ftdi-programmer-board\/\" target=\"_blank\" rel=\"noreferrer noopener\">FTDI programmer<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\" rel=\"noreferrer noopener\">Female-to-female jumper wires<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-power-supply\/\" target=\"_blank\" rel=\"noreferrer noopener\">5V power supply for ESP32-CAM<\/a>&nbsp;or power bank (optional)<\/li>\n<\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Project Overview<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"713\" height=\"253\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/Motion-detector-photo-capture-project-overview.png?resize=713%2C253&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Motion Detector with Photo Capture Project Overview\" class=\"wp-image-88358\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/Motion-detector-photo-capture-project-overview.png?w=713&amp;quality=100&amp;strip=all&amp;ssl=1 713w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/Motion-detector-photo-capture-project-overview.png?resize=300%2C106&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/><\/figure><\/div>\n\n\n<p>Here is a quick overview of how the project works.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The ESP32-CAM is in <a href=\"https:\/\/randomnerdtutorials.com\/esp32-external-wake-up-deep-sleep\/\">deep sleep mode with external wake up<\/a> enabled.<\/li>\n\n\n\n<li>When motion is detected, the <a href=\"https:\/\/randomnerdtutorials.com\/esp32-pir-motion-sensor-interrupts-timers\/\">PIR motion sensor<\/a> sends a signal to wake up the ESP32.<\/li>\n\n\n\n<li>The ESP32-CAM takes a photo and saves it on the microSD card.<\/li>\n\n\n\n<li>It goes back to deep sleep mode until a new signal from the PIR motion sensor is received.<\/li>\n<\/ul>\n\n\n\n<p><strong>Recommended reading:<\/strong> <a href=\"https:\/\/randomnerdtutorials.com\/esp32-deep-sleep-arduino-ide-wake-up-sources\/\">ESP32 Deep Sleep with Arduino IDE and Wake Up Sources<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before proceeding, make sure you check the following prerequisites.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Formatting the MicroSD Card<\/h3>\n\n\n\n<p>The first thing we recommend doing is formatting your microSD card. You can use the Windows formatter tool or any other microSD formatter software.<\/p>\n\n\n\n<p><strong>1.<\/strong>\u00a0Insert the microSD card into your computer. Go to\u00a0<strong>My Computer<\/strong>\u00a0and right-click on the SD card. Select\u00a0<strong>Format<\/strong>\u00a0as shown in the figure below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/rntlab.com\/wp-content\/uploads\/2018\/05\/format-SD-card-1.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Formatting your microSD card Windows\" class=\"wp-image-11805\"\/><\/figure><\/div>\n\n\n<p><strong>2.&nbsp;<\/strong>A new window pops up. Select&nbsp;<strong>FAT32<\/strong>, press&nbsp;<strong>Start<\/strong>&nbsp;to initialize the formatting process and follow the onscreen instructions.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/rntlab.com\/wp-content\/uploads\/2018\/05\/format-SD-card-2.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Formatting your microSD card Windows\" class=\"wp-image-11806\"\/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclblue\"><strong>Note: <\/strong> according to the product specifications, the ESP32-CAM should only support 4 GB SD cards. However, we\u2019ve tested with 16 GB SD card and it works well.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing the ESP32 Boards in Arduino IDE<\/h3>\n\n\n\n<p>We&#8217;ll program the ESP32 board using Arduino IDE. So, you need the Arduino IDE installed as well as the ESP32 boards. Follow the next tutorial if you haven&#8217;t already.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/installing-esp32-arduino-ide-2-0\/\" title=\"\">Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Deep Sleep with External Wake Up<\/h2>\n\n\n\n<p>In this project, the ESP32-CAM will be in deep sleep mode, and it will wake up with an external wake-up source (the PIR motion sensor sends a HIGH signal when it detects motion).<\/p>\n\n\n\n<p>Only RCT GPIOs can be used as a wake-up source. The ESP32 RTC GPIOs are: 0, 2, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33,34, 35, 36, and 39.<\/p>\n\n\n\n<p>Let\u2019s recap the ESP32-CAM pinout.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-ai-thinker-pinout\/\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1000\" height=\"445\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-pinout-new.png?resize=1000%2C445&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-94760\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-pinout-new.png?w=1000&amp;quality=100&amp;strip=all&amp;ssl=1 1000w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-pinout-new.png?resize=300%2C134&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-pinout-new.png?resize=768%2C342&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/figure><\/div>\n\n\n<p><strong>GPIO 4<\/strong>, <strong>GPIO 2<\/strong>, <strong>GPIO 14<\/strong>, <strong>GPIO 15<\/strong>, <strong>GPIO 13,<\/strong> and <strong>GPIO 12<\/strong> are all used by the microSD card. But, if we use the microSD card in 1-bit mode, we can free up GPIOs 12, and 13. That&#8217;s what we&#8217;re going to do: we&#8217;ll use the microSD card in 1-bit mode and GPIO 13 to connect to the PIR motion sensor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ESP32-CAM Take Photo with PIR Motion Sensor &#8211; Code<\/h2>\n\n\n\n<p>Copy the following code to your Arduino IDE.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*********\n  Rui Santos &amp; Sara Santos - Random Nerd Tutorials\n  Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-cam-pir-motion-detector-photo-capture\/\n \n  IMPORTANT!!!\n   - Select Board &quot;AI Thinker ESP32-CAM&quot;\n   - GPIO 0 must be connected to GND to upload a sketch\n   - After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode\n   \n  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.\n  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n*********\/\n \n#include &quot;esp_camera.h&quot;\n#include &quot;Arduino.h&quot;\n#include &quot;FS.h&quot;                \/\/ SD Card ESP32\n#include &quot;SD_MMC.h&quot;            \/\/ SD Card ESP32\n#include &quot;soc\/soc.h&quot;           \/\/ Disable brownout problems\n#include &quot;soc\/rtc_cntl_reg.h&quot;  \/\/ Disable brownout problems\n#include &quot;driver\/rtc_io.h&quot;\n#include &lt;EEPROM.h&gt;            \/\/ read and write from flash memory\n\/\/ define the number of bytes you want to access\n#define EEPROM_SIZE 1\n \nRTC_DATA_ATTR int bootCount = 0;\n\n\/\/ Pin definition for CAMERA_MODEL_AI_THINKER\n#define PWDN_GPIO_NUM     32\n#define RESET_GPIO_NUM    -1\n#define XCLK_GPIO_NUM      0\n#define SIOD_GPIO_NUM     26\n#define SIOC_GPIO_NUM     27\n#define Y9_GPIO_NUM       35\n#define Y8_GPIO_NUM       34\n#define Y7_GPIO_NUM       39\n#define Y6_GPIO_NUM       36\n#define Y5_GPIO_NUM       21\n#define Y4_GPIO_NUM       19\n#define Y3_GPIO_NUM       18\n#define Y2_GPIO_NUM        5\n#define VSYNC_GPIO_NUM    25\n#define HREF_GPIO_NUM     23\n#define PCLK_GPIO_NUM     22\n \nint pictureNumber = 0;\n  \nvoid setup() {\n  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); \/\/disable brownout detector\n  Serial.begin(115200);\n \n  Serial.setDebugOutput(true);\n \n  camera_config_t config;\n  config.ledc_channel = LEDC_CHANNEL_0;\n  config.ledc_timer = LEDC_TIMER_0;\n  config.pin_d0 = Y2_GPIO_NUM;\n  config.pin_d1 = Y3_GPIO_NUM;\n  config.pin_d2 = Y4_GPIO_NUM;\n  config.pin_d3 = Y5_GPIO_NUM;\n  config.pin_d4 = Y6_GPIO_NUM;\n  config.pin_d5 = Y7_GPIO_NUM;\n  config.pin_d6 = Y8_GPIO_NUM;\n  config.pin_d7 = Y9_GPIO_NUM;\n  config.pin_xclk = XCLK_GPIO_NUM;\n  config.pin_pclk = PCLK_GPIO_NUM;\n  config.pin_vsync = VSYNC_GPIO_NUM;\n  config.pin_href = HREF_GPIO_NUM;\n  config.pin_sccb_sda = SIOD_GPIO_NUM;\n  config.pin_sccb_scl = SIOC_GPIO_NUM;\n  config.pin_pwdn = PWDN_GPIO_NUM;\n  config.pin_reset = RESET_GPIO_NUM;\n  config.xclk_freq_hz = 20000000;\n  config.pixel_format = PIXFORMAT_JPEG;\n  config.grab_mode = CAMERA_GRAB_LATEST;\n  \n  pinMode(4, INPUT);\n  digitalWrite(4, LOW);\n  rtc_gpio_hold_dis(GPIO_NUM_4);\n \n  if(psramFound()){\n    config.frame_size = FRAMESIZE_UXGA; \/\/ FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA\n    config.jpeg_quality = 10;\n    config.fb_count = 2;\n  } else {\n    config.frame_size = FRAMESIZE_SVGA;\n    config.jpeg_quality = 12;\n    config.fb_count = 1;\n  }\n \n  \/\/ Init Camera\n  esp_err_t err = esp_camera_init(&amp;config);\n  if (err != ESP_OK) {\n    Serial.printf(&quot;Camera init failed with error 0x%x&quot;, err);\n    return;\n  }\n \n  Serial.println(&quot;Starting SD Card&quot;);\n \n  delay(500);\n  if (!SD_MMC.begin(&quot;\/sdcard&quot;, true)) { \/\/ true enables 1-bit mode to free up GPIOs\n    Serial.println(&quot;SD Card Mount Failed&quot;);\n    \/\/return;\n  }\n \n  uint8_t cardType = SD_MMC.cardType();\n  if(cardType == CARD_NONE){\n    Serial.println(&quot;No SD Card attached&quot;);\n    return;\n  }\n   \n  camera_fb_t * fb = NULL;\n \n  \/\/ Take Picture with Camera\n  fb = esp_camera_fb_get();  \n  if(!fb) {\n    Serial.println(&quot;Camera capture failed&quot;);\n    return;\n  }\n  \/\/ initialize EEPROM with predefined size\n  EEPROM.begin(EEPROM_SIZE);\n  pictureNumber = EEPROM.read(0) + 1;\n \n  \/\/ Path where new picture will be saved in SD Card\n  String path = &quot;\/picture&quot; + String(pictureNumber) +&quot;.jpg&quot;;\n \n  fs::FS &amp;fs = SD_MMC;\n  Serial.printf(&quot;Picture file name: %s\\n&quot;, path.c_str());\n \n  File file = fs.open(path.c_str(), FILE_WRITE);\n  if(!file){\n    Serial.println(&quot;Failed to open file in writing mode&quot;);\n  }\n  else {\n    file.write(fb-&gt;buf, fb-&gt;len); \/\/ payload (image), payload length\n    Serial.printf(&quot;Saved file to path: %s\\n&quot;, path.c_str());\n    EEPROM.write(0, pictureNumber);\n    EEPROM.commit();\n  }\n  file.close();\n  esp_camera_fb_return(fb);\n  \n  delay(1000);\n  \n  \/\/ Turns off the ESP32-CAM white on-board LED (flash) connected to GPIO 4\n  pinMode(4, OUTPUT);\n  digitalWrite(4, LOW);\n  rtc_gpio_hold_en(GPIO_NUM_4);\n\n  esp_sleep_enable_ext0_wakeup(GPIO_NUM_13, 1);\n  rtc_gpio_pullup_dis(GPIO_NUM_13);\n  rtc_gpio_pulldown_en(GPIO_NUM_13);\n \n  Serial.println(&quot;Going to sleep now&quot;);\n  delay(1000);\n  esp_deep_sleep_start();\n  Serial.println(&quot;This will never be printed&quot;);\n} \n \nvoid loop() {\n \n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP32-CAM-Arduino-IDE\/raw\/master\/ESP32-CAM-PIR-Photo-Capture\/ESP32-CAM-PIR-Photo-Capture.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>This code is similar to one of our previous ESP32-CAM projects, but it enables external wake-up on GPIO 13. We also disable pull-up internal resistors and enable pull-down internal resistors to make sure we don&#8217;t get false positives.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>  esp_sleep_enable_ext0_wakeup(GPIO_NUM_13, 1);\n  rtc_gpio_pullup_dis(GPIO_NUM_13);\n  rtc_gpio_pulldown_en(GPIO_NUM_13);<\/code><\/pre>\n\n\n\n<p>If you want to learn more about external wake-up with the ESP32, we recommend reading this guide:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-external-wake-up-deep-sleep\/\">ESP32 External Wake Up from Deep Sleep<\/a><\/li>\n<\/ul>\n\n\n\n<p>Additionally, we initialize the microSD card in 1-bit mode in the following lines.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (!SD_MMC.begin(\"\/sdcard\", true)) { \/\/ true enables 1-bit mode to free up GPIOs\n  Serial.println(\"SD Card Mount Failed\");\n  \/\/return;\n}<\/code><\/pre>\n\n\n\n<p>To learn more about the code, go to the following project:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-take-photo-save-microsd-card\/\">ESP32-CAM Take Photo and Save to MicroSD Card<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">ESP32-CAM Upload Code <\/h3>\n\n\n\n<p>To upload code to the ESP32-CAM board, connect it to your computer using an <a aria-label=\"FTDI programmer (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/ftdi-programmer-board\/\" target=\"_blank\" rel=\"noreferrer noopener\">FTDI programmer<\/a> or an <a href=\"https:\/\/randomnerdtutorials.com\/upload-code-esp32-cam-mb-usb\/\" title=\"\">ESP32-CAM MB programmer<\/a>.<\/p>\n\n\n\n<p>If you&#8217;re using an FTDI programmer, follow the next schematic diagram:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"532\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?resize=877%2C532&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM connected to an FTDI Programmer to upload program using Arduino IDE\" class=\"wp-image-159060\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?w=877&amp;quality=100&amp;strip=all&amp;ssl=1 877w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?resize=300%2C182&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?resize=768%2C466&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 877px) 100vw, 877px\" \/><\/figure><\/div>\n\n\n<p>Many FTDI programmers have a jumper that allows you to select 3.3V or 5V. Make sure the jumper is in the right place to select 5V.<\/p>\n\n\n\n<p class=\"rntbox rntcred\"><strong>Important: <\/strong> <span class=\"rnthl rntclgray\">GPIO 0<\/span> needs to be connected to <span class=\"rnthl rntcblack\">GND<\/span> so that you\u2019re able to upload code.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>ESP32-CAM<\/strong><\/td><td><strong>FTDI Programmer<\/strong><\/td><\/tr><tr><td>GND<\/td><td>GND<\/td><\/tr><tr><td>5V<\/td><td>VCC (5V)<\/td><\/tr><tr><td>U0R<\/td><td>TX<\/td><\/tr><tr><td>U0T<\/td><td>RX<\/td><\/tr><tr><td>GPIO 0<\/td><td>GND<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To upload the code, follow the next steps:<\/p>\n\n\n\n<p>1) Go to <strong>Tools <\/strong>&gt; <strong>Board <\/strong>and select <strong>AI-Thinker ESP32-CAM<\/strong>.<\/p>\n\n\n\n<p>2) Go to <strong>Tools <\/strong>&gt; <strong>Port <\/strong>and select the COM port the ESP32 is connected to.<\/p>\n\n\n\n<p>3) Then, click the upload button to upload the code.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"36\" height=\"39\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/05\/arduino-ide-2-upload-button.png?resize=36%2C39&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Arduino IDE 2 Upload Button\" class=\"wp-image-146269\"\/><\/figure><\/div>\n\n\n<p>4) When you start to see these dots on the debugging window as shown below, press the ESP32-CAM on-board RST button.   <\/p>\n\n\n\n<p>After a few seconds, the code should be successfully uploaded to your board. After that, you can disconnect GPIO 0 from GND, and open the Serial Monitor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Schematic Diagram<\/h2>\n\n\n\n<p>Wire the PIR motion sensor data pin to GPIO 13 as shown in the following diagram.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"448\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Sensor-Wiring.png?resize=1024%2C448&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM with Motion Sensor Wiring Diagram\" class=\"wp-image-168843\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Sensor-Wiring.png?resize=1024%2C448&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Sensor-Wiring.png?resize=300%2C131&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Sensor-Wiring.png?resize=768%2C336&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Sensor-Wiring.png?w=1089&amp;quality=100&amp;strip=all&amp;ssl=1 1089w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntcorange\">To prevent problems during upload, we recommend assembling the circuit only after uploading the code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>After uploading the code and assembling the circuit, insert a formatted microSD card to test your circuit.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-with-pir-motion-sensor.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM with a PIR Motion Sensor\" class=\"wp-image-168844\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-with-pir-motion-sensor.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-with-pir-motion-sensor.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Then, press the reset (RST) button, and it should start working. When it detects motion, it turns on the flash, takes a photo, and saves it on the microSD card. Then, it goes into deep sleep mode and wakes up again when motion is detected.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"301\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-SD-Card-Deep-Sleep-Serial-Monitor.png?resize=800%2C301&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM with PIR Motion Sensor - Save Photo to microSD card Serial Monitor Testing\" class=\"wp-image-168849\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-SD-Card-Deep-Sleep-Serial-Monitor.png?w=800&amp;quality=100&amp;strip=all&amp;ssl=1 800w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-SD-Card-Deep-Sleep-Serial-Monitor.png?resize=300%2C113&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-SD-Card-Deep-Sleep-Serial-Monitor.png?resize=768%2C289&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure><\/div>\n\n\n<p>Experiment with this circuit several times to make sure that it is working. Then, insert the microSD card into your computer to see the captured photos.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"214\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/ESP32-CAM-captured-photos-microSD-card.png?resize=750%2C214&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM takes photo when detects motion with PIR sensor photo demonstration\" class=\"wp-image-88380\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/ESP32-CAM-captured-photos-microSD-card.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/ESP32-CAM-captured-photos-microSD-card.png?resize=300%2C86&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Here&#8217;s an example:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"900\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/picture6.jpg?resize=1200%2C900&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM photo example captured\" class=\"wp-image-88406\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/picture6.jpg?w=1465&amp;quality=100&amp;strip=all&amp;ssl=1 1465w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/picture6.jpg?resize=300%2C225&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/picture6.jpg?resize=768%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/picture6.jpg?resize=1024%2C768&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p>Now you can finish this project the way you want. You can use a <a aria-label=\"dummy camera (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/dummy-fake-dome-security-camera\/\" target=\"_blank\" rel=\"noreferrer noopener\">dummy camera<\/a> and insert your ESP32-CAM with the PIR motion sensor, or you can build your own enclosure. Below, we show you two different options.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"421\" data-id=\"83406\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/03\/dummy-camera-fake.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-83406\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/03\/dummy-camera-fake.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/03\/dummy-camera-fake.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" data-id=\"98611\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/08\/ESP32-CAM-AI-Thinker-Module-Shield-PCB-Final-Demonstration-Fake-dummy-surveillance-camera.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM with PIR Motion Sensor and Dummy camera\" class=\"wp-image-98611\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/08\/ESP32-CAM-AI-Thinker-Module-Shield-PCB-Final-Demonstration-Fake-dummy-surveillance-camera.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/08\/ESP32-CAM-AI-Thinker-Module-Shield-PCB-Final-Demonstration-Fake-dummy-surveillance-camera.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p>If you\u2019re getting any of the following errors, read our&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-troubleshooting-guide\/\"><strong>ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed<\/strong><\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Failed to connect to ESP32: Timed out waiting for packet header<\/li>\n\n\n\n<li>Camera init failed with error 0x20001 or similar<\/li>\n\n\n\n<li>Brownout detector or Guru meditation error<\/li>\n\n\n\n<li>Sketch too big error \u2013 Wrong partition scheme selected<\/li>\n\n\n\n<li>Board at COMX is not available \u2013 COM Port Not Selected<\/li>\n\n\n\n<li>Psram error: GPIO isr service is not installed<\/li>\n\n\n\n<li>Weak Wi-Fi Signal<\/li>\n\n\n\n<li>No IP Address in Arduino IDE Serial Monitor<\/li>\n\n\n\n<li>Can\u2019t open web server<\/li>\n\n\n\n<li>The image lags\/shows lots of latency<\/li>\n<\/ul>\n\n\n\t\t<div data-elementor-type=\"section\" data-elementor-id=\"94673\" class=\"elementor elementor-94673\" data-elementor-post-type=\"elementor_library\">\n\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-2689e44b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2689e44b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7490d123\" data-id=\"7490d123\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-35934f78 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"35934f78\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-3de108d9\" data-id=\"3de108d9\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5aca63ab elementor-widget elementor-widget-image\" data-id=\"5aca63ab\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\">\n\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"334\" height=\"334\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?fit=334%2C334&amp;quality=100&amp;strip=all&amp;ssl=1\" class=\"attachment-full size-full wp-image-94555\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?w=334&amp;quality=100&amp;strip=all&amp;ssl=1 334w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?resize=300%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?resize=150%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 150w\" sizes=\"(max-width: 334px) 100vw, 334px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-4bd084e0\" data-id=\"4bd084e0\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-517cf0fa elementor-widget elementor-widget-heading\" data-id=\"517cf0fa\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\">[eBook] Build ESP32-CAM Projects using Arduino IDE<\/a><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3438ea70 elementor-hidden-phone elementor-widget elementor-widget-text-editor\" data-id=\"3438ea70\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Learn how to program and build 17 projects with the ESP32-CAM using Arduino IDE\u00a0<strong><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\" rel=\"noopener\">DOWNLOAD \u00bb<\/a><\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<div class=\"elementor-element elementor-element-674524a5 elementor-hidden-desktop elementor-hidden-tablet elementor-widget elementor-widget-text-editor\" data-id=\"674524a5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Learn how to program and build 17 projects with the ESP32-CAM using Arduino IDE <strong><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\" rel=\"noopener\">DOWNLOAD \u00bb<\/a><\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you&#8217;ve liked this project. For more projects with the ESP32-CAM, check out our eBook with 20 different projects: <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\"><strong>Build ESP32-CAM Projects (eBook)<\/strong><\/a><\/p>\n\n\n\n<p>You can also check all our published ESP32-CAM projects on the following link:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-cam\/\" title=\"\"><strong>All our ESP32-CAM Projects<\/strong><\/a><\/li>\n<\/ul>\n\n\n\n<p>Thank you for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, we\u2019re going to make a motion sensor detector with photo capture using an ESP32-CAM. When the PIR sensor detects motion, the ESP32 wakes up, takes a photo, &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32-CAM PIR Motion Detector with Photo Capture (saves to microSD card)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-pir-motion-detector-photo-capture\/#more-88137\" aria-label=\"Read more about ESP32-CAM PIR Motion Detector with Photo Capture (saves to microSD card)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":168850,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[281,276,277,319,264],"tags":[],"class_list":["post-88137","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32-project","category-esp32","category-esp32-arduino-ide","category-esp32-cam","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/ESP32-CAM-PIR-Motion-Detector-Photo-Capture.jpg?fit=1920%2C1080&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/88137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=88137"}],"version-history":[{"count":4,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/88137\/revisions"}],"predecessor-version":[{"id":168851,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/88137\/revisions\/168851"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/168850"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=88137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=88137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=88137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}