How to configure and use ESP32-CAM with Arduino IDE and Linux

ESP32-CAM is small low cost WiFi camera with OV2460 2Mpix sensor. It allows you to stream video and even to perform some small image filterings and face detection / recognition.

Unfortunately the AI Thinker vendor trying to keep cost as low as possible didn’t include USB programmer in it so the setup is a bit odd.

What do you need to play with ESP32-CAM ?

You need the camera of course and some cables and USB to serial converter which also provide enough 3.3V source to power the camera.

In this example we will use ESP-PROG-C which comes with set of cables and USB-CABLE-micro-1.8M

Step.1

Install Arduino IDE

Please go to arduino.cc and download and install latest Arduino IDE.

Step.2

Linux and CH340

CH340 Linux drivers has bad PLL settings for all Linux kernels before 5.5.

If your system happen to be with Linux Kernel before 5.5. here is the GitHub repository with the patch to install.

If you do not have this patch CH340 will work, but will not be able to communicate at speed over 115200 bps, with the patch up to 2Mbps communication is possible.

Step.3

Wire cables:

You need to connect ESP32-CAM and ESP-PROG this way:

ESP32-CAM GND —-> ESP-PROG GND

ESP32-CAM 3.3V —-> ESP-PROG 3.3V

ESP32-CAM U0T —-> ESP-PROG RXD

ESP32-CAM U0R —-> ESP-PROG TXD

For firmware uploading you need one more connection, which is necessary ESP32 to go in Bootloader mode:

ESP32-CAM IO0 —-> ESP32-CAM GND

Step.4

Configure Arduino for ESP32-CAM

Run Arduino. In the Files-Preferences add:

https://dl.espressif.com/dl/package_esp32_index.json

In Tools-Board-Board Manager search for ESP32 and install it:

Exit Arduino and Run it again so it loads new board data. From File-Examples select ESP32-Camera-CameraWebServer

In select camera model uncomment CAMERA_MODEL_AI_THINKER and comment all other:

Then enter SSID and PASSWORD for your WiFi router.

In Tools-Board select : ESP32Wrover Module

Speed 921600

Flash Frequency 80Mhz

Flash Mode QIO

Partition Scheme: Huge app

Port: the port where your ESP-PROG USB Serial is connected it may be „ttyUSB0“ if you are running Linux or COMxx if you run Windows

Compile and see if there are no errors:

Then Press RESET button on ESP32-CAM, release it and hit Upload button on Arduino IDE.

If you get this error under Linux:

This means that the access to ttyUSB0 is not enabled for your user and you have to run in terminal

$ sudo chown youruser /dev/ttyUSB0 

Where „youruser“ can be seen and try again.

If everything is OK you will see this picture:

Now you have to disconnect ESP32-CAM IO0 and GND and press reset. In serial monitor you will see this message:

when you open http://192.168.100.109/ you will see

Now you can play with the different settings!

ESP32 new boards in stock

ESP32-PICO-KITb

Espressif never stop to surprise us with new products. Their new ESP32-PICO-D4 IC has build in 4MB SPI Flash and quartz crystal, antenna matching circuit, so this chip requires just 5 external resistors and capacitors to work! If your design has to be small this is the chip for you!

ESP32-PICO-KIT is low cost development board for this new chip and has build in USB serial programmer, antenna and breadboard friendly DIL header connectors at 0.1″ step.

ESP32-CAM-F

ESP32-CAM is WiFi IP camera with OV2640 2 Mpix sensor it works with internal PCB antenna and needs just 3.3V external power supply to  operate. You also have SD-card connector and GPIOs to which you can connect PIR sensors and other components to control.

There is Arduino support for this board and tons of interesting projects like face recognition, motion detectors with storage of the pictures on the SD card and etc.

Here are few of them:

We also got ESP32-CAM-UFL which is same board but with U.FL connector where you can connect external antennas.

ESP32-CAM-ANT1

ESP32-CAM-EA is ESP32-CAM with small external WiFi/BT antenna which increased the WiFi coverage.

ESP32-CAM-ANT2

If you need more coverage we have ESP32-CAM-EAX which has higher gain antenna, but with quite bigger size.