Hi, I’m having trouble getting my Arducam camera to focus. I’m using the Arducam 12MP IMX477 Motorized Focus High Quality Camera and I need to photograph cigarette sticks / a cigarette pack from about 1 meter away. Every shot comes out completely blurred and out of focus — I can’t get a usable image at all. Is this a distance limitation of the lens or am I doing something wrong?
Hi, welcome to the forum. A 1 meter subject distance should be achievable with that camera, so let’s dig in. Can you share a few details so we can narrow it down?
- What board is the camera attached to (e.g. Raspberry Pi 4, Pi 5, CM4)?
- What software/stack are you using (libcamera, picamera2, raspistill, custom Python)?
- Can you post a sample image that shows the blur?
- Have you made any focus changes so far, either in software or by hand?
That should give us a starting point.
Sure. It’s on a Raspberry Pi 4 running Raspberry Pi OS (Bookworm), using picamera2 through Python. Sample image of the cigarette pack shot from 1 meter is here: https://cdn.arducam.com/forum/52fe27aa76ba2c4a1ddc47e06db2d25f/1M_Pack%20Annoted.jpg — as you can see it’s just a smear, nothing is legible.
For focus I’ve been calling the autofocus routines in picamera2, something like:
from picamera2 import Picamera2
picam2 = Picamera2()
picam2.set_controls({“AfMode”: 1}) # continuous
picam2.start()
I also tried setting AfMode to 2 and triggering a single autofocus cycle with AfTrigger, but it doesn’t seem to improve anything. At very close range (a few cm) it looks a bit better, but at 1 m it’s hopeless.
One more thing — I never tried touching the lens itself. Should I be doing something physically with it? I assumed the motorized focus handled everything on its own.
Thanks, that’s helpful. Important detail: on this camera the lens is rotatable. The focus is not only set through software — the lens barrel itself can be rotated to adjust focus. If the lens ended up at the wrong position, no amount of AfMode / AfTrigger will recover a sharp image at your working distance, which matches what you’re seeing (slightly better at a few cm, blurry at 1 m).
Two questions:
- What is the lens focus set to right now — do you see it sitting close to the module body, or further out?
- Do you still have the small focus adjustment tool or the lens lock screw access as shipped?
And yes, please do try rotating the lens by hand — that’s the key thing to test here.
Ah, I see — no, I hadn’t touched the lens at all. Let me try. It does rotate but it’s fairly stiff. Which direction should I turn it, and how far, for a 1 meter subject?
Good, the stiffness is normal — it’s a threaded barrel with some resistance so focus doesn’t drift.
Here’s the procedure:
- Point the camera at your target (the cigarette pack at ~1 m).
- Open a live preview so you can watch the image in real time (picamera2 preview, or stream it to the Pi’s display / over your network).
- Slowly rotate the lens barrel while watching the preview.
- Stop when the image is at its sharpest. If it starts getting blurrier, you went past the sweet spot — turn back a little.
- Distance changes require re-adjustment, so set the focus at the exact working distance you care about (1 m).
It can take a bit of back-and-forth — just go slowly and in small increments. If you have libcamera installed you can also just run libcamera-still -t 0 for a quick live view while you turn the lens.
That worked! I rotated the lens slowly while watching the preview and there’s a definite point where the cigarette pack snaps into focus. Text on the pack is now readable.
So to summarize what happened on my side: the camera was fine, but the lens focus was simply not adjusted for a 1 m subject. The software autofocus alone never fixed it — the physical rotation is what did it.
One note for anyone else reading: after I got it sharp I left AfMode enabled and it holds focus fine at that distance. Thanks for the pointer.
Great to hear it’s sorted. Confirming the conclusion for anyone who lands here later:
- Camera: Arducam 12MP IMX477 Motorized Focus High Quality Camera.
- Symptom: completely blurred / out-of-focus images when shooting a subject (cigarette sticks / pack) at roughly 1 meter.
- Root cause: the lens focus had not been adjusted for the working distance.
- Fix: the lens barrel on this camera is rotatable — rotate it manually (ideally while watching a live preview) until the image is sharp at your target distance. Software AfMode/AfTrigger changes alone will not recover focus if the lens is mechanically set wrong.
- Tip: if performance still isn’t where you need it at that distance, a higher-resolution module like the 16MP IMX298 is an option for finer detail work.
If you hit blur again, first thing to check is whether the lens got nudged — re-check the focus at the exact distance you’re shooting.