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 MT9M001 camera I2C 8-bit slave address is fixed to 0xBA. With 8bit regsiter address, and 16bit register value.
There is a ” model_id ” register (0x00) which can help diagnose if the I2C bus is accessable and distinguish the camera models.
|Camera Model||model_id register ( 0x00 )|
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.
|MT9M001_1280*1024 (Color)|| MT9M001_1280x1024_8bit_C.cfg|
Manual Gain Control
The gain settings can be independently adjusted forthe colors of green1, blue, red and green2 and are programmed through Registers 0x2B, 0x2C, 0x2D, 0x2E respectively. A total programmable gain of 15 is available and can be calculated using the following formula:
Gain 1 to 8: Gain = (bit + 1) * (bit[5-0] * 0.125)
For gain higher than 8, the user would need to set bit[6:5] = 11 and use the lower 3 LSB’s bit[2:0] to set the higher gain values. The formula for obtaining gain greater than 8 is as follows:
Total gain = 8 + bit[2:0]
Since bit of the gain registers are multiplicative factors for the gain settings, there are alternative ways of achieving certain gains. Some settings offer superior noise performance to others, despite the same overall gain. The following lists the recommended gain settings:
|1.000 to 4.000||0.125||0x08 to 0x20|
|4.25 to 8.00||0.25||0x51 to 0x60|
|9.0 to 15.0||1.0||0x61 to 0x67|
There are 5 registers below control the gain settings.
|0x2B||6:0||Even row, even column—default = 0x08 (8) = 1x gain|
|0x2C||6:0||Odd row, even column—default = 0x08 (8) = 1x gain|
|0x2D||6:0||Even row, odd column—default = 0x08 (8) = 1x gain|
|0x2E||6:0||Odd row, odd column—default = 0x08 (8) = 1x gain|
|0x35||6:0||Global gain—default = 0x08 (8) = 1x gain. This register can be used to set all four gains at once|
Here we demonstrate how to change the gain through the global gain register (0x35).
RegAddr = 0x35, Value = 8
RegAddr = 0x35, Value = 81
RegAddr = 0x35, Value = 103
Manual Exposure Control
The exposure is also called Pixel Integration Control. The MT9M001 is rolling shutter so the exposure is line basis, They do exposure line by line, so all pixels in a line are exposed at the same time, but different pixels from different line are exposed at different time.
In this case, the minimum exposure time is 1 Line Time, and the maximum exposure time is one Frame time. Basically it equals to total vertical resolution times 1 Line Time, but sometimes there are dummy lines and blanking period added to the frame.
These registers (along with the window sizing and blanking registers) control the integration time for the pixels.
The actual total integration time (tINT) is:
tINT = Reg0x09 x row time – overhead time – reset delay, where:
Row time = ((Reg0x04 + 1) + 244 + Reg0x05 – 19) pixel clock periods
Overhead time = 180 pixel clock periods
Reset delay = 4 x Reg0x0C pixel clock periods
If the value in Reg0x0C exceeds (row time – 548)/4 pixel clock cycles, the row time will be extended by (4 x Reg0x0C – (row time – 548)) pixel clock cycles.
In this expression, the row time term, Reg0x09 x ((number of columns) + 244 + horizontal blanking register – 19), corresponds to the number of rows integrated. The overhead time (180 pixel clocks) is the overhead time between the READ cycle and the RESET cycle, and the final term is the effect of the reset delay.
Typically, the value of Reg0x09 is limited to the number of rows per frame (which includes vertical blanking rows) such that the frame rate is not affected by the integration time. If Reg0x09 is increased beyond the total number of rows per frame, the MT9M001 will add additional blanking rows as needed. A second constraint is that tINT must be adjusted to avoid banding in the image from light flicker. Under 60Hz flicker, this means tINT must be a multiple of 1/120 of a second. Under 50Hz flicker, tINT must be a multiple of 1/100 of a second.
Also for simplify we only change the 0x09 register to demonstrate how manual exposure works.
|0x09||13:0||Number of rows of integration—default = 0x0419 (1049)|
When global gain register (0x35) setting is 103, we change the 0x09 register as follows, we can get different exposure result as follows:
RegAddr = 0x09, Value = 300
RegAddr = 0x09, Value = 600
RegAddr = 0x09, Value = 900
White Balance Control
The MT9M001 (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 MT9M001(Monochrome )
The MT9M001( Monochrome ) sensor output RAW format image as the MT9M001(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 MT9M001(color).