Hi everyone, I’m struggling to get my OV7251 global shutter camera working properly on a Raspberry Pi Zero 2 running Bullseye OS. The main issue is that I can’t seem to set gain and exposure at all — the controls just don’t respond. I’ve tried both libcamera and v4l2-ctl and neither works reliably. The camera itself is detected sometimes but it’s really unstable. Has anyone managed to get manual exposure and gain control working on this sensor? Any pointers would be appreciated.
Thanks for reaching out. The OV7251 should be accessible through libcamera on Bullseye, but you’ll need to use the correct tuning file since it’s not natively calibrated. Try this command:
libcamera-still -t 0 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/ov9281_mono.json --shutter 1000 --gain 2.0
The ov9281_mono tuning file is the closest match for the OV7251 on the VC4 pipeline. That said, I’d strongly recommend upgrading to the latest Bookworm OS — it has much better native support for this sensor. You can find more details in the docs here: 0.3MP OV7251 - Arducam Wiki
Alright, so I did an in-place upgrade of Bullseye since I can’t flash the SD card directly right now. I followed everything to the letter — used that exact command with the tuning file and the shutter/gain parameters. Still nothing. Camera is still not cooperating. I’m honestly not sure what I’m missing here.
Let’s dig a bit deeper. Could you share some photos of your hardware connections? Also, I’d like to get a diagnostic report from your setup. Please run the Arducam Camera Bug Report tool:
wget -O arducam-camera-bug-report https://github.com/Dion4cen/arducam-camera-bug-report/releases/download/Tool/arducam-camera-bug-report
chmod +x ./arducam-camera-bug-report
./arducam-camera-bug-report
This will generate an arducam-bug-report.txt file — please attach that here. Make sure you reboot before running it so we get a clean state.
Here’s the bug report file. As for the connections, I’m using the proprietary ribbon cable that came with the camera and I’m fairly confident it’s seated correctly — I’ve reseated it a few times. Let me know if you spot anything in the report.
Thanks for the report — the camera module is being detected, which is good news. I think I see the issue. You’ll need to modify your /boot/config.txt to change the dtoverlay line:
From:
dtoverlay=ov7251
To:
dtoverlay=ov7251,media-controller=0
Setting media-controller=0 disables the Media Controller API, which resolves compatibility problems with certain libcamera and V4L2 workflows on this sensor. I’ve also sent you a Python code example via private message that shows how to control the camera programmatically — might be useful for reference. Give the config change a try and let me know.
Okay, I went ahead and did a clean install of the latest Bookworm OS since the in-place upgrade was getting messy. But there’s still no luck. A couple of things:
- That Python file you sent — I can’t seem to open it. Not sure if it got corrupted or what.
- When I add
media-controller=0to the dtoverlay line in/boot/config.txt, it actually makes things worse — libcamera commands start throwing errors. - One thing I should mention: my OV7251 is the monochrome variant. Could that be part of the problem? Is the tuning file expecting a color sensor?
Good catch on the monochrome variant — the bug report confirms the module is detected correctly, so the hardware side is fine, but the tuning file situation is different on Bookworm. On the newer OS, the pipeline has shifted from VC4 to PiSP (Pi Sensor Platform), which means the old VC4 tuning files won’t work the same way.
You’re also right that media-controller=0 is incompatible with the updated kernel on Bookworm — that’s why libcamera errors out with that overlay setting. Remove that parameter entirely.
Try this instead, using the PiSP uncalibrated tuning file:
libcamera-still -t 0 --tuning-file /usr/share/libcamera/ipa/rpi/pisp/uncalibrated.json
The uncalibrated file should work with the monochrome OV7251 on the PiSP pipeline without assuming any color processing.
Ran that command with the PiSP uncalibrated tuning file. I’m attaching a screenshot of what I’m getting now. It’s… partially working? The camera streams but the image quality seems off and manual controls for gain and exposure still aren’t behaving the way I’d expect. Feels like we’re getting closer but not quite there yet.
Thanks for the screenshot. Since we’ve been going back and forth for a while and the issue isn’t fully resolved yet, I’d like to take a closer look at your setup directly. I’ve sent you remote session details via private message — please pick a time that works for you through our scheduling link (also in the PM). Just note that our support team operates on UTC+8 (Beijing/Hong Kong timezone), and the 22:00 slot is sales-only, not available for remote sessions.
Figured it out! After all that back and forth, I realized the problem was actually the calibration/tuning file itself — the one support kept pointing me to was simply the wrong one for this sensor. Once I got hold of the correct calibration file for the OV7251, everything fell into place. Gain and exposure controls work perfectly now, and the camera is stable. Hopefully this helps someone else who runs into the same situation — double-check that tuning file before you spend hours debugging everything else!