Aufocus camera with Octoprint on Pi Zero

I followed the instructions on this post: Using libcamera & imx519 on OctoPi

Originally I had been following this which is based on the above link, except it trims some of the command line input, but nevertheless I worked it out

I can capture a test image using libcamera-still, but I cannot see the stream in Octoprint’s Control tab or in the Camera Settings plugin.

Is there any further configuration needed - such as changing the stream URL in OctoPrint, or doing something to start the stream?

The first step is to run libcamera-still just to confirm that the driver and application are installed correctly, you also need to continue to install the mjpg-streamer service:

Also if you don’t want to do a lot of manual configuration, you can try to use the SD Card image we provide:

Important update:
This SD Card Image includes drivers for Pivariety and IMX519, but you need to manually edit /boot/config.txt to choose one of them.
If you need to use IMX519, you need to manually edit /boot/config.txt comment out dtoverlay=arducam (if any) and add dtoverlay=imx519
If you need to use Pivariety, you need to manually edit /boot/config.txt comment out dtoverlay=imx519 (if any) and add dtoverlay=arducam

Correct IMX519 SD Card Image:

I’ve actually just run through the post again (Using libcamera & imx519 on OctoPi) and it works now (sort of).

I did however run “apt update” and “apt upgrade” and retest octoprint before I did the driver instatll steps. I can’t whether this was really a factor or not.

The instruction to run “dmesg | grep arducam” still returns no results (although this doesn’t seem to matter).
It doesn’t seem to work with the original Pi Camera 2.1 (I thought it was all supposed to be backward compatible).

With the 16MP Autofocus cam I can now see the stream in Octoprint. However after a short while the stream goes black. If I refresh the browser page it comes back again.

I’m unable to get a test print from teh command line. I need to use Ctrl-C to exit the command:
[email protected]:~ $ libcamera-still -t 5000 -o test.jpg -n
[0:03:42.131024515] [949] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3431-c4602118
[0:03:42.134950174] [951] ERROR V4L2 v4l2_device.cpp:349 ‘imx519 10-001a’: Unable to set controls: Device or resource busy
[0:03:42.136688956] [951] WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for ‘imx519’
[0:03:42.136768378] [951] WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:03:42.136827019] [951] ERROR CameraSensor camera_sensor.cpp:551 ‘imx519 10-001a’: Camera sensor does not support test pattern modes.
[0:03:42.179697462] [951] WARN RPI raspberrypi.cpp:1233 Mismatch between Unicam and CamHelper for embedded data usage!
[0:03:42.180662758] [951] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:03:42.181035649] [951] INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/[email protected]/[email protected] to Unicam device /dev/media3 and ISP device /dev/media0

I’ll give the octoprint image you shared a try and see if behaviour is any different. What is the significance of IMX519 versus Pivariety? The previous instructions I’ve read don’t really seem to make a distinction to me.

I tried the image and although Pi Imager wrote it the file and folder names were all scrambled. Perhaps a code page or encoding issue?

I tried Baleno Etcher to write the image but the validation step failed. In spite of that however the files on the card didn;t have corrupt names and it booted in my Pi and appears to work, although it has the same issue with the stream and the feed stops after a short time. Refreshing the screen brings it back.

Is there some sort of timeout setting I should be aware of?

I’ve yet to try while printing but that’s probably the next thing for me to test.

Yes, it will have an impact,because our drivers will not be updated with apt upgarde.

arducam is used to detect Pivariety series.
For 16mp you should try dmesg | grep imx519

This error is because octoprint’s mjpg-streamer is using the camera, so you can’t open it again, if you want to use the command line to access the camera, you can close the mjpg-streamer service first.