Main Content

OV2640 Camera Sensor

Capture JPEG images using ArduCam 2MP Mini Plus camera module with OV2640 sensor

Since R2023b

  • OV2640 Camera sensor

Simulink Support Package for Arduino Hardware / Sensors


The OV2640 Camera Sensor block captures images in the JPEG format using the ArduCam Mini 2MP Plus camera module with an OV2640 sensor. The camera is attached to an Arduino® board. This block is a composite sensor block and uses both the SPI and I2C modules.

For a list of boards that support the OV2640 Camera Sensor block, see Supported Boards.


You cannot add multiple OV2640 Camera Sensor blocks to a model.



expand all

Signal input to block that initiates image capture.

Data Types: uint8


expand all

Raw JPEG image data with values ranging from 0—255. The size of the image depends on the JPEG encoding compression ratio and is less than the actual resolution.

Data Types: uint8

Size of the raw JPEG image data.

Data Types: uint16

The Status port outputs the status of the capture operation. Each value corresponds to a specific data output.

ScenarioStatus ValueData Output
Valid output0Valid raw image data
Size of actual image data exceeds the maximum image buffer size10
Invalid output20
Incorrect sensor initialization 30
Capture timeout40

Data Types: uint8


expand all

To connect an ArduCam Mini 2MP Plus camera module with an OV2640 sensor to an Arduino board, enter the chip select pin of the Arduino board. For more information on chip select pins for Arduino boards, see Pin Mapping for Arduino Timer Independent Blocks.

Select the Product ID of the sensor.

Select the dimensions of the image that you want to capture in pixels.

For the list of image resolutions available for the supported boards, see Supported Boards.

Enter the maximum size of the image in bytes. The image size must be supported by the hardware you are using for the chosen resolution.


The max image buffer size must not be greater than the product of selected image resolution.

Specify capture timeout in seconds. Capture timeout allows the sensor block to capture image data at a rate dependent on this value. This parameter also ensures that capture operation times out once this duration has elapsed. During this duration, the camera is busy and cannot carry out any other action.


To avoid overruns, set the capture timeout input to a value that is smaller than the sample time of the block that you select when determining the capture trigger input.

Supported Boards

This list shows the supported board and the corresponding image resolutions.

Arduino BoardSupported resolutions
Arduino Mega 2560a160x120, 176x144, 320x240
Arduino Mega ADK160x120, 176x144, 320x240
Arduino Due160x120, 176x144, 320x240
Arduino MKR1000160x120, 176x144, 320x240, 352x288
Arduino MKR WiFi1010160x120, 176x144, 320x240, 352x288
Arduino MKR Zero160x120, 176x144, 320x240, 352x288
Arduino Nano 33 IoT160x120, 176x144
Arduino Nano 33 BLE SENSE160x120, 176x144
ESP32-DevKitV1160x120, 176x144, 320x240, 352x288, 640x480, 800x600
ESP32-DevKitC160x120, 176x144, 320x240, 352x288, 640x480, 800x600

a Arduino Mega 2560 board supports the 176x144 and 320x240 resolutions only while doing 'Build, Deploy and Start' in Simulink whereas not to 'Monitor and Tune'.


  • To avoid memory overuse on the hardware, on the Hardware tab of the Simulink® model, in the Prepare section, select Control Panel. In the new window that opens, click the Signal & Triggering button. In the second window, clear the Send multiple contiguous samples in same packet option in the Configuration section and click OK.

Version History

Introduced in R2023b