Motion Sensing Photo Capturing Device Using ESP32-CAM

Previously, we have built some camera-based IoT projects using the ESP32-CAM Development Board. Those are very effective projects for home automations. So we thought to innovate some new projects using these ideas for the security system.

In this project, we’re going to make a Motion Sensing Photo Capturing Device using the ESP32-CAM module. For that, we use a PIR motion sensor for detection. When the PIR sensor detects any motion near the device, it will automatically capture a photo, and save it on the microSD card.

Project

Motion Sensing Photo Capturing Device

Circuit Diagram

Motion Sensing Photo Capturing Device Circuit Diagram

Components Required

  • ESP32-CAM WiFi Camera Module
  • FTDI Programming Module
  • PIR Motion Sensor
  • 2N3904 Transistor
  • 1K Resistor
  • Connection Wire
  • Breadboard
  • 5V Hi-Link Converter

PCB Design

After designing the schematic diagram of the Motion Sensing Photo Capturing Device, 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 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.com for its quality assurance, fastest delivery, and 24/7 customer support.

PCB View

Motion Sensing Photo Capturing Device 2D View
2D View
Motion Sensing Photo Capturing Device 3D View
3D View

My Opinion About PCBWay

To start off with, PCBWay is a Chinese-based PCB (printed circuit board) prototype, PCB assembly, SMD Stencil and Flexible PCB manufacturing company. For the past 1.5 years, I have been collaborating with them on my projects and genuinely it is an awesome experience. So today, I will state and give my personal opinion regarding the online service of PCBWay. I have been offered to promote some other PCB manufacturing companies, but compared with them, I feel like PCBWay combines an excellent price and customer service factor in one single serving. What is also spectacular about PCBWay to me, as a maker and customer, is their service. From their friendly support staff to their intuitive, user-friendly website UI, it all counts towards what makes PCBWay an ideal company for any electronic hobbyist.

When I first approached PCBWay, the features to navigate around their website really astound me, especially since their website is full of features, PCB functions and information about the brand. I also observed their sales statistics on their webpage, which intrigued me a lot because of their high figures for successful payments, partnerships, and published projects. Not many companies truly display their sales information, so this really caught my eye. I also experienced some contests arranged by PCBWay where you will get lots of coupons, lucky draws, discounts, amazing electronics prizes and a few more by simply participating in them.

Moreover, their website includes an instant quote feature, so if you are directed to their homepage, you can put your custom PCB details and Gerber file to receive an estimated price. Also, if you want to view your Gerber file, you don’t need to go anywhere else. PCBWay also provides this facility by their “Gerber File Viewer” features.

Now, once you have put all your customisation options in place and made your final choices, you can receive a quote directly from the website with a rough price estimate. The price of your product will be based on the options you choose, with the higher, more expensive options contributing to your price more heavily. Shipping is also included separately, with DHL being the most expensive method and standard airmail being the cheapest method of shipment. Your country’s location also matters when determining the shipping cost. The nice thing about PCBWay’s website is that you can see how the final price is broken down by certain costs. Furthermore, there is a choice for you to select your build time and shipping method so that when you change it, you can instantly see the price difference. So go to their website and check out their recent offers and more.

ESP32-CAM Module Specifications

The ESP32-CAM is based on the ESP32-S module. It has the same features.

  • 802.11b/g/n Wi-Fi
  • Bluetooth 4.2 with BLE
  • UART, SPI, I2C, and PWM interfaces
  • Clock speeds up to 160 MHz
  • Computing power up to 600 DMIPS
  • 520KB SRAM + 4 MB PSRAM
  • Supports WiFi Image Upload
  • Multiple sleep modes
  • Firmware Over the Air (FOTA) upgrades possible
  • 9 GPIO ports
  • Built-in Flash LED

Camera Specifications for Motion Sensing Photo Capturing

The ESP32-CAM has an inbuilt OV2640 camera module. The device also supports OV7670 cameras.

  • 2 megapixel camera sensor
  • Array size UXGA 1622×1200
  • Output formats include YUV422, YUV420, RGB565, RGB555 and 8-bit compressed data
  • Image transfer rate of 15 to 60 fps

Programming ESP32-CAM Camera Module

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-CAMFTDI Module
U0RTX
U0TRX
GPIO0GND
+5V+5V
GNDGND
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 “https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json” link pasted into the preferences tab of the Arduino IDE. This link provides you access to example codes, libraries you need, etc.

Working Principle of Motion Sensing Photo Capturing Device

Now let’s talk about the working principle of this simple motion sensing photo capturing device.

At the stand-by situation, the ESP32-CAM module is in deep sleep mode with external wake-up enabled.

When any motion is detected in front of the camera viewing area, the PIR motion sensor sends an Analog signal to wake up the ESP32-CAM.

At the same time, ESP32-CAM takes a photo of the moving object and saves it on the microSD card.

Thereafter, again it turns back to deep sleep mode until another signal from the PIR motion sensor is received.

ESP32-CAM Code

To develop this code, all credit goes to Rui Santos.

Applications of Motion Sensing Photo Capturing Device

  • Usually used in home security systems.
  • Large uses in local shops, malls, banks, companies, etc.

Leave a Comment