How to Focus a Camera: M12 & C-Mount Lens Guide
Learn focusing techniques for camera hardware: ceiling target methods, through-focus, and proper locking.
What Are the Physics Behind Camera Focus?
Camera focus happens when light rays from your object converge precisely onto the image sensor. Getting this right is the foundation of every machine vision system.
The distance between lens and sensor where sharp focus occurs is called the back focal length. When you adjust focus, you're changing this distance to match your working distance (how far away your object is).
For M12 lenses, each full rotation moves the lens 0.5mm (thanks to the M12×0.5 thread pitch). This shifts the focus plane by roughly 10-50mm at the object, depending on your focal length. C-mount lenses work differently—they use an internal focus ring rather than threading.
Key Terms You'll Need
Effective Focal Length (EFL): Determines your field of view and depth of field. This is what lens specs typically list (e.g., "4mm lens").
Mechanical Back Focal Length: Distance from the lens rear housing to the sensor. This determines if a lens physically fits your camera.
Flange Focal Distance: For C-mount systems, this is standardized at 17.526mm from the mount flange to the sensor.
Note: Optical back focal length (distance from last optical element to image plane) is rarely used in camera design. The mechanical back focal length is what determines whether a lens will physically fit and focus with your camera. Consider Commonlands M12 lenses for compact applications or C-mount lenses for standardized flange focal distance systems.
How Do I Focus an M12 Lens?
M12 lens focusing for board level cameras requires systematic adjustment of the threaded mount while monitoring image sharpness. Each rotation = 0.5mm of lens movement. The key is using the ceiling target method to eliminate image tilt.
Thread tolerance mismatches between M12 lenses and holders often cause the lens to sit at a slight angle. This makes one side of your image sharp while the other is blurry—a common problem detailed in our M12 lens technical guide. The fix? Point your camera straight up at a ceiling target. Gravity keeps everything parallel.
Mount Camera Securely
Fix the board level camera rigidly—either facing your target or pointing upward for the ceiling target method. Even small movements during focusing will affect results.
Position Test Charts
Place four test charts at 50% of the image diagonal from center. This reveals any image plane tilt immediately during adjustment.
Illuminate Uniformly
Add consistent lighting across the field of view. Uneven lighting can mask focus issues by creating false contrast gradients.
Set Proper Exposure
Establish correct exposure settings using gray cards before focusing. See our detailed exposure setting guide below for OECF and ColorChecker procedures.
Thread Lens to Focus
Rotate in 1/16-turn increments (31.25μm axial movement). Watch for equal sharpness across all test points, not just center.
Lock and Verify
Apply UV+heat dual cure adhesive or mechanical lock ring, then verify no focus shift occurred during locking.

Test chart positioning showing four targets placed at 50% of image diagonal from center
💡 Professional Tip
Ceiling target focusing is standard practice at Commonlands' camera module assembly facility. Our production lines use precision ceiling fixtures with integrated lighting for consistent, tilt-free focusing across all units. Consider our professional assembly services for production volumes starting at 100 pieces minimum order.
How Do I Focus C-Mount Lenses?
C-mount lenses require a different focusing approach due to their standardized flange focal distance. They have a fixed 17.526mm flange focal distance. You focus by rotating the lens's focus ring—not by threading the whole lens like M12.
C-Mount Focus Procedure
- Mount lens to camera: Thread C-mount lens fully into mount until flange contacts. This sets the precise 17.526mm spacing.
- Set aperture: Open to maximum aperture for brightest view during focusing, then stop down to working f-number after focusing.
- Rotate focus ring: Turn the focus ring (not the entire lens) while viewing live image. Most C-mount lenses have ~270° of rotation.
- Verify across field: Check center and corners at working aperture. Industrial C-mount lenses should maintain <5% MTF variation.
- Lock focus ring: Tighten set screws on focus ring or apply removable thread locker to prevent drift during operation.
Commonlands offers a comprehensive selection of C-mount lenses optimized for 1/2" to 1" sensors, with focus rings designed for smooth adjustment and reliable locking. These lenses feature low-distortion designs ideal for measurement applications.
Quick Reference: M12 vs C-Mount
- M12 Thread Pitch 0.5mm per rotation
- C-Mount Flange Distance 17.526mm
- M12 Focus Method Thread lens in/out
- C-Mount Focus Method Rotate focus ring
How Do I Find Peak Focus Using the Overshoot Method?
The overshoot-and-return technique ensures you find true peak focus, not a local maximum. By deliberately passing through the point of best focus and then returning with finer adjustments, you eliminate backlash effects and verify you've found the global optimum.
Here's how it works: deliberately pass through the point of best focus, then return with finer adjustments. M12 threads have 10-30μm of mechanical play (backlash), so always approach your final focus position from the same direction. This method works for both manual adjustment and when reviewing MTF measurement curves.

Graph showing MTF values vs. focus position, with annotations showing initial approach, overshoot past peak, and return to maximum MTF position
Why Overshoot Works
1. Eliminates backlash: M12 threads have ~10-30μm of mechanical play.
2. Confirms global maximum: Passing through ensures you haven't stopped at a local peak.
3. Provides repeatability: Always approaching from the same direction gives consistent results.
4. Reveals focus curve shape: Understanding the sharpness falloff helps set depth of field expectations.
Which Focus Locking Method Should I Choose?
The choice of focus locking method for board level cameras impacts long-term stability, serviceability, and production throughput. Each method offers distinct advantages for different applications and production volumes when securing board level lenses.
| Method | Cure/Set Time | Strength | Reversible | Best For |
|---|---|---|---|---|
| UV Cure Adhesive | 30-60 seconds | Moderate | 아니요 | Indoor/controlled environments |
| UV+Heat Dual Cure | 30s UV + 5min heat | High | 아니요 | Automotive, outdoor, high vibration |
| Lock Ring | Immediate | Moderate | 예 | R&D, field-serviceable units |
| PTFE/Teflon Tape | Immediate | Low | 예 | Prototyping, temporary setups |
Commonlands Recommendation
For production volumes, we recommend UV+heat dual cure adhesive applied as a small fillet around the lens-holder interface. This provides maximum environmental resistance while maintaining optical alignment through temperature cycling. Our camera module assembly service includes this professional-grade locking as standard.
How Do I Calculate Depth of Field?
Proper depth of field calculations ensure your entire object range remains in acceptable focus. Your DOF depends on focal length, aperture (f-number), sensor size, and working distance.
Visit our Camera Depth of Field Calculator to determine optimal focus settings for your specific lens/sensor combination and working distance requirements.
How Do I Set Proper Exposure Before Assembly?
Correct exposure settings must be established before final focus locking to ensure consistent image quality across production. Using standardized targets like ColorChecker gray patches or OECF charts provides repeatable exposure calibration that eliminates unit-to-unit variation in brightness and contrast.

X-Rite ColorChecker target showing the 18% gray patch used for exposure calibration
Simple Exposure Setting Procedure
Position Gray Target
Place an 18% gray card or ColorChecker gray patch at your working distance under production lighting.
Set Standard Illumination
Establish your production lighting conditions. Document lux levels for repeatability across all units.
Adjust Sensor Settings
Target 118 RGB value (46% of 255) for 18% gray. This provides optimal headroom for both highlights and shadows.
Document Settings
Record exposure time, gain, and any ISP parameters. These become your production standards for all modules.
⚠️ Critical for Production
Always set exposure parameters before applying focus lock adhesive. Exposure changes after locking may require different focus positions due to depth of field variations at different f-stops. Commonlands' assembly service includes standardized exposure calibration using professional gray targets as part of our camera module assembly process.
What Are Common Focus Problems and Solutions?
Focus issues cost production time and reduce yield. Understanding root causes enables targeted solutions that maintain long-term stability. Our experience from assembling thousands of camera modules has identified these critical issues and proven solutions.
| Problem | Symptoms | Root Cause | Solution |
|---|---|---|---|
| Focus Drift | Sharpness degrades over hours/days | Mechanical loosening, weak locking | UV+heat dual cure, proper torque specs |
| Corner Blur | Center sharp, edges soft | Sensor tilt, field curvature | Use ceiling target method, select low-field-curvature lens |
| Material Mismatch | Focus changes with environment | CTE differences, plastic elements | All-glass lenses, matched materials |
| Vibration Loosening | Focus shifts during operation | Insufficient locking torque | Dual cure adhesive + mechanical retention |
| Unit Variation | Each camera needs different focus | Component tolerances stack-up | Active alignment process, tighter QC on components |
Professional Camera Module Assembly Services
Commonlands provides complete camera module assembly with professional focusing services starting at 100 pieces minimum order quantity. Our clean room facilities and precision alignment fixtures ensure consistent, production-ready results for robotics, surveillance, and automotive applications.
100 Piece Minimum
Ideal for pilot production and small batches without massive MOQs.
Backlit Vertical Targets
Tilt-free alignment eliminating left-right focus gradients.
Professional Locking
UV+heat dual cure standard, custom options available.
Quality Assurance
100% optical inspection and focus verification.
Fast Turnaround
2-3 week standard delivery for most orders.
Volume Scaling
From 100 to 10,000+ units with consistent quality.

Professional camera module assembly stations with backlit vertical targets and precision tooling
Ready to eliminate focusing challenges? Our team handles the complex alignment process so you can focus on your application. Minimum order quantity: 100 pieces. Learn more about our assembly services or contact our engineers to discuss your requirements.
Ready to Eliminate Focusing Challenges?
Our team handles the complex alignment process so you can focus on your application.
Get Assembly Quote →What Is Active Alignment? (OEM Production Only)
Active alignment optimizes focus while monitoring image quality in real-time, improving yield for high-volume OEM production. This technique is only cost-effective for large production runs due to significant capital equipment costs and complex changeover requirements between different camera models.
The process uses 6-axis positioning with MTF or contrast feedback to compensate for component tolerances by optimizing each unit individually. This increases first-pass yield from ~85% to >98%.
When Active Alignment Makes Sense
Minimum Suggested Volume: High-volume OEM production only
Yield Improvement: Increases first-pass yield from ~85% to >98%
Typical Applications: Automotive ADAS cameras, smartphone modules, high-end surveillance
Equipment Investment: Significant capital costs per alignment station
For lower volumes, manual focusing with proper fixtures and ceiling targets provides excellent results without the capital investment. Contact Commonlands for standard assembly services starting at 100 pieces minimum order quantity.
자주 묻는 질문
What is the correct procedure for focusing an M12 lens?
To focus an M12 lens: 1) Start with the lens at nominal position, 2) Place a test target at your working distance or on the ceiling for tilt-free alignment, 3) Rotate the lens in 1/16 turn increments while monitoring sharpness, 4) Pass through best focus then return with finer adjustments, 5) Lock with UV+heat dual cure adhesive or focus ring. Each full rotation moves the lens 0.5mm due to the M12 × 0.5 thread pitch. Consider Commonlands' professional assembly service for production volumes starting at 100 pieces minimum order.
How do I focus a C-mount lens?
C-mount lenses have a fixed 17.526mm flange focal distance. Focus is achieved by adjusting the focus ring on the lens barrel rather than threading. Use the same target and verification procedures as M12, but rotate the focus ring instead of the entire lens. Lock with set screws on the focus ring or friction tape. Browse our C-mount lens collection for options optimized for your sensor size.
Why use ceiling targets for focusing?
Ceiling targets eliminate image plane tilt caused by M12 thread tolerance mismatches. When threads don't perfectly align, the lens sits at a slight angle, causing one side of the image to be sharp while the opposite side is blurry. By using gravity to ensure perfect parallelism between sensor and target, ceiling focusing prevents this left-right focus gradient. This method is standard in professional camera production and is used at Commonlands' assembly facility.
What's the difference between UV cure and UV+heat dual cure?
UV cure adhesive sets in 30-60 seconds but may have shadowed areas that don't fully cure. UV+heat dual cure adds a thermal activation (80°C for 5 minutes) that ensures complete curing even in shadowed regions, providing superior strength and environmental resistance. Dual cure is recommended for automotive and outdoor applications.
What is active alignment?
Active alignment adjusts lens position while monitoring image quality metrics in real-time. This compensates for component tolerances by optimizing each unit individually. It's essential for high-volume production where consistent quality is required despite manufacturing variations. The process typically uses 6-axis positioning with MTF or contrast feedback.
How do I prevent focus drift over time?
Focus drift is prevented by: 1) Using proper locking methods (UV+heat dual cure for production), 2) Selecting mechanically stable materials (all-glass lenses vs plastic), 3) Allowing adequate cure time before handling, 4) Using mechanical retention as backup for high-vibration environments. Our assembly service includes validated locking procedures for long-term stability.
Can Commonlands assemble and focus my camera modules?
Yes, Commonlands provides complete camera module assembly including professional focusing, tilt-correction with ceiling targets, and permanent locking. We use clean room environments and precision fixtures to ensure consistent quality. Services include M12 and C-mount lens integration, custom fixtures for your specifications, and 100% optical verification. Minimum order quantity is 100 pieces. Contact our engineering team to discuss your requirements.
What focus locking method should I use for my application?
For production: UV+heat dual cure adhesive. For R&D: mechanical lock rings for adjustability. For prototyping: PTFE tape for temporary holding. For automotive/outdoor: always use dual cure for temperature resistance. For serviceable products: lock rings with thread locker. Each method has trade-offs between permanence, strength, and reversibility.