OV5647 camera image out of focus and unstable on Raspberry Pi 4B

Hi all. I’m running an OV5647 camera module on a Raspberry Pi 4B and the image is out of focus. It also seems to work intermittently and is a bit unstable. At first I thought it might be the distance between the camera and the object, but I’m not sure how to fix it.

Welcome to the forum. Out-of-focus on the OV5647 is often just the lens needing adjustment. Before we touch the lens, can you try moving the camera a little further away from the object and see if the picture gets any clearer? That helps us figure out whether it’s a focal-distance issue.

The intermittent/unstable part might be a connection or configuration issue, but let’s sort the focus first.

I tried changing the distance but it still doesn’t focus clearly. Is the lens on this camera adjustable? I’ve seen mentions of manual focus adjustment. Could you send me the focusing instructions for the OV5647? I’d also like the 3D printable focusing tool if there is one.

Yes, the OV5647 lens is adjustable. You can use tweezers to unscrew/turn the lens to focus — the same method shown in the Infrared Bird Box project on the official Raspberry Pi website. One important warning: the lens can only be unscrewed a certain amount before it falls out, so go slowly and don’t back it out too far.

I’ve attached a few references below. I’ve also sent the detailed focusing instructions and the 3D printable tool info to you by private message — please check your messages.

focusing tool.png
official guide.png
reference.png

Thanks, I got the message. But I’ve hit a wall: the lens on my module seems to be glued on. The glue is really strong and it won’t turn at all.

That’s frustrating. Glued lenses do happen on some of these modules. Don’t force it too hard or you could damage the lens or the sensor board. What have you tried so far to turn it?

First I tried tweezers like the guide said, and I actually bent the tip of the tweezers. Then I tried needlenose pliers, but they just chew up the plastic instead of turning the lens.

Thanks for the detail. So the current situation is: the focus issue looks like it needs manual lens adjustment, but the lens barrel is held by glue that’s too strong for tweezers or pliers, and both tools are damaging the plastic rather than turning the lens. I would not keep forcing it with those tools. Let me look into a safer way to deal with the glue bond without damaging the module, and I’ll follow up here. In the meantime, avoid applying more force so we don’t crack the lens barrel or tear the ribbon.