STM32 camera configuration

Note: esp32 camera needs to be burned with factory firmware. If you have not flashed the firmware after receiving the esp32 camera, it is not necessary. The factory default firmware, before using iic communication, you can use the serial port to configure the esp32 camera to the network, and iic is used for data reading

1. Experimental preparation

2. Wiring diagram

STM32ESP32 camera
PA2RX
PA3TX
GNDGND
5V5V
STM32USB to ttl module
PA9RX
PA10TX
GNDGND
5V5V

image-20241230110537508

Physical connection diagram:

image-20241230110626356

3. Experimental steps and experimental results

  1. Check whether the program runs normally
  2. In the main function, change to the corresponding ai mode.

image-20241230110753143

  1. You can modify the WiFi name and password you want to connect to, as well as the name of the hotspot in the esp32_wifi.cpp file

image-20241230110836247

  1. Download the program of this project to the STM32 board
  2. Open the serial port assistant on the computer, open the computer to detect the serial port of STM32, as shown below

image-20241227220158089

After pressing the reset button of STM32, the serial port assistant will print out the corresponding information

image-20241230111719182

  1. Open the camera and connect to the hotspot released by esp32 (you can also log in directly using sta_ip(192.168.2.88))

image-20241227193608411

Then enter through the browser http://192.168.4.1:81/stream This accesses the camera screen

image-20241227193619527

  1. Identify cats and dogs. If the recognition is successful, the current center coordinates will be printed out, and the cat image will be placed in front of the previous screen.

image-20241227193635757

At the same time, the terminal will print out the current coordinates and the selected area

image-20241230112233387

Face recognition mode

When switching to face recognition mode,

image-20241230112 304355

Compile and download to the STM32 motherboard, open the serial port debugging assistant

image-20241227220158089

image-20241230112319825

Recognize face. When you see a face, press the key button to record the face

image-20241230103919060

The following picture appears, which means the recording is successful, and the face 1 is recorded

image-20241230103928349

At this time, you can press and hold the button for two seconds, then release it and press the button again to recognize the current face

image-20241230103938267

At the same time, the terminal will print out the current center coordinates and the recognized face.

image-20241230112523677

Color detection mode

When switching to face recognition mode,

image-20241230112547968

Compile and download to the STM32 motherboard, open the serial port debugging assistant

image-20241227220158089

image-20241230111719182

Recognize the color. Press the button and a box will appear. You can use this box to select the color you want to use.

image-20241230104742818

Press and hold the button for two seconds, release it and press it again to identify the currently selected color, and a red frame will appear.

image-20241230104751464

At the same time, the terminal will print out the current center coordinates.

image-20241230112233387

QR code detection

When switching to QR code mode,

image-20241230112715569

Compile and download to the STM32 motherboard, open the serial port debugging assistant

image-20241227220158089

image-20241230111719182

Use the WeChat applet on your mobile phone to search for the QR code generator. A QR code will be generated for the corresponding text and saved to the album. The following is the identification of the QR code.

image-20241230112838493

At the same time, the terminal will print out the recognized text.

image-20241230113218294