OV2640 Camera Sensor
Capture JPEG images using ArduCam 2MP Mini Plus camera module with OV2640 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.
Capture trigger — Initiate image capture
Signal input to block that initiates image capture.
Data — Raw JPEG image data
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 length — Size of data
Size of the raw JPEG image data.
Status — Capture outcome status
The Status port outputs the status of the capture operation. Each value corresponds to a specific data output.
|Scenario||Status Value||Data Output|
|Valid output||Valid raw image data|
|Size of actual image data exceeds the maximum image buffer size|
|Incorrect sensor initialization|
Chip select pin — Chip select pin of Arduino board
10 (default) | target hardware pin
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.
Product ID — Product ID of sensor
0x41 (default) |
Select the Product ID of the sensor.
Image Resolution — Image dimensions
160x120 (default) |
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.
Max image buffer size — Maximum size of image
3500 (default) | any nonnegative value
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.
max image buffer size must not be greater than the product
Capture timeout — Duration of Capture timeout
1 (default) | any nonnegative value
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.
This list shows the supported board and the corresponding image resolutions.
|Arduino Board||Supported resolutions|
|Arduino Mega 2560a|
|Arduino Mega ADK|
|Arduino MKR WiFi1010|
|Arduino MKR Zero|
|Arduino Nano 33 IoT|
|Arduino Nano 33 BLE SENSE|
a Arduino Mega 2560 board supports the
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.
Introduced in R2023b