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

Software Guide

Introduction

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 MT9N001 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 Modelmodel_id register ( 0x0000 )
MT9N0010x2B01

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 the Window GUI.

MT9N001Sample Config
3488×2616MT9N001_3488x2616_9fps.cfg
1744×1308MT9N001_1744x1308_36fps.cfg 
640×480MT9N001_VGA_55fps.cfg

Manual Exposure Control

The integration (exposure) time of the MT9N001 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.

Fine Integration Time Limits

The limits for the fine_integration_time can be found from fine_integration_time_min and fine_integration_time_max_margin.

It is necessary to change fine_correction (R0x3010) when binning is enabled or the pixel clock divider (row_speed[2:0]) is used. The corresponding fine_correction values are shown in following Table .

Fine Correction

For the fine_integration_time limits, the fine_correction constant will change with the pixel clock speed and binning mode.

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 = 8.7ms, RegAddr = 0x3012, Value = 100

Exposure = 17.4ms, RegAddr = 0x3012, Value = 300

Exposure = 43.5ms, 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 (0x3028 in hex, 12328 in decimal). Given the exposure register 0x3012(12306) is 10.

RegAddr = 12328 (0x3028), Value = 20

RegAddr = 12328 (0x3028), Value = 50

RegAddr = 12328 (0x3028), Value = 100

White Balance Control

The MT9N001 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.

RegisterDescription
0x0204 analog_gain_code_global
0x0206analog_gain_code_greenr
0x0208analog_gain_code_red
0x020Aanalog_gain_code_blue
0x020C analog_gain_code_greenb

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.

Was this article helpful to you? Yes No

How can we help?