Pi Camera V3/IMX Chipset Based Cameras Not Working

Thank you! I removed my existing camera-streamer folder and installed using the new script. Quality is improved and autofocus is working!

Do you have any info or references for the AfMode and AfRange options?

I have my camera mounted to the Z axis and sometimes the print head moving back and forth causes the camera to be stuck overshooting its autofocus back and forth for a long time. Wondering if either of those two options could help solve this

According to the pi camera software manual, the options are
Auto Focus Modes:

  • default (usually auto, but most people are not getting auto by default)
  • manual
  • auto (at start up only plus capture time for some software)
  • continuous

Auto Focus Ranges:

  • normal
  • macro (close up only)
  • full (close up and normal ranges)

The local url http://octopi.local:8080/option shows available camera-streamer options and value ranges. It only lists 0-2 as valid for AfMode, so I chose 2 being the largest supported value. It worked and enabled continuous focus even though that doesn't seem to align with the manual.

For AfRange there are 3 options and the values are 0-2, so I chose 2 for full range, guessing that they were listed in order, and it worked as well.

There are several other options in the manual that could map to keys shown on the camera-streamer option page, but I have not experimented with any of the other ones. If you want to, you should be able to add them to the .service file the same as AfMode and AfRange. Restarting the service or rebooting is needed to activate changes.

2 Likes

Much appreciated, I'll do some experimenting and post my results if I make any progress

1 Like

Thanks a lot!!
It works just as you descibed :- )

EDIT
So I figured out the problem the case that I had printed out didn't have a large enough hole at the front so something was pushing on the elements and not allowing correct AF.

Leaving the Original post in case it can help someone else:

EDIT
Is anyone having issues with the focus area not being the center of the frame?

My pi cam 3 seems to be focusing on the RHS of the image
ie
RHS: Dropbox - Screenshot 2023-02-13 at 09.04.31.png - Simplify your life
Center: Dropbox - Screenshot 2023-02-13 at 09.04.42.png - Simplify your life

On in the manual there is

	--autofocus-window			Specify the autofocus window

I've tried adding it to the service with different values including up to -camera-options=AfWindow=0,0,1,1 \ which according to the documentation seems like it should cause the entire frame to be used for focus (and it is super slow to focus when I do that) It still seems to have the same only RHS of the image come into focus.

I've tried setting the lens position manually from the /option path as well and that seems to have the same issue I can never get the center of the frame in focus.

I know in the V2 camera using 1920x1080 it's only using part of the sensor (I had my v2 resolution set to 1640x1232 to get a full FOV window in the image. I'm wondering if that is causing the strange AF area.

Is anyone else seeing this? Maybe I got a bum camera module?

@msroest Glad you solved it.

It's also nice to know that the autofocus window control seems to work, and now we know not to use the whole frame :slight_smile:

2 Likes

Yah on the bad side I seem to have hosed my cam v3 in the process of prying it in and out of cases. It now has a streak of messed up pixels. So think I’ll be reverting back to my v2

How long is the make install supposed to run? It's sitting at 56% forever (1-2 hours)
FYI: Pi Zero 2W

Compiles after increasing Swap

The stream is not working on a Pi Zero 2W though.

Same for me. libcamera-still --list-cameras shows the camera list, but no Preview. If I use the same SD card in a Pi 4B it works, but not on the Pi Zero 2W

I confirm that this procedure can help run the Cam Module 3 with a resolution of 2304x1296.

However, HDR doesn't work. I typed the command (v4l2-ctl --set-ctrl wide_dynamic_range=1 -d /dev/v4l-subdev0) to enable the HDR and it gave the following output (see the pictures)

WARNING: Unable to set HDR mode

Available cameras:
0 : imx708 [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a)
Modes: 'SBGGR10_CSI2P' : 2304x1296 [30.00 fps - (0, 0)/0x0 crop]

I really wonder if HDR can be enabled with Pi Cam Module 3 on OP RC3!!!

This is absolutely a function of your RPi. I have a 4B and it took ~20min? I wasn't even really paying attention. It finished fast enough for me to not even think about it.

first I'm very new to most if not all of this.
I followed the instructions and do see camera in octoprint. Thank you.
However if I try to install OctoDash it breaks. Not only that but if I edit the config.txt to rotate my 7" screen (lcd_rotate=2) the camera breaks. It seems any edit to config breaks the camera. I've been working on this for 2 days. I've searched and searched but no "fix" seems to work with OctoDash. I don't know if this is due to using the RC or if it's just another sign I'm a total idiot.

This is likely a bullseye (newer base OS) issue I suspect.

@nDeavor , thank you for you post about the Zero W2. I have added a not to post 72 that this method is confirmed on 3A+, 3B, and 4, but has not successfully been used on a Zero 2W.

I personally have a 3B and an original Zero W so rely on reports from users for other versions.

1 Like

I don't really know what I'm doing, but I was able to get a Pi Camera V3 working on my Zero 2 W.

I followed @ltlowe instructions and flashed the latest octopi image to my sd card
then followed @Caouch instructions to increase the swap file size.
then back to the remaining instructions from @ltlowe

at this point the camera was still not working, so I went to raspi-config and enabled "legacy camera support" even though it warns that this function is deprecated... as soon as I reboot and load the octoprint UI i have a crisp image with working autofocus. Still waiting to get this back on my MK3S to see what the performance is like. But very promising so far.

Thanks for everyone's help, I'll post an update after my first print.

This thread looks like what I need to get my new V3 going, so thanks for all the work and info from everyone. Quick noob question though. I've messed things up before, so I just want to be ultra careful: When you say "Flash (the distro) to a microsd card", can I transfer that zip file to my current mSD card that is currently running OctoPi and it will overwrite the current distro? Or do I need to start over with a new card. The only reason I ask is because I had to do lots of work to turn my 4 inch screen from portrait to landscape and its "working" right now. Just don't want to mess that up. Thanks for any help.

@joshself if you flash the new image to your current SD card it will overwrite the current content, including all configuration and customizations. As far as I know, there is no way to upgrade. It's a fresh install.

I always use a second SD card for things like this so I can go back and look at the old one if I forget or mess up reapplying custom changes or configuration.

1 Like

Thanks for that info. I'll try it tonight and let you guys know how it went.

FYI, I'm working on an updated OctoPi build with a new camera-streamer based webcam stack and here's details on that including a test image I'm looking for feedback on:

1 Like

Thanks for your tremendous work, this is an outstanding script. It looks like the repository for the image to be downloaded has changed. Can you pls let me know where tio find it? Or has the name of the image file changed?