Manual Exposure for OV2640

Published by Lee Jackson on


ArduCAM all given examples are using auto exposure for easy use of the camera. But somethings users want to control the exposure more precisely. This article will cover how to do manually exposure to OV2640 camera.

How does Rolling Shutter Sensor Exposure

All rolling shutter image sensors including OV2640 are doing exposure by line basis. They do exposure line by line, so all pixels in a line are exposed at the same time, but different pixels from the different lines are exposed at different times.

In this case, the minimum exposure time is 1 Line Time, and the maximum exposure time is one Frame time. Basically it equals total vertical resolution times 1 Line Time, but sometimes there are one or more dummy lines added to the frame.

The OV2640 Timing

The following figure is the OV2640 UXGA (1600 x 1200) resolution timing diagram.

1 Line is composed by 1600 pixels and 322 clock horizontal blanking, Tline = 1922 pclk in total.

1 Frame is composed by 1248 lines including the active 1200 lines and 4 lines + 44 lines of vertical blanking.

Given the pixel clock is 36MHz by default, the 1 Line time is 53.39us. The calculated frame time is 66.63ms. So the minimum exposure time is 53.39us and maximum exposure time is 66.63ms if no additional dummy pixels and dummy lines added.

How to Set Manual Exposure with OV2640

In order to enable OV2640 manual exposure, we have to disable the AEC bit from register 0x13 in the register Bank 1. Don’t forget to switch to the register Bank 1 by writing 0x01 to 0xFF register.

The exposure register is spreaded in 3 registers 0x45, 0x10, 0x04 in the register Bank 1. Write correct value in line basis to these register will change the exposure of the target images.

More Control Over the Exposure

The maximum exposure time is limited by the Frame time. If we want to over exposure of a image when at night, we have three other ways to do it.

  • Change the Pixel Clock

Write 0x11 register in the register Bank 1 will adjust the pixel clock speed, and in turn change the Line time accordingly.

  • Add dummy pixels to a line

Write 0x2A and 0x2B register in the register Bank 1 will add dummy pixels to a Line, and in turn change the Line time accordingly.

  • Add dummy lines to a frame

Write 0x2D and 0x2E register in the register Bank 1 will add dummy Lines, and in turn change the Frame time accordingly.

Testing Result

Here we set different exposure value to AEC register at the same light enviroment. The exposure values are 200, 400, 800, 1024 which is in lines basis, and corresponding  to 10.7ms, 21.4ms, 42.7ms and 54.7ms.

Your Cart is empty!

It looks like you haven't added any items to your cart yet.

Browse Products