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 AR0134/AR0135 camera I2C 8-bit slave address is fixed to 0x20. With 16bit regsiter address, and 16bit register value.
There is a ” model_id ” register (0x0000) which can help diagnose if the I2C bus is accessable and distinguish the camera models.
|Camera Model||model_id register ( 0x0000 )|
You need a basic settings to bring up the sensor and make it working in normal streaming mode. Here is the sample config for the Window GUI.
|AR0134_1280*964 (Color)||AR0134_1280x964_8bit_C.cfg |
The integrated automatic exposure control (AEC) is responsible for ensuring that optimal settings of exposure and gain are computed and updated every other frame.
AEC can be enabled or disabled by R0x3100:
When AEC is disabled (R0x3100 = 0),
the sensor uses the manual exposure value in the coarse and fine integration time registers and the manual gain value in the gain registers.
When AEC is enabled (R0x3100=1), the target luma value is set by AE_LUMA_TARGET_REG (R0x3102).
The luma target maximum auto exposure value is limited by R0x311C; the minimum auto exposure is limited by R0x311E. These values are in units of line-times. The minimum value for register 0x311E is 1 line. The exposure control measures current scene luminosity by accumulating a histogram of Gr pixel values while reading out a frame. It then compares the current luminosity to the desired output luminosity. Finally, the appropriate adjustments are made to the exposure time and gain.
Manual Exposure Control
The integration (exposure) time of the AR0134/AR0135 is controlled by the row_time and coarse_integration_time registers. The limits for the row_ time are defined by:
one row-time is equal to the sum of the number of active pixels (columns) and the number of horizontal blanking pixels divided by the pixel readout rate:
The value of the coarse_integration_time register is limited to the number of
lines per frame (which includes vertical blanking lines), such that the frame rate is not
affected by the integration time.
The exposure time is given by:
Given the pixel clock is 87MHz, line_length_pck_ register (0x300C) is 0x0672. In order to simplify the testing purpose, we only set the coarse_integration_time_ register(0x3012).
Exposure = 4.9ms, RegAddr = 0x3012, Value = 100
Exposure = 9.7ms, RegAddr = 0x3012, Value = 200
Exposure = 24.3ms, RegAddr = 0x3012, Value = 500
Manual Gain Control
Gain settings are like the ISO settings in most digital cameras. The gain is divided into analog and digital gain, and there are separate gain settings for four color-specific gains. There is also global gain setting to change all the four color-specific gains.
Here we demonstrate how to change the gain through the analogue_gain_code_global_ register (0x305E). Given the exposure register (0x3012) is 200.
RegAddr = 0x305E, Value = 30
RegAddr = 0x305E, Value = 60
RegAddr = 0x305E, Value = 90
White Balance Control
The AR0134/AR0135 (Color) sensor output is RAW bayer format, each RGB channel gain is controlled by corresponding gain regsiter.
There are 5 registers related to color gain settings which can be used for control white balance.
The global gain is used to set all color gain value at one time. The other 4 registers control GR, R, B, GB respectively.
Tips: GR, GB should be set equally, and Red, Blue gain can be set higher than GR/GB gain to get better color represent. Automatic software whtie balance is also possible with proper AWB algorithm to set these gain settings automatically.
Gain Setting for AR0134/AR0135 (Monochrome )
The AR0134/AR0135 ( Monochrome ) sensor output RAW format image as the AR0134/AR0135 (color,) the surrounding for pixel called ee, eo, oe and oo (even or odd pixel), they are controlled by the same GR, R, GB, B gain setting registers as the AR0134/AR0135 (color).