ESP32-CAM with OV2640 camera video display

Insert picture description here

About ESP32-CAM

ESP32-CAM is an ESP32 development board with a small size and an OV2640 camera module (can also be replaced with OV7670) released by Essence. The size is only 27x40.5x4.5mm, the main frequency can reach 240MHZ, and it has a built-in 520. KB SRAM and external 8MB PSRAM, onboard flash and TF card interface (can be used to save pictures taken), with the above configuration, then we will verify that ESP32 displays video on the web page.
The article in this issue is still the resources released by Espressif at station B. This time we are only verifying the plan. The program comes from Espressif. We also thank Espressif for providing ESP32 and providing various resources for us. Learn from each other and make progress!

Preparation before use

We definitely need to prepare an ESP32-CAM module before use
Insert picture description here

After preparing the main controller module, we need an OV2640 camera module to collect images and transmit them to ESP32. Of course, when buying ESP32-CAM, there will usually be an OV2640. If there is one, we don’t need to
Insert picture description here
prepare one. Finally, we prepare one. USB-TTL is used for downloading programs and serial communication, several Dupont lines

Insert picture description here

Routine modification

The verification scheme we adopted this time is that after both the ESP32 and the computer are connected to the mobile hotspot, the computer will open the IP address of the ESP32 to receive the video. Then we open the routine, see the following part, and need to modify the wifi name and password parameters (examples are required) Cheng can leave a message in the mailbox below, or find it on the Internet, open source)

//Viral Science www.youtube.com/c/viralscience  www.viralsciencecreativity.com
//Blynk ESP32 CAM Simple Monitor System
//While Uploading Code on ESP32 Board 1, comment the lines number: 17,36 and Uncomment lines: 16,35
//While Uploading Code on ESP32 Board 2, comment the lines number: 16,35 and Uncomment lines: 17,36

#include "esp_camera.h"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// Select camera model
#define CAMERA_MODEL_AI_THINKER // Has PSRAM

#include "camera_pins.h"

#define PHOTO 14      //ESP32 CAM 1
//#define PHOTO 15      //ESP32 CAM 2
#define LED 

const char* ssid = "---------";       //wifi name
const char* password = "---------";       //password
char auth[] = "---------------------------------vPmZua_9e2p2Wd_gp2cRrpmMFKutvKoW";          //Auth Code sent by Blynk

String local_IP;
int count = 0;
void startCameraServer();

We find the hotspot function on the mobile phone, see the open hotspot name and password, and fill in the name and password respectively into the parameters ssidand passwordmiddle of the code below

const char* ssid = "---------";       //wifi name
const char* password = "---------";       //password

My mobile hotspot name is OnePlus 8 Pro, the password is YXDZ1234, and the code is modified as follows

const char* ssid = "OnePlus 8 Pro";       //wifi name
const char* password = "YXDZ1234";       //password

There is still a need to fill in the parameters of the back auth[]is used in mobile phones connected camera software is used, we here do not have this feature does not move this parameter on the line

Program burning

In the program, we only need to modify the two parameters of ssid and password in the routine to view the program on the web page. It is relatively simple. After modifying the above, we
need to pay attention to the ESP32-CAM. There is no onboard download circuit and interface, so we need to prepare a downloader, which is a small USB-TTL module. Below we see the pins of ESP32-CAM for wiring

Insert picture description here
When we serial connection to download the note you want to IO0receive GND, at present is to allow the module to enter download mode, after downloading our unplug the IO0wiring can, wiring table refer to our

USB-TTL ESP32-CAM
5V 5V
TXD U0RXD
RXD U0RXD
GND GND & IO0

GND & IO0Refer to IO0and GNDconnect to the GNDport, and then open the computer device manager to check the port number. If it is other or location equipment, install the CH340 driver on Baidu. Let’s see a picture of the connected cable for comparison.

Insert picture description here
First connect the computer to the hotspot opened by the mobile phone, so that you can open the IP address directly after downloading the program.

Insert picture description here

Next, plug the USB-TTL into the computer and check the port number in the device manager. I am here COM20. Different computers are different. I will choose according to my own. The
Insert picture description here
next step is to open the routine that we modified before, and select the development board AI Thinker ESP32-CAM. I checked the port selection before, here I am COM20, click to upload, the program is a bit big and the upload time is a bit longer

Insert picture description here

Web link

After completion of the upload process IO0and GNDthe cord between the pull down, open the port monitor, the above pressing RSTthe reset button, the printout will we need to see the IP address after the hotspot on the phone browser to copy the IP addresses Open in the browser to see the camera parameter configuration interface. It
should be noted that the computer and ESP32 must be in the same network, which is the operation of connecting the computer and ESP32 to the mobile phone.

Insert picture description here
After opening the webpage, you can see that there are many parameters below. The first Resolution is used to configure the resolution. The red part below Get Still is used to obtain a frame of image. It can be considered that taking a picture is similar. Start Stream can display the picture in real time. It can be regarded as a video.
Basically, you can get a complete picture with the above three parameters. There is also a WB mode. You can try to see what effects such as magnification. To explain, the following is a demonstration of the effect of a light ball taken after configuration

Insert picture description here

to sum up

This issue is quite satisfactory for the ESP32-CAM to display video through wifi wirelessly. When the resolution is high, the refresh speed will be slow and it will look a bit stuck. However, the personal feeling is quite good relative to the production cost. One more thing to note is that some small partners may have lines on the screen during the test. The greater probability is due to insufficient power supply. It is recommended to use a power supply of 5V 2A or more, because IO0 when in use There is an XCLK connected to the camera, so do not connect IO0 to high level after downloading the program. It is good
to disconnect and connect nothing. Friends who need the program and other materials can leave a message in the mailbox below, or download it online by themselves, welcome Leave a message to communicate, everyone can learn from each other and make progress!

Guess you like

Origin blog.csdn.net/qq_42250136/article/details/111402443