Repo of the Day
lemariva/micropython-camera-driver
Published: Feb 16, 2024
Open repository ↗Add camera support to MicroPython
Summary
micropython-camera-driver adds OV2640 camera support to MicroPython running on ESP32-family boards. It ships with pre-compiled firmware binaries plus a build-from-scratch path, and exposes a camera module that supports JPEG capture with optional PSRAM-backed frame buffers. A documented trade-off is that higher resolutions (above CIF with JPEG) require PSRAM, and the firmware is built without BLE because of memory constraints.
What it is useful for
This driver is the missing piece for engineers who want image capture on small ESP32 boards without leaving the MicroPython environment. The README lists concrete board targets: ESP32-CAM (default config), M5Camera Version B, and the T-Camera Mini (green PCB), each with its own pin mapping for the OV2640 data lines, sync signals, and I2C control.
It is useful for IoT projects such as a streaming webserver or a timelapse camera; the README points to two companion example repos (upyCam for the webserver and a timelapse-camera branch) that show end-to-end usage. Inside MicroPython, the camera module exposes settings an engineer would expect: flip, mirror, framesize (from FRAME_96X96 up to FRAME_FHD and beyond), speffect, whitebalance, saturation, brightness, contrast, and quality (10–63, lower is higher quality). Captured frames come back from camera.capture() as a buffer.
How engineers can use it
The fastest path is flashing one of the included firmware images. The README documents this with esptool.py, first erasing flash and then writing the binary at 0x1000, adjusting the serial port (for example /dev/ttyUSB0) for the host machine.
For a custom build, the DIY section walks through cloning MicroPython (with the specific commit hash the author used), copying or symlinking the boards/ESP32_CAM folder into micropython/ports/esp32/boards, cloning esp32-camera into the ESP-IDF components folder at a matching hash, and compiling with make USER_C_MODULES=.../micropython-camera-driver/src/micropython.cmake BOARD=ESP32_CAM all. The exact MicroPython/ESP-IDF/esp32-camera hashes used are listed in the README, and the author warns that mismatched versions cause build failures.
Documented limitations worth planning around: YUV and RGB capture often runs out of memory and drops data, especially with WiFi enabled, so the README recommends capturing JPEG and converting offline. The pre-built firmware also has BLE disabled. The README points to a blog tutorial for full installation context if the inline steps leave gaps.