ESP32 Cam : PinOut, Specifications, Types, Interfacing & Its Applications

ESP32 is a low-power and low-cost system on a chip microcontroller that is integrated with Wi-Fi & Bluetooth. This development board is manufactured simply by ESPressif. Several variants have been launched & announced since the release of this ESP32 board. These boards have different CPUs & capabilities, and all of them can share a similar SDK & are mostly code-compatible. This article discusses an overview of ESP32 Cam, its working, and its applications.


What is the ESP32 Cam Development Board?

The ESP32 CAM module is an ESP32-based low-cost full-featured microcontroller with an integrated small-size OV2640 camera module & microSD card socket. This module integrates Bluetooth, WiFi, and BLE Beacon with two 32-bit high-performance LX6 CPUs. The frequency adjustment range of this module ranges from 80MHz to 240MHz. It adopts a stage pipeline architecture, a Hall sensor, an on-chip sensor, a temperature sensor, etc. This type of module is appropriate for industrial wireless control, home smart devices, wireless monitoring & IoT applications which require a camera with superior functions like image recognition & tracking.

ESP32 Cam Working Principle

The ESP32-CAM module is based on ESP32 which is a low-power and small-size camera module. This module comes with an OV2640 camera & provides an onboard TF card slot. The 4MB PSRAM of this board is used for image buffering from the camera into video streaming and permits you to utilize higher quality within your images without any crash of the ESP32. This board has an onboard LED to flash & numerous GPIOs for connecting peripherals.

ESP32 Cam Pin Configuration:

The ESP32-CAM includes 16 pins where pins with the same functionality are grouped equally.

ESP32 Cam Pin Configuration
ESP32 Cam Pin Configuration

Power Pins

ESP32 Cam includes two power pins; 5V & 3V3, so this module is powered through the 3.3V/5V pins. The VCC pin of this module usually outputs 3.3Volts from the on-board voltage regulator but it can be configured to 5V output with the Zero-ohm link close to the VCC pin.

GND is the ground pin of the module.

GPIO Pins

This module includes 32 GPIO pins in totality but many of them are internally used for the camera & the PSRAM. So this module has only 10 GPIO pins which can be assigned for different peripheral duties like; ADC, SPI, UART, and Touch.

UART Pins

The ESP32-S chip includes two UART interfaces; UART0 & UART2. But simply the RX pin of UART2 like GPIO 16 is broken out to make UART0 usable UART only on the ESP32-CAM. These pins are used mainly for flashing & connecting to different UART devices like fingerprint sensors, GPS, distance sensors, etc.

MicroSD Card Pins

These pins are used to interface the microSD card. These pins can also be used as regular inputs & outputs if you do not use a microSD card.

ADC Pins

There are two ADC2 pins only on the ESP32-CAM which are broken out but these pins are internally used by the WiFi driver and they cannot be used whenever Wi-Fi is enabled.

Touch Pins

These modules include seven capacitive touch-sensing GPIOs. Once a capacitive load like a human finger is close to the GPIO, then this module notices the change within capacitance.

SPI Pins

The ESP32-CAM includes one SPI (VSPI) only in slave & master modes.

PWM Pins

The ESP32-CAM includes ten channels of PWM pins which are controlled through a PWM controller. So the output of PWM can be used to drive LEDs & digital motors.

ESP32 Features & Specifications

The features and specifications of ESP32 Cam include the following.

  • This module supports WiFi and Bluetooth.
  • It has an OV2640 camera by flash.
  • It has an Onboard TF card slot that supports up to 4G TF cards used for data storage
  • It supports Wi-Fi video monitoring & image upload.
  • It supports different sleep modes with 6mA low a deep sleep current.
  • The control interface can be accessible easily through a pin header.
  • It is very easy to integrate & embedded into consumer products
  • ESP-32S WIFI module.
  • ESP32-D0WD Processor.
  • Built-in 32Mbit Flash.
  • Internal 512KB RAM.
  • External 4M PSRAM.
  • Onboard PCB Antenna.
  • IEEE 802.11 b/g/n/e/i WiFi protocol.
  • Bluetooth is Bluetooth 4.2 BR/EDR & BLE.
  • Station or SoftAP or SoftAP+Station WIFI mode.
  • WPA or WPA2 or WPA2-Enterprise or WPS Security.
  • Its o/p image format is JPEG, GRAYSCALE & BMP.
  • It supports up to 4G TF cards.
  • UART/ I2C/ SPI/PWM Peripheral interface.
  • I/O ports -9
  • Baudrate rate of UART is 115200bps by default.
  • The power supply is 5V.
  • Flash off at 5V is 180mA
  • Flash on & maximum brightness at 5V is 310mA.
  • Deep-Sleep is 6mA at 5V.
  • Modern-Sleep is 20mA at 5V.
  • Light-Sleep is 6.7mA at 5V.
  • The operating temperature ranges from -20 ℃ to 85 ℃.
  • Storage environment ranges from -40 ℃ to 90 ℃.
  • Its dimensions are 40.5mm x 27mm x 4.5mm.

ESP32 Cam Types

There are different kinds of ESP32 Cam boards which are discussed below.

The ESP32-CAM AI-Thinker is a very popular ESP32 CAM development board with an ESP32-S chip & regular 2MP OV2640 camera. This type of ESP32 cam board includes PSRAM – 4MB, is used for image buffering into video streaming from the camera or different tasks & permits you to utilize high quality within your pictures without colliding the ESP32.

This board supports simply a microSD card with 10 available GPIOs & power pins, not all GPIO pins are used but some are being used either by the microSD card or camera. This board is available with an on-board antenna, although it also with an IPEX connector allowing you to utilize alternatively an exterior antenna to develop the range of Wi-Fi communication.

ESP32-CAM AI-Thinker
ESP32-CAM AI-Thinker

This board has an on-board reset button which helps in restarting your module & also an in-built LED that functions as a flash lamp to light up the region before video streaming or capturing a picture.

ESP-EYE

The ESP32-based ESP-EYE board is dedicated to AI (artificial intelligence) through voice wake-up & face recognition. This board is set with an onboard microphone, 2 MP OV2640 camera, boot, function buttons, two LEDs & reset. This board has some features like; Flash -4MB, PSRAM – 8MB, type-C a Micro USB connector, an on-board antenna & IPEX connector.

ESP-EYE
ESP-EYE

The main benefit of this board is; a USB type-C connector which helps in very fast & easy uploading code to this board. The microphone of this board simply allows you to include a voice feature for your application and PSRAM – 8MB will ensure that your module doesn’t collide while using quality settings of the high image.

Freenove ESP32-Wrover CAM Board

This kind of ESP32 CAM development board is available with the ESP32-Wrover-E chip. This module includes the OV2640 camera which is very simple to use as well as set up. This module includes a USB-to-UART converter thus it is simple to upload code into the board.

This board is not available with a microSD card slot but it comes with different available GPIOs, so you can connect an exterior microSD card module easily if required. This board includes some exposed GPIOs which help in connecting other peripherals. In addition, if you are not using the module’s camera, then you can utilize it as a normal ESP32 with several accessible GPIOs. This module is also available with RESET & BOOT buttons to make it very easy to reset this module or place it within flashing mode if required.

TTGO T-Camera Plus

The TTGO T-Camera Plus module supports a microSD card, a microphone, an onboard reset button, a 3.7V lithium battery, a battery management circuit, a micro USB interface, and a 1.3 TFT display. This module comes with some GPIO pins which are used for connecting an on-board BME280 sensor. But this sensor will get hot on the module, thus the manufacturer decided to eliminate the sensor although you will get access still to the GPIOs, thus you can attach other I2C peripherals. So these GPIOs are accessible simply through a grove connector.

TTGO T-Camera Plus
TTGO T-Camera Plus

M5-Camera Model A/B

The M5-Camera A/B is similar to other types of modules with the OV2640 camera. This module has PSRAM -4MB so that capturing pictures & streaming through higher quality is possible. This module includes a LEGO-style enclosure with a grove connector which is perfect for connecting additional M5-Stack expansions such as; the MPU6050 gyroscope or accelerometer, a microphone, and a BME280 temperature, pressure & humidity sensor.

M5-Camera Model
M5-Camera Model

This board has a USB type-C connector which helps in uploading new code into the module and also an exterior RST button for restarting the module & doesn’t include exposed GPIOs. The main benefit of this module is; that it doesn’t contain any wires or visible electronic components. If you want to include a gyroscope, BME280 sensor, or a microphone, you have to use the grove connector.

TTGO T-Journal

This type of ESP32 cam module includes an OV2640 camera, a 0.91 inch I2C SSD1306 OLED display, an exterior antenna, a function button, some exposed GPIOs, a micro-USB & a battery connector. This OLED display helps in displaying the IP address of the board, otherwise, any errors when debugging. This board has four accessible GPIOs where two are used for I2C communication & remaining ones are suitable for connecting servo motors. This development board has a connector, which helps in connecting a 3.7V Li battery.

TTGO T-Journal
TTGO T-Journal

By using this board, code uploading is very simple because it has a USB connector that is used for both power & uploading code. The main drawback of this board is, it doesn’t have the support of a microSD card or exterior PSRAM, so it makes it a bit limited in terms of processing.

How to Connect ESP32 Cam with Arduino?

The interfacing of the ESP32 Cam with Arduino is shown below. This interfacing is used to upload ESP32 Cam code with Arduino Uno. There are various methods available to upload code within ESP32 cam. The required components to make this interfacing mainly include an ESP32 Cam module, Arduino Uno, Jumper cables & Arduino IDE software.

The connections of ESP32 Cam with Arduino follow as;

ESP32 Cam Connection with Arduino
ESP32 Cam Connection with Arduino

The 5V pin of Arduino Uno is connected to the 5V pin of ESP32 Cam.
The GND pin of Arduino Uno is connected to the GND pin of ESP32 Cam.
The Tx pin of Arduino Uno is connected to the Tx pin of ESP32 Cam.
The Rx pin of Arduino Uno is connected to the Rx pin of ESP32 Cam.

Code

Before uploading the below code, there is a jumper cable from GPIO0 to GND. This is mainly required to upload the sketch. Once the sketch is uploaded, then remove the jumper cable to use the device by pushing the RST button of ESP32 cam.

#include “esp_camera.h”
#include <WiFi.h> ;
#include “soc/soc.h”
#include “soc/rtc_cntl_reg.h”
//
// WARNING!!! Make sure that you have either selected ESP32 Wrover Module,
// or another board which has PSRAM enabled
//
#define CAMERA_MODEL_AI_THINKER
#include “camera_pins.h”
const char* ssid = “YOUR_SSID”;
const char* password = “YOUR_PASSWORD”;

void startCameraServer();
void setup()
{
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0
);
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();

camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
//init with high specs to pre-allocate larger buffers
if(psramFound()){
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}

#if defined(CAMERA_MODEL_ESP_EYE)
pinMode(13, INPUT_PULLUP);
pinMode(14, INPUT_PULLUP);
#endif

// camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf(“Camera init failed with error 0x%x”, err);
return;
}

sensor_t * s = esp_camera_sensor_get();
//initial sensors are flipped vertically and colors are a bit saturated
if (s->id.PID == OV3660_PID) {
s->set_vflip(s, 1);//flip it back
s->set_brightness(s, 1);//up the brightness just a bit
s->set_saturation(s, -2);//lower the saturation
}
//drop-down frame size for higher initial frame rate
s->set_framesize(s, FRAMESIZE_QVGA);

#if defined(CAMERA_MODEL_M5STACK_WIDE)
s->set_vflip(s, 1);
s->set_hmirror(s, 1);
#endif

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
Serial.println(“”);
Serial.println(“WiFi connected”);

startCameraServer();

Serial.print(“Camera Ready! Use ‘http://”);
Serial.print(WiFi.localIP());
Serial.println(“‘ to connect”);
}
void loop()
{
// put your main code here, to run repeatedly:
delay(10000);
}

As per the above interfacing diagram, you can simply connect the ESP32 cam board with Arduino. Confirm that you have connected GPIO0 through GND & click on the upload button. When this code uploading is completed then take away the jumper wire from GPIO0.

Once connecting & code uploading are finished the ESP32 cam board is prepared for testing. The code will begin the esp32 camera server & you can begin streaming videos and also take photos. Open the serial monitor & reset the ESP32 module to see the IP address where the web server of the cam has started.

Enter a similar IP Address within your browser & press enter, then the web server page opens with some settings. So scroll down this setting & click on Start Stream. After that, the ESP32 cam module starts streaming video.

Thus, the ESP32 cam is a low-cost module that is used in IoT-based projects. So uploading ESP32 Cam code with Arduino Uno is a very simple method to upload the code within ESP32 Cam.

Advantages and Disadvantages

The advantages of ESP32 Cam include the following.

  • The ESP32-CAM is equipped with AI (Artificial Intelligence) with specific programming languages that can set the o/p mainly for investigative purposes.
  • This module is combined through an Arduino UNO microcontroller & uses directly FTDI or USB to TTL.
  • The main benefit of this board is the USB type-C connector, so easy and fast to upload code to this board.
  • The microphone simply allows you to include voice features for your projects & 8MB PSRAM guarantees that your board doesn’t collide while using quality settings of higher images.
  • This module includes a very competitive tiny camera module that operates as a minimum system independently.
  • It supports upload of image Wi-Fi, several sleep modes, supports TF card, etc.
  • It supports SPI/ UART/I2C/ADC/PWM/DAC.
  • It supports AP/ STA/STA+AP operation modes and smart configure or AirKiss technology.
  • It supports OV7670 & OV2640 cameras with an in-built flash lamp.

The disadvantages of ESP32 Cam include the following.

  • ESP32-CAM boards are expensive.
  • This board doesn’t contain a USB-to-UART interface, so you cannot connect this board directly to your PC with a USB cable.
  • This board has a narrow field of view.
  • It doesn’t have night vision ability.
  • Its length of cable is short.
  • It has limited RAM and image sensor support.
  • Its I/O pins are limited.
  • The ESP32 CAM board consumes huge bursts of current while operating its radio, so it affects the performance of both WiFi & Bluetooth.
  • It doesn’t have any power connector or a USB programming connector.

Applications

The applications of ESP32 Cam include the following.

  • ESP32-CAM module is used widely in a variety of IoT applications.
  • These are appropriate for industrial wireless control, home smart devices, wireless monitoring, wireless positioning system signals, QR wireless identification, etc.
  • These modules offer a low-cost method to design very advanced home automation projects which include different features like taking photos, video, face recognition, etc.
  • ESP32-CAM is an ideal solution for DIY projects & prototype constructions.
  • It is used to design a face recognition system devoid of any complex programming & any additional components
  • ESP32-CAM simply adopts a DIP package which provides customers with high-reliability connection techniques, so it is very convenient mainly in a variety of IoT applications.

Thus, this is an overview of an ESP32 Cam, working, features, specifications, types, interfacing, advantages, disadvantages, and its applications. This is a powerful and versatile module that provides a wide variety of features & specifications for your requirements. Here is a question for you, what is the ESP32 module?