#MicroPython: OV2640 camera module extended (M5Camera, ESP32-CAM, etc.)
M5Stack, MicroPython | 2 min | 10800
I've just upgraded the MicroPython camera module for ESP32. The OV2640 uses I2S and two months ago, I wrote/updated the I2S connector to support more boards (check the hardware and software section below).
This time with the help of @joerggollnick, the driver was extended to include the following camera settings:
vertical flip, and
Hardware and Software
I've included a compiled MicroPython firmware that supports camera and BLE (check the firmware folder). The firmware was compiled using esp-idf 4.x with hash version 4c81978 and MicroPython with hash version 836bca9.
To flash it to the board, you need to type the following:
esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 micropython_836bca9_esp32_idf4.x_ble_camera.bin
More information is available in this tutorial.
If you want to compile your driver from scratch follow the section
DIY (from Scratch)from this article: MicroPython: Support for cameras: M5CAMERA, ESP32-CAM etc..
I've included an application to test the camera and its settings. To deploy the app on your ESP board, follow these steps:
- Clone the repository:
git clone https://github.com/lemariva/uPyCam.git
- Rename the file
config.pyand configure: a. Your WI-FI credentials, b. The camera that you have (M5CAMERA/ESP32-CAM). If you have another camera, you need to configure the pins in the file
- Upload the code using VSCode and the PyMark extension. If you need the instructions, follow this article for more information: MicroPython: Visual Studio Code (VSCode) as IDE
- Open a browser and type the URL that your board publishes in the terminal:
I (4380) network: GOT_IP network config: ('192.168.178.165', '255.255.255.0', '192.168.178.1', '192.168.178.1')
In my case, it is
http://192.168.178.165and you will get something like Fig. 1.
Fig. 1: Camera webserver.
The new camera settings are the following:
Setting Description Values
image saturation from
image brightness from
image contrast from
image quality from
color effects for the image
That's all you need. If you have any questions, please leave them in the comment section below! :)
- Clone the repository:
Is it also possible to create a video stream with micropython? I can only seem to capture images? When coding the ESP32-cam with arduino I'm able to create a video steam. Is this also possible with micropython?
Hi, I cannot get passed the init line and I was wondering if I can get some help. Thank you ESP32-CAM config.py: