adafruit_ov5640

CircuitPython driver for OV5640 Camera

  • Author(s): Jeff Epler

Implementation Notes

Hardware:

Software and Dependencies:

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)

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

property brightness: int

Sensor brightness adjustment, from -4 to 4 inclusive

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

property colorspace: int

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

property contrast: int

Sensor contrast adjustment, from -4 to 4 inclusive

deinit() None

Deinitialize the camera

property effect: int

Get or set the special effect, one of the OV5640_SPECIAL_EFFECT_ constants

property exposure_value: int

Sensor exposure (EV) adjustment, from -4 to 4 inclusive

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.

property mclk_frequency: int | None

Get the actual frequency the generated mclk, or None

property night_mode: bool

Enable or disable the night mode setting of the sensor

property quality: int

Controls the JPEG quality. Valid range is from 2..55 inclusive

property saturation: int

Get or set the saturation value, from -4 to +4.

property size: int

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

property test_pattern: bool

Set to True to enable a test pattern, False to enable normal image capture

property white_balance: int

The white balance setting, one of the OV5640_WHITE_BALANCE_* constants

property width: int

Get the image width in pixels.