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 MT9J001/MT9J003 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.
Manual Exposure Control
The integration (exposure) time of the MT9J001/MT9J003 is controlled by the fine_integration_time and coarse_integration_time registers. The limits for the fine integration time are defined by:
fine_integration_time_min ≤fine_integration_time ≤ (line_length_pck – fine_integration_time_max_margin)
The limits for the coarse integration time are defined by:
coarse_integration_time_min ≤ coarse_integration_time
The actual integration time is given by:
It is required that: coarse_integration_time < = (frame_length_lines – coarse_integration_time_max_margin)
If this limit is exceeded, the frame time will automatically be extended to (coarse_integration_time + coarse_integartion_time_max_margin) to accommodate the larger integration time.
Given the pixel clock is 80MHz, line_length_pck_ register (0x300c) is 0x1B5E. In order to simplify the testing purpose, we only set the coarse_integration_time_ registe(0x3012).
Exposure = 0.9ms, RegAddr = 0x3012, Value = 10
Exposure = 4.5ms, RegAddr = 0x3012, Value = 50
Exposure = 9.3ms, RegAddr = 0x3012, Value = 100
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 (0x3028 in hex, 12328 in decimal). Given the exposure register 0x3012(12306) is 10.
RegAddr = 12328 (0x3028), Value = 30
RegAddr = 12328 (0x3028), Value = 50
RegAddr = 12328 (0x3028), Value = 100
White Balance Control
The MT9J003 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.
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.
The global gain is used to set all color gain value at one time. The other 4 registers control GR, R, B, GB respectively.
Gain Setting for MT9J001/MT9J003 Monochrome
For the monochrome version of the MTJ001/MT9J003 all pixels are equivalent. However, the sensor maintains the separate gain adjustment registers from the color part. Thus care needs to be taken when setting analog and digital gain to either use Global Gain register, R0x305E, or to set all of the separate color gain registers R0x3056 through R0x305C.