adafruit_ov2640

CircuitPython driver for OV2640 Camera.

  • Author(s): Jeff Epler

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_ov2640.OV2640(i2c_bus: I2C, data_pins: Pin, clock: Pin, vsync: Pin, href: Pin, shutdown: Pin | None = None, reset: Pin | None = None, mclk: Pin | None = None, mclk_frequency: int = 20000000, i2c_address: int = 48, size: int = 1)

Library for the OV2640 digital camera

Parameters:
  • i2c_bus (busio.I2C) – The I2C bus used to configure the OV2640

  • data_pins (List[microcontroller.Pin]) – A list of 8 data pins, in order.

  • clock (microcontroller.Pin) – The pixel clock from the OV2640.

  • vsync (microcontroller.Pin) – The vsync signal from the OV2640.

  • href (microcontroller.Pin) – The href signal from the OV2640, sometimes inaccurately called hsync.

  • shutdown (Optional[microcontroller.Pin]) – If not None, the shutdown signal to the camera, also called the powerdown or enable pin.

  • reset (Optional[microcontroller.Pin]) – 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

  • i2c_address (int) – The I2C address of the camera.

capture(buf: array | bytearray | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray) memoryview | None

Capture an image into the buffer.

Parameters:

buf (WriteableBuffer) – 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

property colorspace: bytes

Get or set the colorspace, one of the OV2640_COLOR_ constants.

deinit() None

Deinitialize the camera

property exposure: int

The exposure level of the sensor

property flip_x: bool

Get or set the X-flip flag

property flip_y: bool

Get or set the Y-flip flag

property height: int

Get the image height in pixels. A buffer of 2*width*height bytes stores a whole image.

property mclk_frequency: int | None

Get the actual frequency the generated mclk, or None

property product_id: int

Get the product id (PID) register. The expected value is 0x26.

property product_version: int

Get the version (VER) register. The expected value is 0x41.

property size: int

Get or set the captured image size, one of the OV2640_SIZE_ constants.

property width: int

Get the image width in pixels. A buffer of 2*width*height bytes stores a whole image.