ESP-32 CAM module with camera from
DiymoreESP32-CAM Video Streaming Server
An example of use is
here .
Pre-installed libraries:
Esp32 board in Arduino Ide Windows /
Esp32 board in Arduino Ide Linux and MacDetailed settings are in the article.
In my case, I used the AI-THINKER module so uncommented
#define CAMERA_MODEL_AI_THINKER
The functionality of face recognition did not work for me. The comment in the article was helpful.
It seems that face recognition is no longer working (at least with the example program) when using the 1.02 ESP core. Rolling back to the 1.01 core and using the example program belonging to that core, will 'fix' it
Having rolled back to the previous version of library 1.01 everything worked.
I have a pair of I2C 128x64 and TFT SPI 128x128 displays
Article
OV7670 with FIFO how to connect the camera to the display if you do not have a CAM module. Support OV2640 and OV7670 cameras
At the time of writing, the following worked for me
ESP32 camera + Wifi Server + I2C Display (AdaFruit)
ESP32 camera + SPI Display 1.44 "TFT 128x128 v1.1 (AdaFruit)
ESP32 camera + SPI Display 1.8 "TFT 128 * 160 (Espressif library)
The WiFi driver conflicts with the SPI bus. Possible solution to use a different library. The problem arose at the time of the initialization of the WiFi module.
The main problem is that the ESP32-CAM module has a limited number of free legs. Part of the ports is used for the camera, part in parallel with the sd-card. The sd-card connector is installed on the board. Another conclusion (IO4) is the LED flashlight.
I2C Display B / W is not of particular interest for real use with the image received from the camera. TFT color and high resolution. On it you can already see the face. On such a display or a little higher resolution, you can make the Door Eye
I will say right away that the library from AdaFruit is not the fastest. I managed to display a couple of frames per second. It is more promising to use libraries that work at a low level. But I was not able to get an ESP32_TFT_library with my display 1.44 "128x128 SPI V1.1. Maybe ILI9163 is not supported. I took 1.8" 128 * 160 SPI TFT and I managed to squeeze about 12 FPS!
LinkThere are a couple of libraries that work faster. But some are not ported for esp-32 (
link ):
4.98 sec Adafruit_ST7735
1.71 sec ST7735X_kbv
1.30 sec PDQ_ST7735
The video looks impressive:
When using
two ports, one of the HSPI or VSPI hardware ports on the microcontroller and display with the ILI9341 driver can receive 30 frames per second (
link ).
But as I said earlier in the ESP32-CAM module, only one SPI is free. It is displayed on the following PINS:
IO2 - DC (A0)
IO14 - CLK
IO15 - CS
IO13 - MOSI (SDA)
IO12 - MISO (Input. Not Used)
IO0 - BCKL (Backlight. Not used)
IO16 - RST


The first library I tried was AdaFruit SSD1306
I2C 128x64 Blue OLED Display
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display; void init_display(){ pinMode(14,INPUT_PULLUP); pinMode(15,INPUT_PULLUP); Wire.begin(14,15); display = Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } ....
When working in esp32, I2C emulation is used. Involved IO14 and IO15. Almost any free ports can be used, not the H / W bus is used.
How to connect
Monochrome 0.96 "i2c OLED display . You need to pay attention to the display address on the I2C bus. In this case, 0x3C
SPI Display 1.8 "TFT 128 * 160 Espressif Library
Wiring diagram:
IO2 - A0
IO14 - SCK
IO15 - CS
IO13 - SDA
IO16 - RESET

The board also has an SD-card reader
IO configuration:
Install the environment and development environment from
Espressif . Detailed instructions on
how to do this .
Install the
library . Two corrections need to be made to assemble the library.
Makefile:
+ CFLAGS += -Wno-error=tautological-compare \ + -Wno-implicit-fallthrough \ + -Wno-implicit-function-declaration
components / tft / tftspi.c:
+ #include "driver/gpio.h
→
PatchThen install the
ESP32 Camera Driver .
Configure:
#. $ HOME / esp / esp-idf / export.sh
# idf.py menuconfig
Allow access for the USB port for firmware and monitoring:
#sudo chmod 777 / dev / ttyUSB0
We collect and fill:
#make -j4 && make flash
12FPS is achieved through packet writing using the send_data method. Recording is not pixel by pixel, but a whole line equal to the width of the screen:
esp_err_t camera_capture(){ uint32_t tstart, t1, t2; tstart = clock();
→
GistFRAME_WIDTH is the frame width of 320 pixels for QVGA config.frame_size = FRAMESIZE_QVGA;
In fact, we see a 128 * 160 window from the full frame on the display
Log for configuration with a single camera buffer (config.fb_count = 1)
Capture camera time: 32 ms
Send buffer time: 47 ms
Capture frame ok.Result
1000 / (32 + 47) = 12.65 FPSLog for configuration with two camcorder buffers (config.fb_count = 2)Capture camera time: 39 ms
Send buffer time: 63 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 59 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 34 ms
Capture frame ok.
Capture camera time: 40 ms
Send buffer time: 64 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 59 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 34 ms
Capture frame ok.
Capture camera time: 40 ms
Send buffer time: 63 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 60 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 34 ms
Capture frame ok.
Capture camera time: 39 ms
Send buffer time: 63 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 60 ms
Capture frame ok.
Capture camera time: 1 ms
Send buffer time: 34 ms
Capture frame ok.
Capture camera time: 40 ms
Send buffer time: 63 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 60 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 34 ms
Capture frame ok.
Capture camera time: 40 ms
Send buffer time: 63 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 59 ms
Capture frame ok.
Capture camera time: 0 ms
Send buffer time: 35 ms
Capture frame ok.
By using the second buffer of the camcorder, the buffer in some cycles is obtained instantly. At first, the complete cycle is obtained using less than one buffer, but then this time “runs on”. The interval between cycles is floating.
Several times I caught in the logs "Brownout detector was triggered" so I turned off the detector. Because at first I fed the backlight display from the 3.3V output of the ESP32-CAM
#include "soc/rtc_cntl_reg.h" ... WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
Conclusion
ESP32 low-cost functional module. There is a catastrophic lack of conclusions for implemented ports in the CAM version of the board, so choose the CAM version if you really need a camera.