Standalone ArduCam Mini 2MP module and ESP32 board

ArduCam has many different modules with cameras, they are easy to connect to Arduino or ESP8266. But if You search for tutorial how to interface ArduCam Mini 2MP OV2640 module with ESP32 You may be not so lucky. Almost all examples are for AI Thinkers ESP32 CAM module, which has fixed connection (wiring) between ESP32 and OV2640. It turns out it is not so hard to get OV2640 module run on ESP32. So quick howto guide for You!

First, OV2640 module uses both SPI and I2C for communication, however… when I have connected all and got running then with disconnected I2C Arducam Mega library was complaining:

ArduCAM Start!
[ 1030][E][Wire.cpp:513] requestFrom(): i2cRead returned Error 263
[ 2033][E][Wire.cpp:513] requestFrom(): i2cRead returned Error 263
Can’t find OV2640 module!

Despite that module was working and providing images. So, You need to test if I2C is really needed. I did only quick tests with this module, was not even trying to use it in any real project.

As ESP32 board I was using ESP32 D1 mini board, so quick wiring guide is as follow:

Signal on OV2640 moduleESP32 GPIO
CSGPIO17
SCKGPIO18
MISOGPIO19
MOSIGPIO23
SDAGPIO21
SCLGPIO22
GNDGND
VCC3.3V

Now, use ArduCam Mega library and it has example for this module and ESP8266. It can be used, just few fixes needed:

  • ESP8266WiFi.h need to be changed to WIFi.h
  • ESP8266WebServer.h with WebServer.h
  • ESP8266mDNS.h include can be removed
  • in library files find file memorysaver.h and uncomment #define OV2640_MINI_2MP (attached download with Platformio project has it changed already, but if it will be reinstalled, then You need to add this define again)
  • and of course change const int CS = 16; to 17 according to connection table above
  • I prefer when module work as WiFi client, so change wifiType to 0 and enter correct SSID and PASSWORD in code

And that’s should be enough. OV2640 is quite power hungry, sometimes You can get ESP32 reset with brownout detected when powering module from computer USB port. Since default resolution is 320×240 I have added myCAM.OV2640_set_JPEG_size(OV2640_1600x1200); to get bigger picture. Now navigate to IP address of ESP32 and visit /stream to get video stream or /capture to get static image.

Screenshot from OV2640 module