1. Home
  2. Docs
  3. Camera breakout board
  4. 2MP OV2640
  5. Software Guide

Software Guide


This page describle the basic control over the sensor registers using Arducam camera breakout board, it might not be able to cover all the detail register operations, but give you an insight how to adjust these settings.

Sensor I2C Slave Address

The OV2640 camera I2C 8-bit slave address is fixed to 0x60. With 8bit regsiter address, and 8bit register value. And there are two register banks, the bank 0 and bank 1. Using 0xFF register to assign which bank to access.

In the Bank 1 register, there is two product ID register (0x0A/0x0B) which can help diagnose if the I2C bus is accessable and determine the camera models.

Product ID RegisterValue
PIDL0x41 or 0x42

Sensor Initialization

You need a basic settings to bring up the sensor and make it working in normal streaming mode. Here is the sample config for Arduino.


The OV2640 is a SOC sensor, which support auto white balance, auto exposure and auto gain. Sometimes you might need to disable these auto functions to set manual control.

Auto FuctionRegister
AECBank 1, 0x13
bit[0] = exposure control
0: Manual, 1: Auto
AGCBank 1, 0x13
Bit[2]: AGC auto/manual control selection
0: Manual 1: Auto

Manual Exposure Control

Once the AE is disabled, the exposure time is adjustable manually. The exposure time is line basis, the minimum exposure time is one line time.

AEC[15:0]: Exposure time TEX = tLINE x AEC[15:0]

Note: The maximum exposure time is 1 frame period even if TEX is set longer than 1 frame period.

Bank1 RegisterDescription
0x45 Bit[5:0]: AEC[15:10], AEC MSBs
0x10 Automatic Exposure Control 8 bits for AEC[9:2]
0x04 Bit[1:0]: AEC[1:0]

Manual Gain Control

Once the AGC is disabled, the gain setting can be manually adjust.

Bank1 Register
0x00AGC Gain Control LSBs Bit[7:0]:
Gain setting • Range:
1x to 32x Gain =(Bit[7]+1) x (Bit[6]+1) x (Bit[5]+1) x (Bit[4]+1) x (1+Bit[3:0]/16)
0x45 Bit[7:6]: AGC[9:8], AGC highest gain control

JPEG Compression Ratio

OV2640 JPEG quality is adjustable through the quantization scale register.

Bank0 RegisterDescription
0x44Quantization Scale Factor
Was this article helpful to you? Yes No 9