API Reference
adafruit_ov5640
CircuitPython driver for OV5640 Camera
Author(s): Jeff Epler
Implementation Notes
Hardware:
ESP32-S2 Kaluga Dev Kit featuring ESP32-S2 WROVER <https://www.adafruit.com/product/4729>
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_ov5640.OV5640(i2c_bus: busio.I2C, data_pins: List[Pin], clock: Pin, vsync: Pin, href: Pin, shutdown: digitalio.DigitalInOut | None = None, reset: digitalio.DigitalInOut | None = None, mclk: Pin | None = None, mclk_frequency: int = 20000000, i2c_address: int = 60, size: int = 1, init_autofocus: bool = True)
Control & Capture Images from an OV5640 Camera
- Parameters:
i2c_bus (busio.I2C) – The I2C bus used to configure the OV5640
data_pins (List[microcontroller.Pin]) – A list of 8 data pins, in order.
clock (microcontroller.Pin) – The pixel clock from the OV5640.
vsync (microcontroller.Pin) – The vsync signal from the OV5640.
href (microcontroller.Pin) – The href signal from the OV5640, sometimes inaccurately called hsync.
shutdown (Optional[digitalio.DigitalInOut]) – If not None, the shutdown signal to the camera, also called the powerdown or enable pin.
reset (Optional[digitalio.DigitalInOut]) – If not None, the reset signal to the camera.
mclk (Optional[microcontroller.Pin]) – The pin on which to create a master clock signal, or None if the master clock signal is already being generated.
mclk_frequency (int) – The frequency of the master clock to generate, ignored if mclk is None, requred if it is specified. Note that the OV5640 requires a very low jitter clock, so only specific (microcontroller-dependent) values may work reliably. On the ESP32-S2, a 20MHz clock can be generated with sufficiently low jitter.
i2c_address (int) – The I2C address of the camera.
size (int) – The captured image size
init_autofocus (bool) – initialize autofocus
- autofocus() list[int]
Perform an autofocus operation.
If all elements of the list are 0, the autofocus operation failed. Otherwise, if at least one element is nonzero, the operation succeeded.
In principle the elements correspond to 5 autofocus regions, if configured.
- autofocus_init()
Initialize the autofocus engine from ov5640_autofocus.bin
- autofocus_init_from_file(filename)
Initialize the autofocus engine from a .bin file
- property autofocus_status
Read the camera autofocus status register
- property autofocus_vcm_step
Get the voice coil motor step location
- capture(buf: bytearray | memoryview) None
Capture an image into the buffer.
- Parameters:
buf (Union[bytearray, memoryview]) – A WritableBuffer to contain the captured image. Note that this can be a ulab array or a displayio Bitmap.
- property capture_buffer_size: int
Return the size of capture buffer to use with current resolution & colorspace settings