Is my H7 board or OV7725 camera module defect?

Discussion related to "under the hood" OpenMV topics.
mos.pp
Posts: 3
Joined: Thu Jun 25, 2020 11:40 pm

Is my H7 board or OV7725 camera module defect?

Postby mos.pp » Thu Jun 25, 2020 11:51 pm

Hi all,

I have been testing my H7 board with OV7725 camera for last few days.

I have been experiencing this strange behaviour (not sure since when) which randomly comes and goes.

PROBLEM
Exposure of the camera cannot be set beyond 6.6666ms (150Hz).
Setting exposure lower than 6.666666ms works fine but if I set it above 150Hz, it seems it says as 6.666ms.
Also I see that VSYNC is also generating at 150Hz regardless of exposure time when this happens. Only changing resolution change the VSYNC frequency.
I am using the examples > sensor-control > sensor_exposure_control.py to confirm the problem.

Code: Select all

EXPOSURE_TIME_SCALE = 10.0
...
Initial exposure == 6576
Current Exposure == 6576
New exposure == 65760
However, imgae is not bright and FPS stays the same (80-90 FPS). Same for other SCALES = 100 etc

This problem comes and goes all of sudden without a clear reason.
I was able to set correct exposure for about 30 minutes and then suddenly it became bad again.

Things I have tried
I have tested the following to minimise error on my side,
→ Changing USB Port
→ Restarting the script (running example default to set the exposure time)
→ Soft-Reset
→ Full-Firmware Reset (reverting to factory-default firmware)

Any suggestion or help would be appreciated.

Thank you.
Phil
User avatar
kwagyeman
Posts: 4111
Joined: Sun May 24, 2015 2:10 pm

Re: Is my H7 board or OV7725 camera module defect?

Postby kwagyeman » Fri Jun 26, 2020 12:12 am

Hi, you should probably download the OV7725 manual and use the sensor.__write_register() and sensor.__read_register() commands to manually set the camera exposure.

When our exposure control code is very basic. You can only raise the exposure to the level of the frame rate. Of you want to go longer you need to turn on night mode and enable it to let exposure go on for more than 1 frame. You can also turn down the PLL multiplier to reduce the FPS to make everything slower. This will instantly give you longer exposures. See the data sheet for the PLL register address. If you turn it off or lower the multiplier you will likely get the result you want with very little work.
Nyamekye,
mos.pp
Posts: 3
Joined: Thu Jun 25, 2020 11:40 pm

Re: Is my H7 board or OV7725 camera module defect?

Postby mos.pp » Fri Jun 26, 2020 12:28 am

Hi, Kwagyeman,

Thank you for the reply.

All of sudden, my H7+OV7725 is working again with the same example script. Now the image is bright and FPS follows the exposure time.
So right now (when it's good), when I set exposure time, FPS gets automatically slowed down.
kwagyeman wrote:
Fri Jun 26, 2020 12:12 am
You can only raise the exposure to the level of the frame rate.
The problem is that sometimes (only sometimes) FPS is fixed to maximum (150Hz @ QVGA) and exposure time just gets capped at 6.66ms (150Hz) (sensor.get_exposure_us() returns the correct value) .
When this happens, it happens for some period of time (power cycle etc does not fix this problem).

When this happens again, I will try to use setting register method that you have suggested.
User avatar
kwagyeman
Posts: 4111
Joined: Sun May 24, 2015 2:10 pm

Re: Is my H7 board or OV7725 camera module defect?

Postby kwagyeman » Fri Jun 26, 2020 1:40 am

The only thing I can think of is that we are over clocking the camera to hit 150 fps. Trying lowering the PLL setting in the chip and the issue may go away. Also, we have nightmode on my default. So, the camera is allowed to add additional frames to increase exposure if it feels the image is getting too dark. Turning off auto exposure may disable night mode however.
Nyamekye,
mos.pp
Posts: 3
Joined: Thu Jun 25, 2020 11:40 pm

Re: Is my H7 board or OV7725 camera module defect?

Postby mos.pp » Mon Jun 29, 2020 10:17 pm

I have found a cause of this strange behaviour.

The problem only happens in the following case,
(I think this problem can be reproduced in any H7 cameras.)

1. The script turns on and call sensor.reset(),
-> IF the image acquired is bright at the time of camera config (see below for code),
- FPS fixed at maximum, fixed exposure time (>6.66ms) does not take any effect
-> IF the image acquired is dark (by covering up the camera) at the time of camera config
-Fixed exposure time works without any issue

Code: Select all

sensor.set_vsync_output(pin_vsync)
sensor.set_pixformat(sensor.RGB565) 
sensor.set_framesize(sensor.VGA)  
sensor.skip_frames(time = 2000)     # Wait for settings take effect.
clock = time.clock()                # Create a clock object to track the FPS.

sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
sensor.set_auto_exposure(False, exposure_us = int(exposure_time))
sensor.skip_frames(time = 500)
I think the maximum FPS trick that you have mentioned does something funny to the fixed exposure setup.
Is there any fix for this (by calling some script that ensures fixed exposure time regardless of image brightness at the time of camera config)? - It is not ideal to cover the camera sensor physically when it starts.

Thank you for the reply.
Phil
User avatar
kwagyeman
Posts: 4111
Joined: Sun May 24, 2015 2:10 pm

Re: Is my H7 board or OV7725 camera module defect?

Postby kwagyeman » Tue Jun 30, 2020 2:42 am

I don't know. You should really mess with the camera register settings using the data sheet and see what happens. We have to reverse engineer the cameras a little bit using information that leaks online about them. OmniVision doesn't help us directly or anything.
Nyamekye,
User avatar
kwagyeman
Posts: 4111
Joined: Sun May 24, 2015 2:10 pm

Re: Is my H7 board or OV7725 camera module defect?

Postby kwagyeman » Tue Jun 30, 2020 2:43 am

I know, not a satisfying answer, but, the truth. We try to implement exposure control using what the datasheet says. We have no information beyond that.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests