Hi, I’m stuck trying to set exposure manually on my camera module. Every time I try, the camera just overrides it with its own auto exposure. I need to control exposure from Python directly. Anyone know how to keep auto exposure from taking over?
Hey, welcome. A few questions to start: which camera module are you using, what board is it attached to, and are you using Picamera2 or something else? That’ll change how we approach it.
Sure. It’s the 21MP IMX230 module, SKU B0324, running on a Raspberry Pi CM4 with Picamera2.
This is what I’m running right now:
picam2 = Picamera2()
pcamera_config = picam2.create_still_configuration(main=cam_size, buffer_count=2, transform=Transform(hflip=1, vflip=1)) # change HERE to flip image
picam2.configure(camera_config)
picam2.start()
I don’t see any obvious place to lock the exposure, and the camera keeps doing its own thing after start.
Thanks for the details. For the IMX230 on a CM4 with Picamera2, the first thing to confirm is whether the sensor exposes exposure control at the V4L2 sub-device level. Manual exposure will only stick if that control is actually advertised by the driver. Can you run this and check the output?
v4l2-ctl -l -d /dev/v4l-subdev0
Look for anything exposure-related in the list — auto exposure, exposure time, that sort of thing.
Ran it — I can see exposure-related controls in the output (auto exposure and exposure time are listed). So it looks like the sensor does support it.
Good, that’s the important part. Manual exposure config has to be validated against those V4L2 sub-device controls first — if it’s not there, no amount of Picamera2 code will make it work. Since it is there, you can go ahead and set it. There’s an example that works for these ArduCAM sensors, including the IMX230:
The gist: turn off auto exposure and set the exposure time through the controls, so the camera stops overriding your value.
That worked. I followed the SetExposureTime example, disabled auto exposure and set the exposure time via the controls. Manual exposure now holds and the camera doesn’t override it anymore. Thanks a lot!
Nice, glad that sorted it. For anyone else with the 21MP IMX230 (SKU B0324) on a CM4 + Picamera2: first verify exposure is exposed at the sub-device level with v4l2-ctl -l -d /dev/v4l-subdev0, then use the SetExposureTime example to disable auto exposure and set exposure time manually through the controls. That stops the auto override.