# Is my H7 board or OV7725 camera module defect?

**URL:** <https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803>\
**Category:** OpenMV Boards\
**Created:** [June 26, 2020, 3:51am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803 "2020-06-26T03:51:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mos.pp](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@mos.pp](https://forums.openmv.io/u/mos.pp)\
**Post date:** [June 26, 2020, 3:51am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/1 "2020-06-26T03:51:58Z")

</div>

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.

```python
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

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [June 26, 2020, 4:12am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/2 "2020-06-26T04:12:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mos.pp](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@mos.pp](https://forums.openmv.io/u/mos.pp)\
**Post date:** [June 26, 2020, 4:28am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/3 "2020-06-26T04:28:34Z")

</div>

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.

> [@](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [June 26, 2020, 5:40am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/4 "2020-06-26T05:40:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mos.pp](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@mos.pp](https://forums.openmv.io/u/mos.pp)\
**Post date:** [June 30, 2020, 2:17am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/5 "2020-06-30T02:17:42Z")

</div>

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  
  
  

```python
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

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [June 30, 2020, 6:42am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/6 "2020-06-30T06:42:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [June 30, 2020, 6:43am UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/7 "2020-06-30T06:43:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ajacobs](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@ajacobs](https://forums.openmv.io/u/ajacobs)\
**Post date:** [August 24, 2020, 1:53pm UTC](https://forums.openmv.io/t/is-my-h7-board-or-ov7725-camera-module-defect/1803/8 "2020-08-24T13:53:46Z")

</div>

I have encountered the same issue. See my posts here for all the attempts made to resolve without success.

> **[Sensor fixed gain/exposure not working](https://forums.openmv.io/viewtopic.php?f=6&t=2011&e=1&view=unread#unread)**
>
> Setting a fixed gain and fixed exposure is not working. With set\_auto\_exposure and set\_auto\_gain both False, it appears that some auto gain/exposure is still occurring. sensor.set\_auto\_exposure(False, exposure\_us=10000) sensor.set\_auto\_gain(False,...

Have you had any further luck finding a resolution or work around?
