Fixing the blurry focus on some Raspberry Pi Camera v2 models

The original Raspberry Pi Camera model v1.3 came from the factory set to ∞ (infinity) focus, so when you used it out of the box for something like a landscape timelapse rig, or for security or monitoring purposes (where the Pi is at least 5 meters away from the subjects it's recording), everything would look crisp and sharp.

For many fixed-focus cameras and lower-end camera sensors, it makes sense to set them to infinity focus; closer objects are still recognizable, but slightly blurry. Most of these cameras don't need to focus on a person a meter away for a portrait, and they're also rarely used for FaceTime-like video chat.

For the Raspberry Pi Camera v2, the Raspberry Pi Foundation originally decided to have the focus set for 1-2 meters away, so if you bought a v2 camera and used it for distant subjects (like I do for most of my pi-timelapse videos), then everything looked a bit blurry or hazy out-of-the-box.

For example, when I swapped out my v1.3 camera for a v2 model this week to record some residential road construction, I ended up getting a pretty poor image:

Raspberry Pi Camera v2 with blurry focus set at the factory

Notice especially the inset cone at slight magnification; it is not only blurry, but also washed out since a blurry image can really mess with the camera's autoexposure, resulting in a muddy picture that is at best a hazy reproduction of the scene.

The Raspberry Pi Foundation decided to set v2.1 and greater cameras back to inifinity focus, so this wouldn't be an issue with the latest camera. But a lot of resellers (including Amazon) are still shipping from their stock of v2 cameras with the focus set at a short distance.

Warning: Adjusting the lens in the way described below will likely void any warranty you may have had, and you won't be able to return the camera module after doing this. So either be careful and suffer the consequences if something breaks... or don't do it and try to buy a newer camera module with infinity focus from the factory!

Luckily, there's a fairly easy fix: If you have a pair of jeweler's pliers or mini needle-nose pliers, you can use them to directly manipulate the lens focus; just grasp the front element of the lens and rotate; if the lens is difficult to rotate (it has a slight amount of glue locking it in place from the factory), you may need to use another tweezers/pliers to carefully hold the base of the camera module, then give a little back-and-forth twist until the lens starts rotating.

Mini needle-nose pliers for precision electronics work
I bought this long-nose, or needle-nose pliers from Amazon; but any small needle-nose pliers or a sturdy pair of tweezers should do fine.

Raspberry Pi Zero W in case with camera on top cover
To adjust focus, pinch the indentations with the pliers (gently), then give a small amount of torque (just enough to break the thin glue that sets factory focus). Turn back and forth in small increments while taking pictures to confirm the correct focus.

In my case, I needed to rotate the lens about 50° counter-clockwise (I rotated about 5°, took a picture, rotated another 5°, etc. until the image was about as sharp as I could make it), and the sharpness was greatly improved:

Raspberry Pi Camera v2 with sharper focus set manually

And here's that other blurry picture again, for comparison:

Raspberry Pi Camera v2 with blurry focus set at the factory

HollandJim on Reddit mentioned there's also a little $0.95 purpose-built Lens Adjustment Tool available from Adafruit. It is worth picking up this specialty tool if you plan on using your Pi camera in a variety of settings where focus would need to be changed.

If you don't have small pliers, then a credit card, a drill, and a file will do in a pinch. You would need to drill a hole in the credit card that's about 5/16" (~8mm), then file away slots in this hole (with a very small file) to line up to the indentations on the top of the camera lens. See this Q&A thread on the Raspberry Pi forums for more on that technique, and some of the explanation of why the v2 camera was made the way it was.


Thanks for this, great write up of the problem, do you have a link on the statement "Raspberry Pi Foundation decided to set v2.1 and greater cameras back to inifinity focus" can't seem to find that statement from the Foundation. Also how would you tell if you have an older or newer focal camera?

I definitely have the older one; I had to futz around with it's focus to get it to show clouds / distant objects sharply. There wasn't an official statement, but I remember reading about the focus change in the Raspberry Pi forums, I think in a post by one of the engineers on the camera team.

This comment came from someone who seems to have been blocked from posting a comment on the site:

It happens the first batch of v2.1 cameras had that issue. Following releases had focus set to infinity:

In this topic/thread, Eben Upton gives more insight about this issue. Just the explanation you were after.