Hi, I’ve got an Arducam OV9281 1MP Global Shutter NoIR Mono Camera Module with the 130deg M12 mount on a Raspberry Pi 4 running the latest Raspberry Pi OS. I can’t get it to show up with libcamera at all. I edited /boot/config.txt following the official Raspberry Pi camera docs, but libcamera-hello just doesn’t detect anything. How am I supposed to set this camera up on a Pi 4?
Can you grab a bug report first so I can see what’s happening? Reboot the Pi and run these commands:
wget -O arducam-camera-bug-report https://github.com/ketai-dhr/arducam-camera-bug-report/releases/download/tools/arducam-camera-bug-report
chmod +x ./arducam-camera-bug-report
./arducam-camera-bug-report
That will output an arducam-bug-report.txt in the current directory. Attach that file here.
libcamera-hello still doesn’t work - the Pi 4B can’t find the camera (OV9281, UC788 RevB). I’ve attached the report as requested. One more thing I noticed: in OV9281 images there’s a sharp drop in pixel frequency at a certain intensity (bin=255). I suspect the image format conversion is causing data loss. I tried different bin values but it didn’t improve. I’m wondering if storing the raw image data into a matrix directly would avoid the loss.
What you attached is the downloaded script itself, not the report it generates - you need to actually run it. Reboot and execute:
wget -O arducam-camera-bug-report https://github.com/ketai-dhr/arducam-camera-bug-report/releases/download/tools/arducam-camera-bug-report
chmod +x ./arducam-camera-bug-report
./arducam-camera-bug-report
Then send the arducam-bug-report.txt it produces, not the script. For the data loss concern, capture in raw format to avoid conversion losses.
Understood. My environment is a Pi 4B with Bullseye, latest version from the official site. While I rerun that, a few questions: should I be using the MIPI_camera library or libcamera on Bullseye? Are there install instructions for the libraries needed for the OV9281? I think my opencv install went into the wrong directory, which might be why it never worked - any guidance there? Also, do you have Python example code for operating the OV9281, and how do I obtain raw format and capture an image in it?
On Bullseye you want libcamera - the MIPI_camera library is the older approach and isn’t what you should be using here. Let’s confirm the camera is detected first via the bug report, then I’ll walk you through the libcamera install and give you example code. For raw capture, you’d select a raw/bayer stream format rather than RGB888. One step at a time though - send the report first.
Okay, I’ve attached the actual bug report this time. I also tested with different ribbon cables and another camera to rule out hardware, but the detection problem is still there.
Thanks. Looking at the report, the issue is that automatic camera detection is enabled by default and it isn’t recognizing the OV9281. You need to disable auto-detect and specify the overlay explicitly. Run:
sudo nano /boot/config.txt
Find camera_auto_detect=1 and change it to camera_auto_detect=0, then add this under the [all] section at the bottom:
dtoverlay=ov9281
Reboot the Pi afterward.
I changed config.txt as you said but the Pi still can’t connect to the camera. I’ve attached the bug report again after the config change.
The report shows the camera is now detected by the Pi. The remaining problem is that you’re probably still on the default libcamera build instead of the Arducam-provided one. Follow the Arducam libcamera user guide to install it:
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Libcamera-User-Guide/#getting-started
Reboot after the install and try the libcamera command again.
libcamera was actually already installed when I tested. Reinstalling it following the guide didn’t fix it either. I’ve rebooted after every config.txt change and after the reinstall. Check lines 227~239 in the bug report I attached - I think those explain what’s happening.
Let me take a look at your Pi directly to move this along faster. I’ve sent you remote support details in a private message - please check your messages and send back the access info when you can, along with a time that works for you.
I’ve sent the remote access details through private message. My timezone is EST (New York). Scheduling via the link you gave should work.
Got it - I’ve sent a meeting invitation privately for the session. Please check your messages. Note I’m on UTC+8 (Beijing/Hong Kong time), so we’ll need to coordinate a slot that overlaps.
Confirmed for the remote session, and I’ve sent updated remote access details in a private message.
I’ve sent the meeting invitation for the remote session through private message - please check your messages and confirm the time works for you.
Update from my side: after all this, I’ve determined that one of my OV9281 cameras actually works and the other one doesn’t, so it looks like a hardware fault on that specific unit rather than a software/config problem. Separately, could you share a Python example for libcamera where I can change the exposure time?
Sorry I missed our earlier meeting. Here’s a Python example using picamera2 that controls exposure:
import time
import cv2
from picamera2 import MappedArray, Picamera2, Preview
cv2.startWindowThread()
picam2 = Picamera2()
config = picam2.create_still_configuration(main={"format": 'RGB888', "size": (1920, 1080)})
picam2.configure(config)
exposure_time = 2000000
picam2.set_controls({"ExposureTime": exposure_time,"AnalogueGain": 1.0})
picam2.start()
while True:
RGB888 = picam2.capture_array("main")
cv2.imshow("Camera", RGB888)
cv2.waitKey(1)
picam2.stop()
cv2.destroyAllWindows()
The key part is that ExposureTime and AnalogueGain are set via picam2.set_controls().
Thanks for the code. Quick question - should this example be the same for a monochrome camera? Mine is the mono version of the OV9281.
Give the code I posted a try with your camera and see if it runs. If it initializes, for the mono sensor you may want to switch the main stream format from RGB888 to a monochrome format, but let’s first confirm the camera comes up and you can grab frames.