adafruit_ov2640

CircuitPython driver for OV2640 Camera.

  • Author(s): Jeff Epler

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_ov2640.OV2640(i2c_bus, data_pins, clock, vsync, href, shutdown=None, reset=None, mclk=None, mclk_frequency=20000000, i2c_address=48, size=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)

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

Return the size of capture buffer to use with current resolution & colorspace settings

property colorspace

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

deinit()

Deinitialize the camera

property exposure

The exposure level of the sensor

property flip_x

Get or set the X-flip flag

property flip_y

Get or set the Y-flip flag

property height

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

property mclk_frequency

Get the actual frequency the generated mclk, or None

property product_id

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

property product_version

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

property size

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

property width

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