How to Adjust Webcam Focus for OctoPrint
Practical steps to adjust webcam focus for OctoPrint, including manual focus rings, autofocus settings, and checking the image before leaving a print unattended.
Before you start
Find out whether the camera has a manual focus ring, fixed focus, or autofocus. Most USB webcams are fixed-focus or autofocus, while many Raspberry Pi camera modules have a lens that can be rotated by hand. The adjustment happens locally on the camera or through the options exposed by the camera driver and streaming software, not inside OctoPrint itself.
If you are using OctoPrint with a Raspberry Pi camera, avoid touching the lens while the camera is mounted in a way that can move the bracket or cable. Place the printer nozzle or an object with visible detail at the distance where you normally want to watch the print, then adjust focus from that position.
Step-by-step instructions
1) Open the OctoPrint webcam view or the camera preview you normally use so you can see changes while adjusting.
2) Put the print bed or a detailed test object at the distance you need to keep sharp. Good lighting makes focus easier to judge. If the scene is dim, add light before changing the lens.
3) For a camera module with a lens ring, turn the ring in small increments. Let the preview update after each movement. If the ring feels loose, hold the camera body steady so you do not unscrew or tilt the lens assembly.
4) For an autofocus USB camera, check the capture application or camera driver settings for focus controls. Some setups expose manual focus as a numeric slider, while others only offer autofocus on and off. If autofocus keeps changing during a print, switch to manual focus when the selected camera supports it.
5) Confirm the resolution and frame rate before finishing. Focus can look acceptable in a small preview but poor at the resolution used for the stream or recorded snapshot, so compare the view at the settings you actually use.
Check the output
Move a test object slightly toward and away from the camera and watch the preview. The target area should stay sharp over the small distance range you care about. If the image goes soft when the bed moves, refocus for the middle of that range.
Also check that the camera is not cropping the picture in a way that changes the effective field of view. Some resolutions or capture modes crop the sensor, which can make the framing look different even when the lens focus is correct.
Common problems and next steps
If the image is sharp on one side but soft on the other, the camera may not be aligned with the subject. Straighten the mount and check that the lens is not touching the bracket. If the whole image stays fuzzy, confirm the lens surface is clean and that the camera is not too close for its minimum focus distance.
When the camera keeps reverting to an unwanted focus position, look for an autofocus setting that activates after a reconnect or stream restart. Set the manual value again and restart the stream once to verify that the setting persists. If a connected browser or capture tool requests camera permission from the wrong device, select the correct camera in that tool and repeat the focus check.
Poor lighting is often mistaken for a focus failure. Increase lighting or reposition the camera so the subject has enough contrast. Only change the lens again after the exposure and white balance settings have settled, because a dark or noisy image can look out of focus even when the lens position is correct.