Hey everyone, first time posting so sorry if I’m missing something obvious here.
I got the 5MP Camera Module for my Raspberry Pi and I can’t get the starter program up at all. The weird part is the camera flashes a light once when the Pi powers on and then never again. If I run any of the programs nothing happens at all, no autofocus movement, no pictures taken.
Stuff I already did:
installed opencv and cloned the repo
sudo apt-get update and upgrade
opened the i2c0 port
ran sudo python Autofocus.py
ls /dev/video gives me a bunch of numbers but none of them are video0. I also shut off the legacy camera and now the camera isn’t recognized at all. And when I ran the bug report command it spit out:
ERROR: the system appears to be configured for the legacy camera stack
I have a model 3b. I’m using rasbian since it’s a raspberry pi. The camera is the 5MP Camera Module for Raspberry Pi (the one with the motorized focus).
I originally had the Pi hooked up to a 5V 2A 5000mAH battery and then retried using house power, same thing either way.
The repo is at ~/Python_Files/RaspberryPi/Motorized_Focus_Camera
First, the legacy camera question: on newer Bullseye images the vcgencmd get_camera command is no longer how you check the camera, and if the legacy stack is enabled at the same time as libcamera you get conflicting results. That ERROR message you saw ties into it.
Second, can you post the exact terminal output for these two states, before you disabled legacy and after? I want to see the raw lines rather than a summary:
Also to be clear I’m not trying to use the legacy stack. I just kept landing on legacy camera pages when I googled the error. I wanted to disable the legacy support, not enable it. So how do I actually activate the camera with legacy off?
That actually explains a lot. That supported=0 detected=0 after disabling legacy is expected on newer Bullseye builds, because vcgencmd get_camera is a legacy-stack tool. It has no idea about libcamera, so once legacy is off it reports nothing found even if the camera is fine. Don’t use that command to judge the camera anymore.
On Bullseye with libcamera the correct checks are:
ls /dev/video*
If you see video0 in that list, the camera is recognized correctly under the libcamera stack.
Then to actually grab a frame:
libcamera-still -t 0
Can you run both of those and paste exactly what comes back?
Two things could be going on, let’s rule out the config side first because it’s free.
Make sure the legacy camera stack is actually disabled, then reboot:
Run sudo raspi-config
Go to Interface Options → Legacy camera and select it to disable it
Reboot the Pi again
After it comes back up, run ls /dev/video* again and then libcamera-still -t 0.
If video0 still doesn’t show up, then we’re looking at a hardware/detection side problem rather than a software one, and I’ll want a proper bug report from you.
Alright, at this point I want the diagnostic dump so I can see what the libcamera stack is actually detecting. Reboot the device first, then run this from your home folder:
It produces arducam-bug-report.txt in the current directory. Attach that file to your next post. If you’d rather not post it publicly, send it to me and I’ll take a look.
While you’re at it, double check the ribbon cable orientation at the Pi end. On a 3B the contacts should face the board (away from the Ethernet port side) and the cable should be fully seated in the connector, including the one on the camera. A single reversed ribbon gives exactly this ‘lights up once, then nothing’ behaviour.
Ran the bug report, file attached. A couple of things I noticed in it: it shows the legacy camera is disabled, and near the bottom it lists the detected cameras as none, same as the libcamera-still error.
I did check the ribbon at the Pi end and it looks seated the way you described, contacts toward the board. I don’t have a second ribbon to swap in right now.
The vcgencmd get_camera output is a red herring. On newer Bullseye builds that command no longer reflects camera support, so supported=0 detected=0, libcamera interfaces=0 after disabling legacy is not evidence of a fault by itself.
The correct modern checks are ls /dev/video* (should contain video0) and libcamera-still -t 0. Right now neither the device node nor libcamera sees a camera, and the bug report agrees: no cameras detected.
Your setup steps (opencv, repo clone, apt-get update/upgrade, i2c0 enabled, sudo python Autofocus.py, both battery and house power) are all fine and aren’t the cause. Powering from house power rules out the 5V 2A battery as the factor.
So this is no longer a repo or Python problem. Config-wise, the legacy stack is off and the system is on libcamera, and libcamera still reports no cameras. With the ribbon reseated and still no video0, the remaining suspects are the ribbon cable itself or the camera module’s connection/detection. A spare ribbon or testing the camera on another Pi would separate those two quickly.
The one software avenue left is to make sure your Bullseye image is current, since older libcamera builds on 3B occasionally fail to enumerate the sensor. If you can, flash the latest Bullseye, keep the legacy camera disabled, and re-check ls /dev/video* before touching any code. If video0 still doesn’t appear with a known-good ribbon, then it’s a hardware fault and the camera/ribbon needs replacing. Post back with the new bug report if the fresh image changes anything and I’ll pick it up from there.