We will learn in this project about the ESP32CAM Development Board with camera, how to upload the code to it using Arduino IDE.
Tag: Project 136a How to upload code to ESP32CAM AI-Thinker with Arduino IDE. Acoptex.lt
- Sketch: none;
- Libraries: none.
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):
2. Arduino IDE ( you can download it from here )
3. USB to TTL/Serial adaptor/converter 1 pc
4. Jumper cables F-F
Understanding the USB to TTL converter
You can read more about them here.
Understanding the ESP32CAM Development Board with camera
The ESP32CAM 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.
ESP32CAM 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.
ESP32CAM 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 ESP32CAM 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).
- 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)
- 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 ESP32CAM 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
ESP32CAM 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.
- 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.
Signals and connections of the ESP32CAM Development Board with camera
- 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-CAM 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
|ESP32CAM module||FTDI programmer|
|GND and GPIO0 (for flashing only)|
Step by Step instruction
We assume that you have the latest version the Arduino IDE and ESP32 add on installed in your Arduino IDE. You can read how to do it here – Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux). You can download the latest Arduino IDE version Windows Installer here. We are using PC with Windows 7 64 bit OS.
2.Uploading the code to ESP32CAM
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.Go to Tools -> Board… -> ESP32 Arduino ->and select AI Thinker ESP32-CAM. Make sure you select the right camera module. In this project we use the AI-THINKER ESP32CAM Development Board with camera.
7.Go to Tools -> Port and select the COM port the ESP32-CAM Development Board connected to (we have COM3).
6. Go to File -> Examples -> WebServer (Examples for AI Thinker ESP32-CAM) ->AdvancedWebServer
7. The sketch will open. Modify with your local network data (ssid and password).
8.Click the upload button in Arduino IDE to upload the sketch. When you see Uploading… message press the ESP32-CAM Development Board on-board RST (RESET) button to restart your ESP32 in flashing mode.
9.When uploading completed disconnect GPIO 0 from GND.
10.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.
11.The ESP32CAM Development board IP address should be printed in the Serial Monitor (We have 192.168.0.113).
12.You can access advanced web server on your local network. Open any internet browser (IE,Google Chrome,..) (We used Google Chrome) and type the ESP32-CAM Development board IP address (we have http://192.168.0.113).
13. That’s it. You are ready now for new projects with ESP32-CAM.
If you don’t follow the previous instructions exactly, you may get the following errors:
1.Failed to connect to ESP32: Timed out waiting for packet header. This error means that the ESP32-CAM is not in flashing mode or it is not connected properly to the FTDI programmer.
2. Brownout detector or Guru meditation error.
When you open your Arduino IDE Serial Monitor and the error message “Brownout detector was triggered” is constantly being printed over and over again. It means that there’s some sort of hardware problem.
It’s often related to one of the following issues:
- Poor quality USB cable;
- USB cable is too long;
- Board with some defect (bad solder joints);
- Bad computer USB port;
- Or not enough power provided by the computer USB port.
- Try a different shorter USB cable (with data wires);
- Use a different computer USB port or use a USB hub with an external power supply;
- Try to power the ESP32-CAM with 5V instead 3.3V.
3.Board at COMX is not available – COM Port not selected.
It means that you haven’t selected the COM port in the Tools menu. In your Arduino IDE, go to Tools -> Port and select the COM port the ESP32-CAM connected to.
It might also mean that the ESP32-CAM is not establishing a serial connection with your computer or it is not properly connected to the USB connector.
For a more extensive list of the most common problems with the ESP32-CAM and how to fix them, check out in our Basics: Project 084d ESP32-CAM Development Board with camera – Troubleshooting
Before uploading the code, you need to insert your local network credentials in the following variables:const char* ssid = “*******”;const char* password = “*******”;
We have learnt in this project about the ESP32-CAM Development Board with camera, how to upload the code to it using Arduino IDE.
Check for more DIY projects here.