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 Register||Value|
|PIDL||0x41 or 0x42|
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.
|AEC||Bank 1, 0x13 |
bit = exposure control
0: Manual, 1: Auto
|AGC||Bank 1, 0x13 |
Bit: 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.
|0x45||Bit[5:0]: AEC[15:10], AEC MSBs|
|0x10||Automatic Exposure Control 8 bits for AEC[9:2]|
Manual Gain Control
Once the AGC is disabled, the gain setting can be manually adjust.
|0x00||AGC Gain Control LSBs Bit[7:0]: |
Gain setting • Range:
1x to 32x Gain =(Bit+1) x (Bit+1) x (Bit+1) x (Bit+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.
|0x44||Quantization Scale Factor|