Hi, I’m trying to get the 8MP IMX219 autofocus camera (B0393) working on my Raspberry Pi and I keep hitting a wall. When I run the focuser example from the Python side I get this:
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. libcamera.Transform(value: int)
I’m not sure if this is something I wired wrong or a driver thing. The camera itself seems detected but the focuser script just won’t run. Any idea what’s going on here?
Thanks for the exact error, that helps a lot. That TypeError is not a wiring or driver problem on your end. It’s coming from the Picamera library (Picamera2) itself, specifically the constructor for libcamera.Transform. So it’s a library-level incompatibility rather than something physical.
We’ve seen this before and it’s an upstream bug in Picamera2. We’re going to raise it with the official Raspberry Pi team on our side. In the meantime, it would help us a lot if you could back up your system image and get it to us so we can try to reproduce and solve it in your exact environment. Can you make a backup of the whole SD card image?
I can try to make a backup, sure. But before I go down that path I want to flag that the camera really isn’t working as advertised for me. The autofocus just isn’t happening.
Also, when I run the focuser.py script I get a totally different error than the one above:
Could not open file '/dev/i2c-7' or '/dev/i2c/7'
This one stops me cold. I’m using your suggested configuration. My camera is the Arducam B0393 8MP IMX219. I’ve attached my current setup as a ZIP file (boot.zip).
Honestly this is a stand-still for us — we can’t move forward with a product introduction/release if this isn’t working, and my older 8MP camera is no longer usable either since it won’t work with the current Arducam/Raspberry Pi camera software. Can you try all of your sample canned scripts for testing the focus and tell me which one should actually work? That would at least tell us if it’s the hardware or the software.
Thanks for the ZIP and for the second error. To debug this properly we really do need to reproduce your exact Raspberry Pi environment, because the two errors (the Transform TypeError and the i2c-7 open failure) point to something environment-specific on top of the library issue.
The cleanest way to do that is to have you back up the Raspberry Pi mirror as a whole and send it to us, using a mirror packaging tool. One caveat: this tool only runs on Linux.
There’s a reference tool here you can use:
If you can produce a full image with that (or an equivalent full-card image), we can reproduce your setup and test against it directly.
Ok, I tried to follow that GitHub link/method you gave for making the system image but I just could not get it to work. Maybe I’m missing something on the Linux side but it kept failing for me.
I did find another way to image the card though, using this guide:
That produced a backup for me. I’ve attached the result as boot.zip. Hopefully this is what you need — let me know if the format is workable.
Got it, thanks for the file. We’ve received your environment/image — that’s going to let us test against your actual setup. OK, we’re going to test this now and we’ll report back on what we find.
Any update? I’m asking because we need the B0393 working so we can scale up for a product introduction and release in the coming fall. We don’t need to change the hardware right now — the B0393 is sufficient for us at this stage, though down the line we’d be interested in a custom camera built to our specs. But first things first: has the B0393 issue been resolved? Did anything come out of testing my image?
Good news — we’ve made progress on this. Picamera2 has been updated to a new version that’s quite different from the previous one, and we updated libcamera-dev and libcamera-apps to match it in time. Based on what we’re seeing, your original Picamera2 error is most likely a version mismatch between picamera2 and libcamera-dev — an old libcamera-dev sitting under a newer picamera2.
Try this:
Update libcamera-dev to version 0.0.8, then install the latest picamera2.
Run:
./install_pivariety_pkgs.sh -p libcamera_dev
If it still doesn’t work after that, we can build a Raspberry Pi system image for you with all the environments preinstalled, so you wouldn’t have to fight the versions yourself. Give the update a shot and let us know.
Understood, thanks. I’ll try updating libcamera-dev to version 0.0.8 and then install the latest picamera2 as you described. I’ll report back once I’ve gone through it.
Glad this one worked out — marking the thread resolved. For anyone else who runs into this with the 8MP IMX219 (B0393) autofocus camera, here’s what actually got it going:
The camera wouldn’t work with the old install procedure alone. After picamera2 and libcamera-dev were updated, what worked was starting fresh with a new image and combining (mashing up) the 8MP IMX219 setup with the 16MP setup:
Follow the 8MP IMX219 motorized focus camera guidelines to install the needed libraries and change config.txt for the correct sensor (IMX219): Redirecting...
Install all the pivariety libraries that appear in the startup guidelines for the 16MP camera: Redirecting...
Do NOT change anything in config.txt related to the 16MP IMX519 configuration.
After doing that: the FocuserExample demo came up and manual focus using the up/down arrows worked. The AutofocusTest demo works as a one-time shot depending on what the camera is pointed at.
TL;DR — use the IMX219 config.txt/sensor settings from the 8MP guide but install the 16MP guide’s pivariety libraries. That combination is what worked once libcamera-dev was on 0.0.8 and picamera2 was at the latest version.