## setting lens focus

17 posts
Interested to compare notes with anyone else who is adjusting lens focus. Before turning the lens I put two white dots, one on lens and one on lens housing, so I could see the rotation angle. Hold lens cell with one set of thin pliers, turn lens with another set. What I find is:

Code: Select all
`angle that lens is unscrewed : focal distance0 degrees: focus at infinity (initial, stock position)45 degrees: focus at 32 cm90 degrees: focus at 15 cm170 degrees: focus at 7 cm`

I suspect this is true: to achieve a focal length of "FL", turn the lens CCW by this amount:
Code: Select all
`turns = 3.5 cm / FL`

For example, if you want FL = 10 cm, unscrew 3.5/10 = 0.35 turns = 126 degrees.
Note: after about one full turn, the lens will be completely unscrewed and fall out, and dust will start accumulating inside the lens housing on the IR filter surface, etc.
Last edited by jbeale on Mon Jun 10, 2013 6:38 am, edited 3 times in total.

Posts: 2196
Joined: Tue Nov 22, 2011 11:51 pm
Wow, did it really make that much diffrence? I'm going to have to try this when my camera board arrives lol
Posts: 1032
Joined: Wed Aug 15, 2012 1:05 pm
Hello jbeale,

when you change the focus, does it stop being sharp to infinity?

Cheers
Posts: 23
Joined: Sun May 26, 2013 8:59 pm
smx wrote:when you change the focus, does it stop being sharp to infinity?

The lens is focused at infinity from the factory. Any change you make will change that focus, and it will no longer focus at infinity. The closer you focus it, the more blurry distant objects will be, just like any other camera. There is actually a calculator to tell you exactly what range of things will be "in focus" (for your definition of "acceptably blurry"). Let's say you want to focus at 15 cm, and you'll call it "in focus" with no more than 3 pixels of blur. You also need to know this: R-Pi camera has 1.4 micron wide pixels, f = 3.6 mm and f-stop = 2.9 mm. 3 pixels * 1.4 um = 0.0042 m "Circle of Confusion". Type those numbers into this depth of field calculator.
You will find Near Focus: 13.19cm Far Focus: 17.39cm Depth of Field: 4.21cm

As a specific example, here is an example where I focused the camera at 15 cm. The ruler shows that the horizontal field of view at this distance is also about 15 cm, and items on the far wall (which is about 2 meters away) are blurry.

Posts: 2196
Joined: Tue Nov 22, 2011 11:51 pm
I’m not sure I can answer your question (I made no markings and it is dark now, can’t set infinity properly) but for me the lens slips out of the thread and starts to fall out of the housing when focus is at 4-5cm. That means without further tinkering you can’t use the thread as a focussing helicoid to get closer than about 4cm.

EDIT: actually, make that 3cm.
Posts: 406
Joined: Fri Jan 18, 2013 2:11 pm
Since this simple thread fit is not purposed for precision focus adjustment, some understanding and improvisation is needed to make it work well as such.

I measure the stock lens as having a metric thread, namely M6x0.35. So a fraction of a turn is only a few tenths of a mm at most. There is a lot of "allowance" in these threads relative to tenths of a mm, so you need either some preload force against the lens into the rearward direction of the threads, or some gap filler like PTFE tape. Otherwise the lens will rattle back and forth and throw off your focus adjustment.

("Allowance" in threads is the term for the positive gap between the largest allowed male thread and smallest allowed female thread, in the range of sizes permitted for a given thread standard, so that threads do not interfere.) For M6x0.35, the smallest pitch diameter (female) is 5.793mm versus largest (male) at 5.753mm, so there is at least the difference (0.04mm) in "slop" in a thread fit, and typically much more. This amounts to at least 1/10 turn (typically more) in this thread. These are tiny amounts of looseness but they will affect the focus in cameras and lenses this tiny.

Posts: 68
Joined: Sun Jun 02, 2013 7:19 am
Location: Palm Beach County, Florida USA
My lens seems absolutely tight without any slop, but that may be because I did not remove the three blobs of glue around the edge which (I assume) are supposed to keep it from moving after adjustment to infinity focus at the factory. It does turn anyway using my two-plier technique. On the other hand, I'm not sure if I could detect 40 microns of motion.

Posts: 2196
Joined: Tue Nov 22, 2011 11:51 pm
jbeale wrote:I'm not sure if I could detect 40 microns of motion.

That's a minimum. You'll see it go in and out of focus if you touch the lens. Elastomeric glue blobs might be acting as a preload spring.

Posts: 68
Joined: Sun Jun 02, 2013 7:19 am
Location: Palm Beach County, Florida USA
rkinch wrote:You'll see it go in and out of focus if you touch the lens.

That’s not my experience. It’s a pretty good fit. And the deep DOF works to our advantage.

I’ve found it easiest to pull focus using a rubber bung. Much easier than grabbing the lens using pliers every time. And no chance of scratching it.

Posts: 406
Joined: Fri Jan 18, 2013 2:11 pm
This is really cool. However, I don't know if it's just me, but I am not able to turn the lense around. Seems like it is too tight, and I don't want to destroy it. Anyone who would care to explain the procedure a little more in detail?
Posts: 3
Joined: Thu Feb 06, 2014 8:20 pm
it's gled with a blob of glue - you can *fix* this by
either
1) using an eraser to unscrew
or
2) a small pair of pliers
or
3) any other way of brute force that comes to mind ....

I had success with all three...
http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=7192 AutoStart Script

"That's not right, the badgers have moved the goalposts."
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX

Posts: 6237
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
RaTTuS wrote:it's gled with a blob of glue - you can *fix* this by
either
1) using an eraser to unscrew
or
2) a small pair of pliers
or
3) any other way of brute force that comes to mind ....

I had success with all three...

Thanks!
Posts: 3
Joined: Thu Feb 06, 2014 8:20 pm
I can say the camera is sharp I just moved the lens anti-clockwise until the subject came into focus
If you want proof I made this timelapse last week
Close Up 3 Day Orchid

Close Up 3 Day Orchid
http://vimeo.com/user10370362/previe...

this may be a better link
it is now in vimeo channels raspi
https://vimeo.com/channels/raspi/88431356
thegnnu

"I have adjusted the Raspberry Pi Camera lens to give close up approx 100mm focal point. The Orchid filmed over 3 days, frames taken every 30 seconds. A jump in the size after first day is due to the orchid opening during darkness hours."
Posts: 34
Joined: Thu Oct 18, 2012 7:07 pm
Location: Bristol
may any body please help me with how to scrape away the epoxy and loosen the thread?? I am having a lot of trouble with this and have already damaged one of my camera module..
Posts: 7
Joined: Wed Mar 19, 2014 11:07 am
src123 wrote:may any body please help me with how to scrape away the epoxy and loosen the thread?? I am having a lot of trouble with this and have already damaged one of my camera module..

viewtopic.php?f=43&t=46637#p518476
http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=7192 AutoStart Script

"That's not right, the badgers have moved the goalposts."
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX

Posts: 6237
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Focusing the lens closer than Infinity can increase the Depth of Focus.

If any lens is set to Focus at its Hyperfocal Distance then everything from Infinity to Half of the Hyperfocal Distance will be in focus.

Have Fun

Jon Mitchell

( Professional Focus Puller, amateur Pi tinkerer )
Posts: 2
Joined: Sat Jan 26, 2013 12:38 pm
RaTTuS wrote:
src123 wrote:may any body please help me with how to scrape away the epoxy and loosen the thread?? I am having a lot of trouble with this and have already damaged one of my camera module..

viewtopic.php?f=43&t=46637#p518476

thanks alot... eraser worked
Posts: 7
Joined: Wed Mar 19, 2014 11:07 am