Overview

In this tutorial, I will let you know how to make your wireless video streaming device in which you can stream that live video on the internet using the ESP32 CAM board and blink IoT platform. Hence, today’s topic is all about making IoT-based Surveillance CCTV Cameras using ESP32 CAM & Blynk cloud.

Introduction

The ESP32-CAM is a small camera module with the ESP32-S chip that costs approximately $10. Besides the OV2640 camera and several GPIOs to connect peripherals, it also features a microSD card slot that can be useful to store images taken with the camera.

In this tutorial, we will go through its features, pins description, and the method to program this device using FTDI Module. Also, we will see the beginner guide on setting up Arduino IDE for the ESP32 Camera Module. We will then use the ESP32 CAM basic example code for Video Streaming Over Wifi.

Bill of Materials

S.NoCOMPONENTSDESCRIPTIONQUANTITY
1ESP32-CAM BoardAI-Thinker ESP32 Camera Module1https://www.amazon.in/Omatom-ESP32-CAM-Bluetooth-
2FTDI ModuleFTDI Module1https://www.amazon.in/xcluma-FT232
3USB CableUSB Cable1https://www.amazon.in/Storite-USB-2
4Jumper WiresJumper Wires40https://www.amazon.in/YUVS-Jumper-Wires-female-Pieces

ESP32 CAM

Description

The ESP32 CAM WiFi Module Bluetooth with OV2640 Camera Module 2MP For Face Recognization has a very competitive small-size camera module that can operate independently as a minimum system with a footprint of only 40 x 27 mm; a deep sleep current of up to 6mA and is widely used in various IoT applications.

It is suitable for home smart devices, industrial wireless control, wireless monitoring, and other IoT applications.

This module adopts a DIP package and can be directly inserted into the backplane to realize rapid production of products, providing customers with a high-reliability connection mode, which is convenient for application in various IoT hardware terminals.

ESP integrates WiFi, traditional Bluetooth, and BLE Beacon, with 2 high-performance 32-bit LX6 CPUs, and 7-stage pipeline architecture. It has the main frequency adjustment range of 80MHz to 240MHz, an on-chip sensor, a Hall sensor, a temperature sensor, etc.

Note: The product dimension may have a ±2% error. The product colour may have some variation due to the light effect.

Pin Description:

Features :

ESP32-CAM :

  1. The smallest 802.11b/g/n Wi-Fi BT SoC module.
  2. Low power 32-bit CPU, can also serve the application processor.
  3. Up to 160MHz clock speed, summary computing power up to 600 DMIPS.
  4. Built-in 520 KB SRAM, external 4MPSRAM.
  5. Supports UART/SPI/I2C/PWM/ADC/DAC.
  6. Support OV2640 and OV7670 cameras, and built-in flash lamps.
  7. Support image WiFI upload.
  8. Supports TF card.
  9. Supports multiple sleep modes.
  10. Embedded Lwip and FreeRTOS.
  11. Supports STA/AP/STA+AP operation mode.
  12. Support Smart Config/AirKiss technology.
  13. Support for serial port local and remote firmware upgrades (FOTA)

Specifications :

  1. Wireless Module: ESP32-S WiFi 802.11 b/g/n + Bluetooth 4.2 LE module with PCB antenna, u.FL connector, 32Mbit SPI flash, 4MBit PSRAM.
  2. External Storage: micro SD card slot up to 4GB.
  3. Camera
  4. FPC connector.
  5. Support for OV2640 (sold with a board) or OV7670 cameras.
  6. Image Format: JPEG( OV2640 support only ), BMP, grayscale.
  7. LED flashlight.
  8. Expansion: 16x through-holes with UART, SPI, I2C, PWM.
  9. Misc: Reset button.
  10. Power Supply: 5V via pin header.
  11. Power Consumption.
  12. Flash LED off 180mA @ 5V.
  13. Flash LED on to maximum brightness: 310mA @ 5V.
  14. Deep-sleep: 6mA @ 5V min.
  15. Modem-sleep: 20mA @ 5V min.
  16. Light-sleep: 6.7mA @ 5V min.
  17. Dimensions (ESP32): 40 x 27 x 12 (LxWxH) mm.
  18. Temperature Range: Operating: -20 ℃ ~ 85 ℃; storage: -40 ℃ ~ 90 ℃ @ < 90%RH.

Package Includes :

  • 1 x ESP32 CAM WiFi Module.
  • 1 x OV2640 Camera Module 2MP.

Power Pins

The ESP32-CAM comes with three GND pins (coloured in black colour) and two power pins (coloured in red colour): 3.3V and 5V.

You can power the ESP32-CAM through the 3.3V or 5V pins. However, many people reported errors when powering the ESP32-CAM with 3.3V, so we always advise to power the ESP32-CAM through the 5V pin.

Power output pin

There’s also the pin labelled on the silkscreen as VCC (coloured with a yellow rectangle). You should not use that pin to power the ESP32-CAM. That is an output power pin. It can either output 5V or 3.3V.

In our case, the ESP32-CAM outputs 3.3V whether it is powered with 5V or 3.3V. Next to the VCC pin, there are two pads. One was labelled as 3.3V and the other as 5V.

If you look closely, you should have a jumper on the 3.3V pads. If you want to have an output of 5V on the VCC pin, you need to unsolder that connection and solder the 5V pads.

Serial Pins

GPIO 1 and GPIO 3 are serial pins (TX and RX, respectively). Because the ESP32-CAM doesn’t have a built-in programmer, you need to use these pins to communicate with the board and upload code.

How to Program / Upload Code to ESP32-CAM AI-Thinker

For programming the board, you need any USB-to-TTL Converter Module or an FTDI Module. For getting started with ESP32 CAM Module, make the following connection between FTDI Module and the ESP32 CAM module.

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.

Note : GPIO 0 needs to be connected to GND so that you’re able to upload code.

To upload code to the ESP32-CAM using Arduino IDE, follow the next steps:

  • Go to Tools > Board and select AI-Thinker ESP32-CAM. You must have the ESP32 add-on installed. Otherwise, this board won’t show up on the Boards menu.
  • Go to Tools > Port and select the COM port the ESP32-CAM is connected to.
  • For demonstration purposes, you can upload a blank sketch to your board
void setup() {
 // put your setup code here, to run once:
 } 

void loop() { 
// put your main code here, to run repeatedly: 
}

Then, click the Upload button in your Arduino IDE.

When you start to see some dots on the debugging window, press the ESP32-CAM on-board RST button.

After a few seconds, the code should be successfully uploaded to your board.

When you see the “Done uploading” message, you need to remove GPIO 0 from GND and press the RST button to run your new code.

GPIO 33 – Built-in Red LED

void setup() { 
pinMode(33, OUTPUT);
 }

 void loop() {
 digitalWrite(33, LOW);
}

Source Code & Getting Started with ESP32 CAM

Go to the files menu and then select examples. From the examples menu, select the ESP32 and then Camera. Then finally open the CameraWebServer Sketch.

The following code should load.

Before uploading the code, you need to insert your network credentials in the following variables:

const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";

Then, make sure you select the right camera module. In this case, we’re using the AI-THINKER Model.

So, comment on all the other models and uncomment this one:

// Select camera model 
//#define CAMERA_MODEL_WROVER_KIT 
//#define CAMERA_MODEL_ESP_EYE 
//#define CAMERA_MODEL_M5STACK_PSRAM 
//#define CAMERA_MODEL_M5STACK_WIDE 
#define CAMERA_MODEL_AI_THINKER

Now you can upload the code. The code will take more than a minute to compile and upload.

ESP32 CAM Video Streaming Over WiFi

Once the code uploads completely, you can open the Serial Monitor. At this instance, if you press the reset button the Serial Monitor will show the device is in downloading mode.

Getting the IP address

To disable the downloading mode, remove the IO0 GND Jumper from the ESP32 CAM Module. Now again press the reset button. So the device will try connecting to the WiFi Network. Once the device connects to the WiFi, it will display its local IP Address.

The ESP32 IP address should be printed in the Serial Monitor.

Accessing the Video Streaming Server

Now, you can access your camera streaming server on your local network. Open a browser and type the ESP32-CAM IP address. Press the Start Streaming button to start video streaming.

Blynk App setup for video streaming over the Internet

Installing and Getting Ready

We will use an Android smartphone for this project. So go to Google Play or Apple Store (if using an iPhone).

Search for ‘Blynk’ and install the application.

Now you can make the same project using a blink IoT platform as well. So open up the blink app and create a new project. After that just tap on the screen and add this video stream widget


Now tap on the widget and paste that same link here. That’s it now, just click on the play button. Here, as you can see, I can stream the live video from the ESP32 CAM board onto my blink IoT platform over the Internet.

By Devilal

Leave a Reply

Your email address will not be published. Required fields are marked *