Pi Camera V3/IMX Chipset Based Cameras Not Working

Thanksgambling, ltlowe and Dark360

I finally got this working, on a pi 3, following gamblings instructions precisely.,

In particular, I used the armhf image instead of the 64 bit image.
Also I noticed the admonition to flash the card, boot and do nothing before running the script. In the past I'd restored octoprint from a backup before doing any shell commands.

I don't know if either or both to those things made the difference, but I'm seeing the camera now.

Thanks again!

I also use that exact method and it work direclty! Not even needed to update, they were all already done.

I tested a print, and timelapse with octolapse is working fine!

  1. My focus was not bad, didnt try to play with it. Can someone post common cmd line to adjust manual focus?

  2. I'm an obico (spaguetti detective) user and i just discovered that obico for octoprint is not compatible with Pi OS Bullseye. But Obico for klipper is compatible with 32-bit Raspberry Pi OS version Buster or newer (like bullseye). Someone know if klipper can be installed on this image?
    During this time, i'm using octoeverywhere to view my printer from outside and it work great with the camera.

Thank you.

Will this script work with the 64 bit image (https://unofficialpi.org/Distros/OctoPi/nightly-arm64/2022-10-27_2022-09-22-octopi-bullseye-arm64-lite-1.0.0.zip)?

That should be fine, as that's what the original author said they tested it with.

If you install the Camera Settings plugin, there's an option in there for Focus Absolute which works for manually focusing

1 Like

I was able to get the 64bit version of octopi to work with the raspberry pi camera module 3
I was able to get obico for octoprint to work as well.
I was able to manually adjust the auto focus by installing the camera settings plugin and selecting dw9807 10-000c, then using the focus absolute option as mentioned above by xenos.

I did used the following nightly build that is 64bit.

https://unofficialpi.org/Distros/OctoPi/nightly-arm64/2023-01-23_2022-09-22-octopi-bullseye-arm64-lite-1.0.0.zip

I followed gambiting instructions above:

Flash it to a microsd card, boot up the raspberry pi as usual, don't do anything else on it yet.

Log in, either locally or via SSH, doesn't matter.
Then run the following:

wget https://raw.githubusercontent.com/ltlowe/misc/main/cam3install.sh
chmod +x cam3install.sh
./cam3install.sh

restart your system.

installed obico for octoprint, then camera settings plugin.

1 Like

Thanks Igeitner and xenox, manually adjust focus work perfecty with Camera Setting plugin.

Will give a try later for the 64bit version, the 32bit seam to be working really great actually.

Just dropping in to say thank you to the folks who got this working. It turns out to be a great shortcut for getting the Arducam 16MP AF camera running as well:

I guess I'm just using cam3install as a shortcut to to install camera-streamer, but it was an easy path to a known-good configuration so I could sort out the imx519 drivers.

Thanks again

1 Like

Using these instructions on a new RC3 install I was able to get my cam working properly. Focus is manually changeable through the camera settings plugin and I can confirm timelapse through Octolapse also works as intended. Currently runs at 640p but I'm happy with that for now. I'll hang in here while the tips keep coming!

Thanks @Dark360 @ltlowe @gambiting

1 Like

I followed the same instructions and is working too. Comment at the top of the cam3install.sh script states the latest daily build tested with - so worth checking that before flashing your sd card.

A word of warning though - 'Camera Settings' plugin doesn't seem to pick up the camera properly. As @lgeitner reports, you can select 'dw9807 10-000c' then adjust using the 'Focus Absolute' option (but not much else).

But what I experienced when trying to fine-tune focus was the plugin becoming less and less responsive - to the point where I had a blurred image and no amount of playing with the slider or the numbers would to make it respond properly. If only I'd stopped when the image was almost great...!

Tried the obvious things (restarting, re-installing the plugin etc) to no avail. In the end what worked for me was just keep playing with the slider until it comes back to life. I couldn't see a pattern to it beyond selecting the extremes (and random points in-between) over-and-over. Eventually it started to respond and I caught a focus that will do. Sharing in case anyone else finds themselves in a similar predicament...

I got problems too with 'Camera Settings' plugin, it slow down my octoprint.
I needed to desable it.

And with octolapse, I need to put a large delay 1000ms.
Is there a way to desable auto-focus ? I read that large delay on camera may be caused by auto-focus.

In fact, I don't really need auto-focus, I prefer to set it manually.

Thank you.

you'd have to run v4l2-ctl -d /dev/video0 --list-ctrls-menus (with your video device specified) to determine if it's possible.

If it is possible, then the command sudo v4l2-ctl --set-ctrl=focus_auto=0 should disable it.

1 Like

I've been testing some configuration through the streamer web interface. I'll do more over the weekend and see if I can incorporate some into the service file, but for now, can some of you try the following. It should enable autofocus for the full range.

http://octopi:8080/option?AfRange=2
http://octopi:8080/option?AfMode=2

1 Like

Thanks @ltlowe - I applied those changes. Could not see any discernible difference in the control view (it does not adjust focus on its own - is that what you were expecting?) but I've found that manual focus through 'Camera Settings' now stays responsive

Thank you for testing.
I was expecting those to turn on autofocus, but wasn't convinced with my setup. I'll try some more options on the weekend.

I take it back!!

It just occurred to me - could Camera Settings plugin be overriding auto-focus. I deactivated that plugin, restarted octopi an there we go - auto-focus seems to be working. Great job @ltlowe

1 Like

Confirmed, works for me as well, without the Camera Settings loaded. Thanks ltlowe.

Confirmed this worked for me also -- thanks all!!

To automatically enable autofocus, change camera-streamer-pi708-12MP.service and add the options to the ExecStart statement so it looks like this:

ExecStart=/usr/local/bin/camera-streamer \
  -camera-path=/base/soc/i2c0mux/i2c@1/imx708@1a \
  -camera-type=libcamera \
  -camera-format=YUYV \
  ; 2304x1296-YUV420
  -camera-width=2304 -camera-height=1296 \
  -camera-fps=30 \
  ; use two memory buffers to optimise usage
  -camera-nbufs=2 \
  ; the high-res is 2304x1296
  -camera-high_res_factor=2 \
  ; the low-res is 576x324
  -camera-low_res_factor=4 \
  ; bump brightness slightly
  ; -camera-options=brightness=0.1 \
  -rtsp-port \
  ; make sure autofocus is on
  -camera-options=AfMode=2 \
  -camera-options=AfRange=2 \

I have not updated the cam3install script yet as I'm trying a few other things first.

is this bit required for all camera types or just the imx708? I assume you can choose the best format from the results of v4l2-ctl --list-formats-ext (ie x264 for direct video copy to HLS).