0% found this document useful (0 votes)
189 views26 pages

CODEV Ch3

This document discusses designing a simple fixed-focus digital camera lens in CODE V. It provides specifications for a low-cost VGA camera, including focal length, f-number, resolution, and MTF requirements. It explains how to use the New Lens Wizard to identify a suitable starting lens design from the patent database that meets the specifications. The chapter then guides the user through modifying, analyzing, and optimizing the starting design to fully meet the requirements.

Uploaded by

Sadegh Sobhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
189 views26 pages

CODEV Ch3

This document discusses designing a simple fixed-focus digital camera lens in CODE V. It provides specifications for a low-cost VGA camera, including focal length, f-number, resolution, and MTF requirements. It explains how to use the New Lens Wizard to identify a suitable starting lens design from the patent database that meets the specifications. The chapter then guides the user through modifying, analyzing, and optimizing the starting design to fully meet the requirements.

Uploaded by

Sadegh Sobhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Menu

Search

Chapter 2
Just Do It: Design a Digital
Camera Lens

In this chapter, you will design a fixed-focus digital camera lens for VGA resolution
(640 x 480). Guided by the required specifications, you will use the New Lens Wizard
to identify a suitable starting point. You will then modify, analyze, and optimize the
optical system to meet the requirements. This will allow you to learn most of the basic
techniques needed to use CODE V.

Contents

Learning by Doing......................................................................................................18
The New Lens Wizard ................................................................................................21
Working with Surfaces ...............................................................................................25
Analyze the Starting Point ..........................................................................................33
Conclusions ................................................................................................................42

CODE V Introductory User’s Guide 17


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Learning by Doing
Search
A Simple Digital Camera Lens
Digital cameras are very common these days, and the latest mega-pixel models
have high-resolution CCD arrays and sophisticated optics and electronics. But don’t
worry, that won’t be your very first task with CODE V. Instead, you will design a
fairly simple objective lens for a fixed-focus digital camera. This will still require
some optical design, but it’s a relatively simple problem, a two- or three-element
centered lens with glass and/or plastic refracting lens elements.
Here is what you will learn in this chapter:
• Interpret general design specifications for a simple lens
• Use this information to identify a starting point
• Modify the starting point to match the requirements
• Perform a basic analysis, compare these results with the specs, and determine
guidelines for optimization
In the next chapter, you will use the results of this chapter as a starting point to
• Optimize the lens
• Identify problems with the design for potential refinement
These steps will allow you to work with many of CODE V’s features through
various phases of optical design. We will explain some of these features as they are
introduced here, with additional explanations in subsequent chapters.

Design Specifications
Sometimes you will receive a lens prescription from someone and you will need to
enter it in CODE V, analyze it, and perhaps optimize it. This is fairly
straightforward. In other cases, a design problem starts out with a spec, or set of
specifications, on how the lens must perform, and from these guidelines you must
determine a starting point, set it up, analyze, and optimize it.
For this digital camera problem, the spec came from a CODE V customer who
makes consumer products. The question was, “If you wanted to define a low-cost,
fixed-focus digital camera for VGA, how would you specify it?”

18 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Fixed-focus VGA Digital Camera Objective Specifications


• Small number of elements (1-3) made from common glasses or plastics
Search
• Image sensor (baseline is Agilent FDCS-2020)

Resolution 640 x 480 effective pixels


Pixel size 7.4 x 7.4 microns
Sensitive area 3.55 x 4.74 mm (full diagonal 6 mm)

• Objective Lens

Focus Fixed, depth of field 750 mm (2.5 ft.) to infinity


Focal length Fixed, 6.0 mm
Geometric Distortion <4%
f/number Fixed aperture, f/3.5
Sharpness MTF through focus range
(central area is inner 3 mm of CCD)

Low freq., 17 lp/mm >90% (central) >85% (outer)


High freq., 51 lp/mm >30% (central) >25% (outer)

Vignetting Corner relative illumination > 60%


Transmission Lens alone, > 80% 400-700 nm
IR filter 1 mm thick Schott IR638 or Hoya CM500

What Does It All Mean?


For one thing, this means that it will be a rather small lens system. The sensor size
and the focal length of the lens are each only 6 mm (about a quarter of an inch). The
sensor size and the effective focal length (EFL) will establish the field of view
(FOV) for the lens according to the infinite-object-distance relationship, h = f tan θ
or
Image height = EFL * tan(semi-FOV)

CODE V Introductory User’s Guide 19


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

In this case, the image height is 3 mm (half of the detector diagonal), and the EFL is
6 mm, so you can solve this for the semi-FOV of 26.5° (this is useful since the
Search patent database lenses are listed by f/number and semi-FOV). Given that you want a
small number of elements, this is all the information you need to find some starting
points.
CODE V has analysis features to allow evaluation of the other specs (distortion,
MTF, relative illumination, transmission). We will introduce most of these features
later, as they are needed, but consider the term sharpness for a moment. Sharpness
is often defined by MTF, which quantifies the lens' ability to image information as a
function of spatial frequency. Maximum sharpness is given by an MTF of 1.0.
Minimum sharpness (i.e., no information) occurs for an MTF of 0.0. High spatial
frequencies represent small details and are measured in lines per millimeter. We
will discuss MTF and other evaluation methods in more detail later.
A digital camera uses a CCD array consisting of small but finite-sized cells called
pixels (there are actually three color pixels for each cell, but for design purposes,
we will think of each cell as consisting of a single pixel). The spec indicates that the
pixel size is 7.4 microns square. The maximum spatial frequency that this array will
resolve can be calculated as one over twice the pixel size, 1/(2*0.0074) = 67.6 lines/
mm. With this CCD array, any image information with a higher spatial frequency
(i.e., finer detail) than this will not be seen. In spite of this, the optics must actually
have non-zero MTF somewhat beyond the CCD cutoff frequency, so the combined
optics/detector MTF will produce a usable contrast up to the CCD cutoff frequency.
This is the meaning of the small table on page 19 under the Sharpness specification.

20 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

The New Lens Wizard


Search
Starting a New Lens
The New Lens Wizard is a tool for creating new optical system models from
existing designs (samples, patents, or your own saved favorite lenses) or from
scratch. It helps you to locate a suitable starting point and then define the essential
system data corresponding to your specifications (including pupil size,
wavelengths, and field data). Start CODE V and launch the New Lens Wizard now:

1. Choose the File > New menu.


2. Click the Next button on the Welcome screen.
3. Click the button labeled Patent Lens and click the Next button.

CODE V Introductory User’s Guide 21


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Patent Database
In addition to some 30 sample lenses that demonstrate program features, CODE V
Search
includes a database of some 2,456 expired patents (mainly centered optical systems
for various applications). You can use the New Lens Wizard or the Patent Lens
Search feature (Tools > Patent Lens Search menu) to access and search this
database through the use of filters that specify various properties. In the following
procedure, you will continue using the New Lens Wizard to select a patent lens.
1. In the New Lens Wizard, click the Filter button.
The Filter dialog box displays, which allows you to narrow down the search for
a starting point. In the case of the digital camera lens, you need both a relatively
fast (small) f/number and a fairly wide field of view or field angle (26.5° semi-
field angle, which corresponds to the 3 mm half-diagonal of the CCD array).
You also want this lens to be fairly cheap, so it should have a small number of
elements (1-3). You can fill in the filter dialog to start the search. It's a good idea
to expand the range slightly since you can often slightly modify or optimize a
system to the needed specifications. If you make the search targets too narrow,
you may miss some promising design forms.
2. Click the check boxes and fill in the Min/Max entries for
– F/# (f/number, try 1 to 4), goal is 3.5
– Semi-Field of View (try 20° to 33°), goal is 26.5°
– Number of elements (try 1 to 3), goal is smallest possible for low cost

3. Click OK.
The New Lens Wizard returns you to the patent list where you will now find
around 13 lenses that meet these requirements.

22 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

You could try several different starting points, but note that it will probably be
hard to expand the field of view, so wider field starting points are better. The
Search lens named or02248 looks promising – it has a 27.5° FOV, and a faster
(smaller) f/number than we need (2.4 -- this is good, since stopping down a lens
to a larger f/number usually improves image quality).
4. Click the lens named or02248 in the spreadsheet of patents.

5. Click the Next button to go to the Pupil page.

Defining the System Data


Now you can complete the entry of the lens through the New Lens Wizard. The
next few screens ask you questions about how the lens will be used, properties that
CODE V calls system data. Note that the goal at this point is to get a working
model that can be modified and optimized to meet the final specs. Further changes
will be needed.
1. In the New Lens Wizard, you should be on the Pupil page. Choose
Image F/Number from the dropdown list, and enter the value 3.5.

CODE V Introductory User’s Guide 23


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

F/number is a ratio, so it won’t need to be scaled when the lens is scaled (and the
lens will most likely need to be scaled).
Search
2. Click the Next button to go to the Wavelengths page, and change the weight for
the green wavelength (589.0) to 2.
This will give the central wavelength more emphasis later in optimization.
3. Click the Next button to go to the Reference wavelength page, but do not
change the default value.
This is the wavelength used for paraxial and reference-ray tracing; the default is
OK.
4. Click the Next button to go to the Fields page. Right-click on field 2 and choose
Insert from the shortcut menu to add an additional field angle, then type the
values 0, 11, 19, and 26.5 for the four field Y angles.

This lens is fairly wide-angle in field, so adding an additional intermediate field


angle is a good idea for optimization and analysis. Typically, best practice is to
have fields defined at 0, 0.7 and full field at a minimum. Adding intermediate
fields can be helpful in controlling zonal variation of field dependent aberra-
tions such as astigmatism.
5. Click the Next button to go to the System Settings page, but do not change the
default values.
6. Click the Next button to go to the last page in the New Lens Wizard.
7. Click the Done button.

24 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Working with Surfaces


Search
The Lens Data Manager Spreadsheet
The basic operation of CODE V is ray tracing – everything else is based to some
extent on tracing one or many rays and doing some calculations with them. In the
majority of systems, rays are traced sequentially through a series of optical surfaces
you have defined. The properties of these surfaces will determine how the rays are
traced. This is combined with system data to create a model of the optical system.
Since surfaces are the heart of any optical model, you will spend a lot of time
looking at the Lens Data Manager (LDM) spreadsheet window, which is always
present in the interface (you can resize or minimize it if you don't want to see it, but
you can’t close it).

The LDM window behaves like spreadsheets in other programs in that you can re-
size rows or columns, select cells or groups of cells, and enter data in cells. Note
that some cells are gray and do not accept data entry—these cells contain data
calculated by the program and this can't be directly changed. You can right-click on
any cell, including gray cells, to see a menu for that cell. Right clicking is a very
common operation which gives quick access to all available information for a cell.

Tip: To see the full value of any displayed number, position the mouse pointer over
the value and leave the pointer there (don’t click). To change the number of
displayed digits for all numbers in the interface, choose the Tools > Customize
menu and go to the Format Cell tab in the Customize dialog box (General format
with 5 digits is used in this guide). You cannot format cells individually.

Note also that in the discussion below, we are considering the default display of the
LDM window for rotationally symmetric optics. It is possible to hide columns
(right click any header cell) or to make certain common entries blank (e.g., Sphere

CODE V Introductory User’s Guide 25


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

and Refract; choose the Tools > Preferences > menu and go to the UI tab in the
Preferences dialog box to change this). If there are non-rotationally symmetric
Search surface properties, the LDM window will add additional columns for certain X and
Y data.

Surface Details
Every lens model will start with an object surface and end with an image surface (it
is really just the last surface, since not every lens model will form an image there,
though most will). You will also note that there is always a surface labeled Stop,
which is the aperture stop surface. This is defined as the limiting surface for on-axis
rays. The chief ray (or principal ray) from every field point will be iterated to pass
through the center (x=0, y=0) of the stop surface, unless you override this behavior
with chief ray aiming (this is only necessary in a few unusual situations).
Each row in the LDM spreadsheet has a surface number and a surface name
(optional but very useful in complex systems). To select an entire surface (each is
displayed in a row), click the surface number. The surface type is next, which is a
dropdown list (double-click it to display a list of surface types), with the default
type of Sphere. The Y Radius is the radius of curvature, which is the reciprocal of
curvature. Spheres and other rotationally symmetric surface shapes have only a
single curvature, and Y is used for this (types such as Y Toroid have X and Y
curvatures). You can also choose to display the Y Curvature (reciprocal of radius,
e.g., units of 1/mm). See the tip below.

Tip: You can work with radius of curvature or its reciprocal, curvature, by
checking or un-checking the Edit > Radius Mode menu item.

Thickness is defined as the distance to the next surface, measured along the local Z
axis of the current surface (which is the optical axis for centered systems such as
this). Note that the thickness (air space) of surface 6 is gray and has a small S next
to it. This thickness is set by a paraxial image (PIM) solve, which calculates the
thickness at which the paraxial marginal ray has a height of zero at the following
surface. This sets the paraxial image distance, where the lens is approximately in
focus. This may not be the best focus, however, so the thickness of the image
surface is used as a focal shift from the PIM value (the total image distance is the
sum of these two values). Optimization usually determines the best focus shift (the
combination of PIM solve and variable defocus is recommended for most optical
systems).
Glass cells contain the name of the material in the space following the surface, and
if it is blank, the material is AIR. The glass determines the index of refraction,
which is a fundamental requirement for ray tracing. There are several possible

26 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

forms for glass names, depending on whether they are from glass makers, defined
locally for the lens (“private catalog”), or defined as “fictitious” glass whose index
Search can be varied to allow optimization, as shown in the example (there is a supplied
macro, glassfit.seq, that can help you convert fictitious glasses into real glasses that
you can buy). Refract mode determines the basic behavior of a surface, whether
rays are refracted or reflected at the surface (double-click the cell to see the
choices).
The final column is labeled Y Semi-Aperture and represents the size of the
optically useful portion of the lens surface. By default, this is a centered, circular
aperture calculated by the program to pass the reference rays from all field and
zoom positions. You can change this to a user-defined aperture for any surface in
several ways, the simplest of which is to right-click and choose one of the Change
to… options that pops up. You can just accept default apertures for now, though
later you will learn about the relationships between apertures, pupil size, and
vignetting factors.

Changing and “Committing” Data


Changing data in the LDM spreadsheet is simple—click a non-gray cell and type a
new value. You can also double-click a cell to display and edit the full value (or to
display a list of choices in some cases). If you change something by mistake, use
the Edit > Undo menu to fix it (make sure that a spreadsheet or command window
is in front; Undo will not be available if a graphics window or dialog box is in
front). Note that some cells have a small symbol or “glyph” next to the value,
identifying a special state for that cell (e.g., S for solve, V for variable, Z for zoom).
To change the state of any cell (including a gray cell), right-click on it to see a
shortcut menu of options (e.g., changing a solve to a variable will remove the solve
and allow you to change the value directly, but be sure you want to do this since the
solve may be there for a reason).
One of the right-click menu choices on any surface data item will be Surface
Properties. This opens a large window that gives direct access to ALL properties
of that surface, including many that do not appear in the LDM spreadsheet. We will
cover Surface Properties a little later.
You can also change data in the LDM spreadsheet by typing appropriate commands
at the CODE V> prompt in the Command Window. This requires knowing the
applicable command and its syntax (e.g., THI S5 2.3 will change the thickness
of surface 5 to 2.3). When you enter a command this way and press the Enter key,
you will also see the corresponding LDM spreadsheet or Surface Properties
window update.

CODE V Introductory User’s Guide 27


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Don’t Fear Commitment


In CODE V, we use the term “commit changes” to refer to transferring the data
Search
from the place it is entered in the user interface (such as a spreadsheet cell or dialog
box) to the lens database inside CODE V (sometimes called the “back end” of
CODE V). Normally data is committed instantly—that is, as soon as you type or
click in another cell, data field, or window. This is similar to other programs such as
Excel, except you will also see the corresponding commands displayed in the
Command Window.
However, there are some cases in which a command is built from several data
values entered in a row of a smaller spreadsheet (e.g., apertures in the Surface
Properties window). In this case, the numbers are not committed until the row is
completed.
The thing that may be confusing has to do with the different types of windows.
Windows in CODE V come in two basic types, those that have Apply or OK and
Cancel buttons (these are called dialog boxes), and those that do not (the main
examples being the Surface Properties and System Data windows). Dialog boxes
with OK buttons (including the dialog boxes for CODE V options such as MTF) do
not commit anything to the back end until you click OK. If you click Cancel, no
changes are actually made. In the case of the Surface Properties and System Data
windows (and a few others, all associated with the LDM), you can keep them open
while you work in other windows, or close them by clicking the X in the upper
right-hand corner of the window. Changes made in these windows are committed
immediately, just like the LDM spreadsheet; however, you can be sure data is
committed to the lens database by clicking the Commit Changes button. You can
see what data has been committed in the Command Window, which displays the
commands generated for these operations.
Don’t worry too much about this—you can always use Undo to get back to any
earlier state of the lens, in case you change something you did not intend. It’s also a
good idea to save your lens in a file whenever you make significant changes (File >
Save Lens As menu).

Drawing Pictures
Now you can understand the LDM spreadsheet, but as they say, a picture is worth a
thousand numbers. So it’s a good idea to draw a picture of the lens as soon as you
can. Many problems are easy to spot on a lens picture. There are a number of ways
to draw lenses, including the very flexible VIEW option (Display > View Lens
menu), but for now, there’s a quicker way.

28 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

• Click the Quick 2D Labeled icon on the toolbar:

Search

It’s the middle one that shows a lens and a pencil along with the letter Q (for quick)
and the letter L (for labeled—float the mouse over it to see the tool-tip help to see
the message “Quick 2D – Labeled”). Keep the resulting window open as you work
(resize and move the window as desired). When you change something, click the
Execute button in the upper left corner of the window to redraw the lens picture.

Before analyzing this lens, you will more than likely need to scale it to the required
effective focal length (EFL).

Surface Operations: Scale the Lens


Although you set the f/number and field angles to the desired values in the New
Lens Wizard, you need to be sure the lens has the specified effective focal length
(EFL) of 6 mm. One way to determine this is to display a window of first order
properties.
1. Choose the Display > List Lens Data > First Order Data menu, and re-size/
re-position the resulting window for convenient viewing.
Note the value labeled EFL in this window (0.9528 mm), which is not optimal
for this application. Scaling the lens data is the usual way to fix this.

CODE V Introductory User’s Guide 29


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Search Tip: You can place the EFL and various other lens properties on the status bar
at the bottom of the main CODE V workspace. This allows continuous
monitoring of these items. Choose the Tools > Customize menu and click on
the Status Bar tab in the Customize dialog box to access this feature.

2. Select surfaces 1 to Image in the LDM spreadsheet window (click in the surface
# column and drag to Image to select the range).
3. Choose the Edit > Scale menu to display a dialog box (note that the surface
range is set to 1 to Image).
4. Click the button labeled Scale Effective Focal Length, then enter the value 6.0
in the field labeled Scale Value.

30 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Search

5. Click OK to scale the lens.


6. Click the Execute button in the List First Order Data window to update
it.
Note that the EFL value is now 6 mm as desired. Note also that the paraxial
image height is 2.99 mm (close enough to the desired 3 mm).
7. Click the Execute button in the Quick 2D Labeled Plot window to update the
picture as shown below.

CODE V Introductory User’s Guide 31


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

New Title and Starting “Save Lens”


So far, so good, but before continuing, you should label and preserve the work you
Search
have done up to now. Noting that this is an expired patent which is about to be
changed by optimization, you can set a new lens title and save this as a starting
point.
• Choose the Lens > System Data menu and click System Settings in the System
Data window’s navigation tree.
System Data is where most non-surface-related data can be viewed and modi-
fied. The basic System Data values (pupil, wavelengths, field) were defined in
the New Lens Wizard, but you can view and change these properties and many
others through the System Data dialog box.
• Select the Title field and change it to something like Dig. Cam. VGA: start
(you have up to 80 characters, but don't include any quotes or apostrophes). Tab
to or click in another field to commit this data to the CODE V lens database.

• Choose the File > Save Lens As menu and enter a file name such as
DigCamStart.len, then click Save.

32 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Analyze the Starting Point


Search There are many types of analysis in CODE V, but only a few of them are needed to
determine if you are meeting the specs. The results of these analyses will also guide
the setup for optimization (if required):
• First order requirements (done after scaling the lens, as detailed in “Surface
Operations: Scale the Lens” on page 29; the scaled lens has the correct first-
order focal length and image height)
• Distortion (Field Curves and/or Distortion Grid)
• Sharpness (diffraction MTF—this will also establish depth of focus, by
analyzing MTF with a different object distance)
• Vignetting/illumination (Transmission Analysis)
In addition, you will also use a couple of quick analysis features for reference (spot
diagram and ray aberration curves). We will explain the basics of these analysis
options now. Additional information will be provided in a later section of this guide
that covers evaluation features. There is one more thing that needs to be done with
the starting point, though it does not neatly fit into any specific analysis category:
establish feasibility.
Assuming that someone will eventually manufacture this lens, there are certain
practical issues. Are the elements too small or too large to make easily? Are they
too thin or too thick for practical fabrication? Can they be assembled and mounted
easily? Is the glass available, and is it expensive? These are some basic questions,
which must be answered on the basis of looking at the basic lens data and
comparing it to some known experience (you may have to do some calculations and
perhaps ask someone who has designed or built similar optics).
There are other feasibility issues that are more technically complex. One is
tolerance analysis, which will be introduced later in this guide. This relates to how
accurately the elements must be fabricated and mounted to maintain a required
level of performance. Another that won't be covered is thermal analysis (although
CODE V can help with some aspects of this, such as changes in performance due to
a simple temperature change).

Quick Ray Aberration Curve


A ray aberration curve is a useful way of looking at ray trace data to see patterns
that may cause problems. Transverse ray aberrations are measured on the image
surface as the distance from a particular ray to the chief ray for the same field point
(for a perfect lens, this should be zero for every ray traced from the same field
point). This is plotted as a function of position in the stop or pupil for a line of
evenly spaced rays (a ray fan).

CODE V Introductory User’s Guide 33


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

You are first looking for large deviations, including separations between the curves
for different wavelengths (chromatic aberration). You may also look for distinctive
Search patterns that represent coma, astigmatism, and other basic aberrations. Experience
can tell you where such aberrations come from, suggesting where you might make
corrections, perhaps in the form of additional elements or aspheres.
The Quick Ray Aberration plot is a one-click version, which you run by clicking
the Quick Ray Aberration plot toolbar button, shown below (for the general case,
choose the Analysis > Diagnostics > Ray Aberration Curves menu, option name:
RIM, for “rim ray”). The Quick version is actually done by a macro and performs
automatic scaling (it also supplies a text table of ray aberrations, generated by the
ANA option). Note that the following graph is shown after zooming and positioning
only the highest field angle in the Quick Ray Aberration Plot window.

The starting point doesn’t show signs of any gross aberrations, though you can only
tell this by looking at the scale and knowing what is big. The automatic scale value
here is 0.023 mm, 23 microns. For comparison, the Airy disk diameter (diffraction
spot size for a perfect lens) is 2.44*(wavelength)*(f/number), or about 0.004 mm
for f/3.5. This lens is not diffraction limited (nor would you expect it to be), but its
aberrations are within a factor of 6 of the Airy size.

Tip: Always use the graphical zoom tool to zoom in on the scale numbers for plots.
Automatic scaling may make a lens look good, but the scale size may be large.

34 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Quick Spot Diagram


A spot diagram is not a required part of the spec, but it is a quick and easy analysis
Search
that gives you a graphical picture of the imaging quality of the lens. Basically,
many rays from each field point are traced through the system, forming a
rectangular grid in the entrance pupil. A scatter plot of the rays' position is done on
the image surface, one for each field, and usually color coded for wavelength,
giving an idea of chromatic aberration. The scale for plotting is determined
automatically to fit the spots in the plotting area, so as with any analysis plot, you
must check the scale size.
To run this, click the Quick Spot Diagram button (general case: Analysis >
Geometrical > Spot Diagram, option name SPOT). For this lens, the spots for all
fields are roughly the same size, though the shapes are different. The scale bar is
0.050 mm, 50 microns.

Tip: The supplied macro spotdet.seq will plot spot diagrams with superimposed
circles or rectangles representing a specified detector size or Airy disk. Choose the
Tools > Macro Manager menu and locate the macro under Sample Macros/
Geometrical Analysis. Note that you will have to fill in the required data to run this
macro.

CODE V Introductory User’s Guide 35


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Distortion
The paraxial image height is related to field angle by the relationship h = f tan θ. If
Search
the real image height differs from this paraxial prediction, you have distortion.
Distortion is therefore a field-related aberration, and it is often displayed as a plot
along with another field-based aberration, astigmatism. These field curves are
available by choosing the Analysis > Diagnostics > Field Curves menu, or by
clicking the Quick Field Plot button on the toolbar.
The resulting distortion curve has field angle as the vertical coordinate and percent
distortion as the horizontal coordinate. It shows that the starting point is well within
the specified 4% distortion for the lens. In fact, it's less than plus or minus 1%
across the entire field of view. Astigmatism (left side in plot window below) is well
corrected at the full field, but there is substantial zonal residual at the intermediate
fields.

A distortion grid is another way to view distortion that is perhaps a little more
intuitive. In this case, you see a rectangular grid that represents the ideal (paraxial)
image, with the distorted grid superimposed on it. Since the field of view is defined
by field angle for this lens, you need to convert the CCD horizontal (X) and vertical
(Y) dimensions into field angle using h = f tan θ again (we used the 3 mm corner
distance to define the maximum field, but in this case we want to view the actual
format of the field). From the spec, recall that the full detector dimensions are 3.55
x 4.74 mm. Divide these by twice the focal length and take the arctan to get the
maximum Y and X field angles (16.48° and 21.55°).

36 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

1. Choose Analysis > Diagnostics > Distortion Grid menu.


2. Enter 21.55 in X FOV semi-field and 16.48 in Y FOV semi-field. Also choose
Search
Fiducial Marks Only for the reference grid, and click Execute.

The distortion is small, so you need to zoom in on the plot to see it. Fiducial marks
show the paraxial ray positions. This makes a less cluttered plot for small distor-
tion cases.

MTF (“Sharpness”)
With any type of camera, users are interested in qualities such as sharpness or
resolution. Optical designers relate these qualities to MTF, or modulation transfer
function. Modulation is essentially relative contrast, with 1.0 representing ideal
contrast (perfect black and white, no degradation to intermediate grays). For large
features (low spatial frequency), even a poor lens will have good contrast, while for
higher frequencies (fine details), aberrations and diffraction blend the dark and light
areas. If you determine and plot the MTF for the full range of spatial frequencies,
for all field points, you can define the sharpness of a lens in very compact form.
1. Choose the Analysis > Diffraction > MTF menu.
Note that there is a Quick MTF button, but we want specific spatial frequencies,
and the quick version doesn't support this.
2. On the Frequency/Calculation tab, enter 68 for the Maximum frequency and
17 for the Increment in frequency.
Note that when you change a value on a tab, a red star (also called a change
indicator), displays next to the tab title.

CODE V Introductory User’s Guide 37


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Search

3. On the Graphics tab, enter 68 for the Maximum plot frequency and click OK.
Recall that the CCD array has a maximum spatial frequency of about 67 lines/
mm, and the combination of 17 and 68 (4*17) works well for this analysis.

Tip: You can use the line-drawing and text tools on any graphics window to add
information to help you read and interpret the plot. The added graphics will go away
if you recalculate the plot, but you can choose the File > Save Window As menu if
you want to save the annotated plot.

It appears that the starting lens has very good MTF properties, meeting the low and
high frequency sharpness requirements for all fields and azimuths (MTF can vary
with direction, so two orthogonal directions are calculated, radial and tangential).
The horizontal line at 0.25 MTF was added by hand using the line drawing tool.

38 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Note that we have not yet considered the depth of field issue, which requires that
the lens meet the MTF spec with the object distance at 750 mm as well as the
Search current “infinite” (1.0E10 mm) value. We will discuss this in Chapter 3, which
covers optimization.

Vignetting/Illumination
The spec requires at least 60% relative illumination at the corner of the field (full
field in your system data). This is to include vignetting effects (clipping of off-axis
rays due to apertures on surfaces other than the aperture stop surface) as well as
angular effects (“cosine fourth” is a well-known approximation to relative
illumination vs. angle). The program will model the relationship between pupil size
(or f/number), surface apertures, and so-called vignetting factors.
The system used for this is very flexible but a bit complex and will be explained in
more detail in Chapter 10. Here is the short version: Vignetting factors determine
the reference rays, which in turn determine default apertures. These in turn
determine the rays that get through in calculations such as MTF and many others.
For design purposes, you can directly change the vignetting factors, to expand or
contract the cone of light from off-axis fields, and the default apertures are adjusted
accordingly. In this patent, the upper and lower Y vignetting factors for the full
field are 0.21 and 0.11, respectively. What relative illumination does this produce?
There are at least two ways to look at this, and one is already done.
• Click the Text tab of the MTF output window you created in the last section.
Scroll down to the output table for the last field. (0.0, 26.5 degrees).

Note that in addition to the tabular MTF data, there is additional information for
each field point. Relative illumination is especially helpful in this case, and it is
58.8%, just a little below the required 60% in the spec (note that the value for
cos**4 of 26.5° is 0.64). You could play with the vignetting factors (found on the

CODE V Introductory User’s Guide 39


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Fields/Vignetting page of the System Data window) to try to improve this, but
since this is close to the spec, you can leave the vignetting alone for now, and see if
Search it improves during optimization.
The other place to see illumination data is in the Transmission Analysis option
(Analysis > System menu), which will provide more detailed illumination data,
including the effects of coatings, if any. For this option, CODE V will assume a
quarter-wave anti-reflection coating on each glass surface, unless you delete this
coating or apply a user-defined coating.

Establish Feasibility
This lens looks pretty good as it is, considering that you simply picked an old patent
based on some requirements, then scaled it. Are you done? Consider the size and
thickness of the elements. Although it is possible to fabricate and mount very small
lens elements, these elements are awfully thin for their size.
The original patent had a focal length of about 1 mm, though it was probably scaled
to unit focal length for patent purposes (it may have been a much larger lens,
perhaps for 35 mm film, for which it would have a focal length of about 43 mm for
this field of view). At EFL=6 mm, the middle (negative) element is 1.5 mm in
diameter and only 0.126 mm thick -- just 126 microns (at 43 mm, this element is a
more reasonable 0.9 mm thick). Just to give you a visual impression, here is a plot
of this lens at approximately real scale:

For optics of this size to be handled and worked, you will need to require
reasonable center and edge thickness values, perhaps 0.9 mm for the center and 0.8
mm for the edge thickness values. This means that as good as this design appears to
be, you are not done yet. You will need to use constrained optimization (the
Automatic Design or AUTO option) to reconfigure the lens to meet all the
requirements.
There is at least one additional issue of practicality, which is glass selection. All
three fictitious glasses in the patent are all high index glasses (1.786, 1.717, 1.835).
High or low index (e.g., >1.65 or <1.45) glasses are generally less common and
thus more expensive than mid-range index glasses. You can use the glassfit.seq
macro to quickly convert these glasses to the closest real equivalents (choose the
Tools > Macro Manager menu, then run glassfit.seq, found under Sample
Macros/Material Information in the Macro dialog box). This macro runs

40 CODE V Introductory User’s Guide


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

interactively in the Command Window (question/answer format). Using Schott


glass and allowing automatic replacement, you get the following:
Search

Note that only SF1 is a “preferred” (common) glass, while NLASF41 is an


“inquiry” glass (special order). LAFN28 is listed as US $315 per pound ($693/kg),
which is about 19 times the price of BK7, the most common optical glass. These are
not the best choices for a low-cost digital camera, even if the elements are very
small (note that you could use the COST option to find the weight and estimated
glass cost; choose the Analysis > Fabrication Support > Cost Analysis menu). It
certainly would make sense to try to constrain the glass choice to a lower-index and
cheaper region of the glass map. This can be done in AUTO.

CODE V Introductory User’s Guide 41


Chapter 2 Just Do It: Design a Digital Camera Lens
Menu

Conclusions
Search To summarize, in this chapter you have:
• Interpreted a spec for a digital camera lens design
• Used the New Lens Wizard to locate a suitable starting point from a database of
expired patents
• Scaled the lens for the application
• Analyzed the starting point and determined some guidelines for optimization
If you haven't saved your work, you should do so now, so it is available for use
in subsequent chapters of this guide. Choose the File > Save Lens As menu and
give the lens file a name such as DigCamStart.len. In the next chapter, you will use
this starting point to optimize a lens that has acceptable optical performance as well
as reasonable fabrication possibilities.

42 CODE V Introductory User’s Guide

You might also like