ESP 32 eye camera pinout, its specifications and programming

The ESP 32 eye camera is a development board by the Espressif system which is based on the ESP32-S chip. It is a low-cost development board with an in-built camera. ESP 32 eye camera can be used as an ideal solution for many IoT applications, construction of prototypes,s and many DIY(Do It Yourself) projects.

The board is integrated with WiFi and low-power BLE along with two high-performance 32-bit LX6 CPUs. ESP 32 eye camera board is also capable of streaming low latency video while maintaining low power consumption. The development of the ESP 32 eye camera board has created a huge impact on the AI and IoT sector by providing ideal solutions for most of the issues.

That is all in the introduction of the ESP 32 eye camera development board, Let us discuss about the onboard components of the ESP 32 eye camera board.

On board Components of ESP 32 eye camera

ESP 32 eye camera front specification
ESP 32 eye camera back specification

2 MP camera – The board has an onboard OV2640 2 MP(megapixel) camera which is capable of capturing VGA resolution images and videos.

ESP32-WROVER-B Module – The board features the ESP32 dual-core microcontroller with Wi-Fi and Bluetooth connectivity.

Antennas – The ESP 32 eye camera board has built-in antennas for both Wi-Fi and Bluetooth communication. It allows wireless connectivity for data transmission.

Micro USB Port – There is a Micro USB port available on the board which is used for power supply as well as for programming the ESP32 module. The Micro USB port also provides a convenient way for flashing the firmware.

MicroSD Card Slot – There is a Micro SD card slot available which is used for expansion of storage by using a MicroSD card.

Reset and Boot Buttons – RESET and Boot Buttons are used for resetting the device as well as for entering into the boot mode for flashing the firmware.

Voltage Regulators – Voltage regulators are available on the board for regulating the voltage supply to the board which protects the board from getting damaged.

Power LED – There is an inbuilt power LED present in the ESP 32 eye camera board which is red in color and it will start blinking when the board is connected to a power supply.

PSRAMAdditional RAM on ESP 32 eye camera board which is integrated onto the board for enhancing the capabilities of the board like image and video processing.

    Board Features

    BoardESP 32 eye camera board
    ProcessorESP32-WROVER-B
    AntennaInbuilt
    Board Dimension41 x 21 mm
    I/O Port10
    ADC7
    InterfacesUART, SPI, I2C
    Flash Memory8MB
    PWM10
    Board features of ESP 32 eye camera board

    Power Consumption of ESP 32 eye camera

    Power supply2.2-3.6v
    Current Consumption70 – 100mA
    I/O voltage0-3.3v
    Modem sleep20mA
    Light sleep6.7mA
    Deep sleep6mA
    Power consumption of ESP 32 eye camera board

    Now let us have a look at the pinout of the ESP 12E board.

    Pinout OF ESP 32 eye camera

    Power Pins

    There are two power pins available on the board which are a 3.3v pin and a 5v pin. These pins are used for power supply to the board. It is reported that connecting the power supply of the board to the 3.3v pin generates an error so it is recommended to use a 5v pin for the power supply to the board.

    S.noTypePin name
    1Input5V
    2Input3.3v

    Power Output Pin

    There is a power output pin available on the board which is labeled as VCC and you should never connect it as an input pin for the ESP 32 eye cam board as this pin is used to output 5V or 3.3V.

    S.noTypePin name
    1OutputVCC

    GPIO 0 pin

    The most important pin on the board is the GPIO 0 pin. This pin determines whether the ESP32 is in flashing mode or not.

    The GPIO 0 must remain at HIGH during boot and LOW during flashing and for this purpose, we use a 10K resistor to pull it internally. Whenever we connect the GPIO 0 pin to the GND, the ESP32 eye cam board enters into flash mode, and now we can upload the code to the board. After we complete this task we must disconnect this connection.

    S.noTypePin name
    1I/OGPIO 0

    Input Output Pins

    There are a total of 10 digital input/output pins available on the ESP 32-eye camera board. The digital pins are used as an input or output according to the requirement. The digital pins are only able to read two values which are:-

    1. High
    2. Low 

    However, we can use 1 for high state and 0 for low state. When these pins receive 0V they are in a LOW state and when they receive 5V they are in the HIGH state.

    The digital pins on the ESP 32-eye camera board are

    S.noTypePin name
    1I/OGPIO 0
    2I/OGPIO 1
    3I/OGPIO 2
    4I/OGPIO 3
    5I/OGPIO 4
    6I/OGPIO 12
    7I/OGPIO 13
    8I/OGPIO 14
    9I/OGPIO 15
    10I/OGPIO 16

    PWM Pin

    There are a total of 10 pins available on the ESP 32 eye camera board which are also known as Pulse Width Modulation pins. The work of these PWM pins is to convert the digital inputs to analog output. These pins provide 8-bit PWM output with the analogWrite () function.

    The PWM pins of the board are

    S.noTypePin name
    1InputGPIO 0/PWM
    2InputGPIO 1/PWM
    3InputGPIO 2/PWM
    4InputGPIO 3/PWM
    5InputGPIO 4/PWM
    6InputGPIO 12/PWM
    7InputGPIO 13/PWM
    8InputGPIO 14/PWM
    9InputGPIO 15/PWM
    10InputGPIO 16/PWM

    ADC Pin

    There are a total of 7 ADC pins available on the board which are used to convert the analog signal to digital signal. The ADC pins of the ESP 32 eye camera board are as follows

    S.noTypePin name
    1I/OADC2_0
    2I/OADC2_1
    3I/OADC2_2
    4I/OADC2_3
    5I/OADC2_4
    6I/OADC2_5
    7I/OADC2_6

    Micro SD Card Pins

    These pins are used to interface the Micro SD card. If you are not using any SD card then you should use these pins as regular input and output pins.

    S.noTypePin name
    1I/OGPIO 2
    2I/OGPIO 4
    3I/OGPIO 12
    4I/OGPIO 13
    5I/OGPIO 14
    6I/OGPIO 15

    Touch Pins

    The ESP32-CAM has 7 capacitive touch-sensing GPIOs which detects change in capacitance when a capacitive load is close to the GPIO.

    S.noTypePin name
    1I/OGPIO 0
    2I/OGPIO 2
    3I/OGPIO 4
    4I/OGPIO 12
    5I/OGPIO 13
    6I/OGPIO 14
    7I/OGPIO 15

    RTC GPIO Pins

    RTC GPIO pins are nothing but the regular GPIO pins which are routed to the RTC low-power subsystem. These pins are generally used for waking up the ESP32 eye-cam board from deep sleep when the ULP(Ultra Low Power) co-processor is running. There are 7 RTC GPIO pins available on the board which are as follows

    S.noTypePin namePin Mapping
    1I/ORTC_GPIO 10GPIO 0
    2I/ORTC_GPIO 11GPIO 2
    3I/ORTC_GPIO 12GPIO 4
    4I/ORTC_GPIO 13GPIO 12
    5I/ORTC_GPIO 14GPIO 13
    6I/ORTC_GPIO 15GPIO 14
    7I/ORTC_GPIO 16GPIO 15

    Communication Pins of ESP 32 eye cam board

    SPI Pins

    The ESP 32 eye cam board supports the “Semi-peripheral Communication Protocol” or SPI. The SPI protocol is used to develop communication between the controller device and its peripheral devices. In the ESP 32 eye cam board 6 pins are needed for SPI communication protocol which are:- 

    S.NOTypePin Name
    1I/OHSPI_Q
    2I/OHSPI_ID
    3I/OHSPI_CS0
    4I/OHSPI_CLK
    5I/OHSPI_WP
    6I/OHSPI_HD

    UART Pins

    The ESP 32 eye cam board has 2 UART interfaces which are UART 0 and UART 2 however only the RX pin of the UART 2 is broken out which makes UART 0 only usable UART. The pin mapping of the UART pins are as follows

    S.NOTypePin Name
    1I/OU0_TXD/GPIO 1
    2I/OU0_RXD/ GPIO 3
    3I/OU2_RXD/GPIO 16

    Camera Connector Pins

    The description of camera connector pins are as follows

    OV2640 CAMERAESP32Variable name in code
    D0GPIO5Y2_GPIO_NUM
    D1GPIO18Y3_GPIO_NUM
    D2GPIO19Y4_GPIO_NUM
    D3GPIO21Y5_GPIO_NUM
    D4GPIO36Y6_GPIO_NUM
    D5GPIO39Y7_GPIO_NUM
    D6GPIO34Y8_GPIO_NUM
    D7GPIO35Y9_GPIO_NUM
    XCLKGPIO0XCLK_GPIO_NUM
    PCLKGPIO22PCLK_GPIO_NUM
    VSYNCGPIO25VSYNC_GPIO_NUM
    HREFGPIO23HREF_GPIO_NUM
    SDAGPIO 26SIOD_GPIO_NUM
    SCLGPIO 27SIOC_GPIO_NUM
    POWER PINGPIO 32PWDN_GPIO_NUM

    Programming of the ESP 32 eye cam board

    Unlike any other development boards, the ESP 32 eye cam does not have any built-in programmer to burn the code to the ESP32-S chip hence for uploading the code we have to use an external USB to UART Converter or an FTDI Programmer. In this article, we are going to upload the code for setting up the camera and capturing an image when a button is pressed.

    Connections

    The connection of ESP 32 cam and FTDI programmer is illustrated below

    ESP32-CAMFTDI Cable
    GNDGND
    5VVCC (5V)
    U0RX/GPIO3TX
    U0TX/GPIO1RX
    GPIO0GND

    Set up of Arduino IDE

    Step 1 – Before moving further make sure that you have the latest version of Arduino IDE installed on your system.

    Step 2 – Then we have to install the ESP 32 add-on in Arduino IDE.

    Step 3 – Installation of library & resources

    • #include <WiFi.h> – This library allows the ESP32 to connect to Wi-Fi networks and manage network connections.
    • #include <WiFiClient.h> – This library provides functionality for creating and managing client connections over Wi-Fi and allowing the ESP32 to communicate with other devices over a network.
    • #include <ESPAsyncWebServer.h> – This library helps us create a web server on the ESP32 that can handle HTTP requests asynchronously.
    • #include <ESPAsyncWiFiManager.h> – This library provides an easy way to manage Wi-Fi network configuration by allowing us to create a captive portal.
    • #include “esp_camera.h” – This library is specific to the ESP32-CAM module. It provides the functions and configurations for working with the camera. It allows us to initialize and control the camera module to capture images and videos.

    That is all in the setup of Arduino IDE Now let us have a look at the code

    Code

    #include <WiFi.h>
    #include <WiFiClient.h>
    #include <ESPAsyncWebServer.h>
    #include <ESPAsyncWiFiManager.h>
    #include "esp_camera.h"
    
    // Replace with your network credentials
    const char* ssid = "your_SSID";
    const char* password = "your_PASSWORD";
    
    // Pin for the button
    const int buttonPin = 0;  // GPIO0
    
    bool takePicture = false;
    
    // Initialize the camera
    camera_config_t config;
    void initCamera() {
      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 = -1;
      config.xclk_freq_hz = 20000000;
      config.pixel_format = PIXFORMAT_JPEG;
      config.frame_size = FRAMESIZE_VGA;
      config.jpeg_quality = 10;
      config.fb_count = 2;
    
      // Initialize the camera
      esp_err_t err = esp_camera_init(&config);
      if (err != ESP_OK) {
        Serial.printf("Camera init failed with error 0x%x", err);
        ESP.restart();
      }
    }
    
    // Function to take a picture
    void takePhoto() {
      camera_fb_t* fb = NULL;
      fb = esp_camera_fb_get();
      if (!fb) {
        Serial.println("Camera capture failed");
        return;
      }
      
      Serial.println("Picture taken!");
      // Do something with the captured image, e.g., send to a server or save to SD card
      
      esp_camera_fb_return(fb);
    }
    
    // Callback function for capturing a photo when the button is pressed
    void buttonCallback() {
      if (digitalRead(buttonPin) == LOW) {
        takePicture = true;
      }
    }
    
    void setup() {
      Serial.begin(115200);
      pinMode(buttonPin, INPUT_PULLUP);
      
      // Connect to Wi-Fi
      WiFi.mode(WIFI_STA);
      WiFi.begin(ssid, password);
      while (WiFi.status() != WL_CONNECTED) {
        delay(1000);
        Serial.println("Connecting to WiFi...");
      }
      Serial.println("Connected to WiFi");
    
      // Initialize the camera
      initCamera();
    
      // Start the server
      AsyncWebServer server(80);
      server.begin();
      
      // Initialize the WiFi manager
      AsyncWiFiManager wifiManager(&server);
      wifiManager.autoConnect("ESP32-CAM");
    
      // Attach button interrupt
      attachInterrupt(digitalPinToInterrupt(buttonPin), buttonCallback, FALLING);
    }
    
    void loop() {
      if (takePicture) {
        takePhoto();
        takePicture = false;
      }
    
      // Other loop code here
    }
    
    

    Frequently Asked Questions

    Q1 – Can I use the camera without Wi-Fi?

    Ans – Yes, you can use the camera without WiFi as it can capture images and videos locally without an internet connection

    Q2 – Can I stream video using the ESP32-CAM?

    Ans – Yes, you can stream the video using the ESP 32 cam by using the “ESPAsyncWebServer” and the camera library.

    1 thought on “ESP 32 eye camera pinout, its specifications and programming”

    Leave a Comment