0

members

Easy Basics: Project 084a ESP32-CAM Development Board with camera - Camera Web Server with Arduino IDE

of Acoptex.com in ESP8266 ESP-32

Basics: Project 084a

Project name: ESP32-CAM Development Board with camera - Camera Web Server with Arduino IDE

Tags: Arduino, Arduino Uno, Ai-Thinker, ESP32-CAM, Development Board with camera, OV2640, OV7670, seeedstudio, Web Server, camera web server, FTDI programmer, ESP32CAM, ESP32 Camera Module with Face Recognition

Attachments: sketch

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. ESP32-CAM Development Board with camera 1 set

2. Arduino IDE ( you can download it from here  )

3. USB to TTL/Serial adaptor/converter 1 pc

4. Jumper cables F-F

5. Micro SD card and SD card adapter 1 pc

6. WiFi AntennaCompact Internal WiFi Antenna with U.FL connector and 5.9 inch cable 1 pc (optional)

General

We will learn how to setup the Ai-Thinker ESP32-CAM Development Board with camera as Camera Web Server using Arduino IDE.

There were some ESP32 camera boards launched previously such as ESP32-PICO-tinyCAM, but most seem to have been phased out. Seeed Studio had AI Thinker ESP32-CAM development board with a 2MP camera for $9.90. This development board can be programmed with ESP-IDF as explained in details in Github or in Arduino IDE. The demo code takes a QR code, and outputs it as ASCII code in the serial console. Another option - M5Stack ESP32 camera (ESP32CAM) board sold for $13.90 shipped on Banggood. The latter features the same OV2640 camera module, does not come with a micro SD card, but includes a USB port, and a grove connector, as well as pads for soldering MPU6050 & BME280 sensors. Another advantage is support LiPo battery via IP5306 charger chip.

We will learn in this project about the ESP32-CAM Development Board with camera (for more details please check seeedstudio.com website), how to connect it with USB to TTL converter or Arduino Uno to your PC/laptop.

Understanding the USB to TTL converter

You can read more about them here.

Understanding the ESP32-CAM Development Board with camera

The ESP32-CAM has a very competitive small-size camera module that can operate independently as a minimum system with a footprint of only 27*40.5*4.5mm and a deep sleep current of up to 6mA.

ESP-32CAM can be widely used in various IoT applications. It is suitable for home smart devices, industrial wireless control, wireless monitoring, QR wireless identification, wireless positioning system signals and other IoT applications. It is an ideal solution for IoT applications.

ESP-32CAM adopts DIP package and can be directly inserted into the backplane to realize rapid production of products, providing customers with high-reliability connection mode, which is convenient for application in various IoT hardware terminals.

The ESP32-CAM Development Board with camera doesn’t come with a USB connector, so you need an USB to TTL/Serial adaptor/converter to upload code through the  serial pins (U0R and U0T pins).

Features:

  • The smallest 802.11b/g/n Wi-Fi BT SoC Module
  • Low power 32-bit CPU,can also serve the application processor
  • Up to 160MHz clock speed,Summary computing power up to 600 DMIPS
  • Built-in 520 KB SRAM, external 4MPSRAM
  • Supports UART/SPI/I2C/PWM/ADC/DAC
  • Support OV2640 and OV7670 cameras,Built-in Flash lamp.
  • Support image WiFI upload
  • Support TF card
  • Supports multiple sleep modes.
  • Embedded Lwip and FreeRTOS
  • Supports STA/AP/STA+AP operation mode
  • Support Smart Config/AirKiss technology
  • Support for serial port local and remote firmware upgrades (FOTA)

Specifications:

  • Dimensions 40.5mm x27mm x4.5mm
  • Weight G.W 20g
  • Battery Exclude
  • Package DIP-16
  • SPI Flash Default 32Mbit
  • RAM 520KB SRAM +4M PSRAM
  • Bluetooth Bluetooth 4.2 BR/EDR and BLE standards
  • Wi-Fi 802.11 b/g/n/
  • Support interface UART,SPI,I2C,PWM
  • Support TF card Maximum support 4G
  • IO port 9
  • UART Baudrate Default 115200 bps
  • Image Output Format JPEG( OV2640 support only ), BMP,GRAYSCALE
  • Spectrum Range 2412 ~2484MHz
  • Antenna Onboard PCB antenna, gain 2dBi
  • Transmit Power 802.11b: 17±2 dBm (@11Mbps); 802.11g: 14±2 dBm (@54Mbps); 802.11n: 13±2 dBm (@MCS7)
  • Receiving Sensitivity CCK, 1 Mbps : -90dBm; CCK, 11 Mbps: -85dBm; 6 Mbps (1/2 BPSK): -88dBm; 54 Mbps (3/4 64-QAM): -70dBm; MCS7 (65 Mbps, 72.2 Mbps): -67dBm
  • Power Dissipation Turn off the flash lamp:180mA@5V; Turn on the  flash lamp and turn on the brightness to the maximum:310mA@5V; Deep-sleep: Minimum power consumption can be achieved 6mA@5V; Moderm-sleep: Minimum up to 20mA@5V; Light-sleep: Minimum up to 6.7mA@5V
  • Security WPA/WPA2/WPA2-Enterprise/WPS
  • Power Supply Range 5V
  • Operating Temperature -20 ℃ ~ 85 ℃
  • Storage Environment -40 ℃ ~ 90 ℃ , < 90%RH

In the package you will get 1 x ESP32-CAM Development Board, 1x camera Module-OV2640-FPC-24P-0.5mm-21mm- 2 Megapixel and 2x headers-2.54mm-1x8pin.

This product has been discontinued at Seeed Studio.  They highly recommend to try & choose Sipeed series products: Starts from $7.9,The 1st RISC-V 64 AI modules/boards for Edge computing, machine vision, speech recognition.

Make AI embeded to any IoT device possible! The new released Maixduino was designed in an Arduino Uno form factor, with a ESP32 module on board together with the MAIX AI module. The support of arduino compatible interface as well as Arduino IDE enable you update your arduino projects from IoT to AIoT easily without any additional cost! The maixduino kit provides an OV2640 camera module and a 2.4 inch TFT LCD for quick start machine vision projects, and onboard MEMS microphone for experiencing speech recognition promptly.

On-Board vs IPEX Antenna

ESP32-CAM Development Board with camera can be with the antenna jumper set for an external antenna or for the on-board antenna. You can see the two different settings below:

If you have a low frame rate or poor reception this might be the problem. You can either move the jumper with a bit of very careful soldering or buy an IPEX WiFi antenna which will improve the signal.

Applications:

  • We can easily build a simple camera with this board and save the photos in an SD card using the embedded SD card slot the board offers.
  • We can then modify this project to detect humans and save an image when one is detected.
  • We can recognize human faces and act accordingly.
  • We can build a surveillance camera with the ESP32 Cam board.
  • We can also stream video using this board.

You can find the ESP32-CAM schematic here, ESP32-CAM development board specification is here, camera specification is here.

Signals and connections of the ESP32-CAM Development Board with camera

ESP32-CAM pinout:

GND - ground pin. Connected to Arduino board GND pin.

5V - external power supply pin 5VDC 2A

VCC - power supply pin. Connected to 5V pin.

3V3 - power supply pin. Connected to 3V3 pin.

U0TXD, U0RXD - Serial pins. You need these pins to upload code to your board.

GPIO 0 - pin which determines whether the ESP32 is in flashing mode or not. When GPIO 0 connected to GND, the ESP32 is in flashing mode.

The following pins are internally connected to the Micro SD card reader:

  • GPIO 14: CLK
  • GPIO 15: CMD
  • GPIO 2: Data 0
  • GPIO 4: Data 1 (also connected to the on-board LED)
  • GPIO 12: Data 2
  • GPIO 13: Data 3

Wiring

Step by Step instruction

1. Adding ESP32 platform to Arduino IDE

The Arduino environment has to be set up to make it compatible with the ESP32 module. 

If you previously installed the hardware libraries for the ESP32 using the old method you need to delete them. Find the folder where your Arduino libraries are kept by opening File -> Preferences in the Arduino IDE. See the sketchbook location field. Click on Browse button. Inside Arduino folder open the hardware folder and find and delete either the esp32 folder or espressif folder.

We are using PC with Windows 10 OS.

  1. Download and install the latest Arduino IDE version Windows Installer. You can download it here.
  2. Open Arduino IDE. 
  3. Open the Preferences window from the Arduino IDE. Go to File -> Preferences.
  4. Paste the following line into the Additional Boards Manager URLs field: https://dl.espressif.com/dl/package_esp32_index.json
  5. If you have entries in this field already then add the new line before them but separate them with a comma.
  6. Go to Tools -> Board -> Board Manager...

  7. Type ESP32, point with mouse cursor on record line found (ESP32 by ...) and click on Install button to install the new hardware libraries.

  8. When installation done, close and open your Arduino IDE again.
  9. You will be able to find all the ESP32 boards in the Arduino IDE’s board selector.

2. Uploading the sketch to the ESP32-CAM Development Board with camera using FTDI programmer

  1. Do wiring. Very important: GPIO 0 (IO 0) must be connected to GND otherwise you will not be able to upload code.
  2. Attach WiFi antenna (optional). It will help you to increase WiFi range.
  3. Attach OV2640 camera.
  4. Plug your FTDI programmer into your PC USB port.
  5. Open Arduino IDE.
  6. Open sketch, modify with your local network data (SSID, password).
  7. Make sure you select the right camera module. In this project we use the AI-THINKER ESP32-CAM Development Board with camera. 
  8. Go to Tools -> Board, select ESP32 Wrover Module.
  9. Go to Tools -> Port and select the COM port the ESP32-CAM Development Board connected to (we have COM10).
  10. Go to Tools -> Partition Scheme, select Huge APP (3MB No OTA).
  11. Press the ESP32-CAM Development Board on-board RST (RESET) button.
  12. Click the upload button in Arduino IDE to upload the sketch.
  13. When uploading completed disconnect GPIO 0 from GND.
  14. Open the Serial Monitor of Arduino IDE (Tools -> Serial Monitor) at the baud rate of 115200. Press the ESP32-CAM Development board on-board RST (RESET) button.
  15. The ESP32-CAM Development board IP address should be printed in the Serial Monitor (We have 192.168.1.103).
  16. You can access your camera streaming server on your local network. Open any internet browser (IE,Google Chrome,..) and type the ESP32-CAM Development board IP address (we have http://192.168.1.103). 
  17. You should be able to see a GUI on the left where you can control elements of the camera, set face detection and face recognition. 
  18. Click Get Still to take a photo. 
  19. Click Start Stream to see a video stream from the camera.
  20. You can do face recognition and detection. First, you need to enroll a new face. It will make several attempts to save the face. After enrolling a new user, it should detect the face later on (subject 0).
  21. That’s it. Now you have your video streaming web server up and running with face detection and recognition.

Code

Before uploading the code, you need to insert your local network credentials in the following variables:const char* ssid = "ssid";const char* password = "password";

Make sure you select the right camera module. In this project we use the AI-THINKER ESP32-CAM Development Board with camera. Comment all the other models and uncomment this one: #define CAMERA_MODEL_AI_THINKER

Summary

We have learnt how to setup the Ai-Thinker ESP32-CAM Development Board with camera as Camera Web Server using Arduino IDE.

Libraries:

  • None

Project resources:

  • See attachments on the begining of this project description


Other projects of Acoptex.com
Easy Basics: Project 086d ESP-12E module, BME280 sensor - Web server of Acoptex.com in ESP8266 ESP-12 18-07-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 25-06-2019
Viewed: 120 times