Using a Camera with the ESP32

Alasdair Allan
2 min readJun 27, 2018


The arrival of the ESP8266, and more lately the ESP32, has changed the way a lot of us approach computing. The “peace dividend” of the smartphone war and the precipitous drop in the price of computing, more than anything exemplified by the two Espressif chips, have brought us to a place where computing is not just cheap it’s essentially free.

More and more, people are able to use low-cost, low-power computing to do things that used to take much more powerful machines. Low-cost computing is good enough for most purposes. Such as running a camera.

Prototype Ai-Thinker CAM board. (📷: Ai-Thinker)

Because it looks like Ai-Thinker is in the process of putting together an ESP32-based camera module, which they’re going to be offering on Taobao.

However, it appears they’ve published their demo code along with detailed instructions on how to get it working with an off-the-shelf ESP32 board and camera module.

The code supports the OV2640 camera module with output JPEG format, and both the OV2640 and the newer OV7725 module with output a “grayscale format.” Interestingly, the demo code even supports full blown QR code recognition.

The instructions walk you through howt to connect the camera to ESP32 module, flash application to the ESP32, and then finally shoot and display the image from the camera.

QR code recognition with an ESP32-based camera module. (📷: Ai-Thinker)

While the table showing pin connections are aimed at ESP32 DevKitJ (aka the ESP-WROVER-KIT), and Ai-Thinker’s upcoming camera module, with a bit of trial-and-error they should map to most of the commonly available ESP32 modules, and if not then, “…pinout can be adjusted to some extent in software.”

Images from the camera can be retrieved over I2S, while if QR recognition is enabled QR code recognition all happens on the serial command line.

Over the years we’ve seen some amazing hacks done with the ESP8266 and ESP32 chips showing exactly how capable a low-powered microcontrollers can actually be, and how little we seem to need higher powered and higher cost processors to get things done. Projects like this leave me more convinced that ever that the next generation of high powered microcontrollers will be defined, not by their hardware, but by their user experience.