How to build a spectrometer – tolerancing

This article is part of the How to Build a Spectrometer free tutorial.

Spectroscopy is a non-invasive technique and one of the most powerful tools available to study tissues, plasmas and materials. This article describes how to perform a tolerancing analysis, in OpticStudio, of a lens-grating-lens (LGL) spectrometer built of commercially available optical elements and how to compensate for assembly and fabrication tolerances.

Authored By Lorenz Martin


Article Attachments


Tolerancing is a manifold topic and a tolerance analysis of an optical device can be made in different ways. The approach we discuss here aims at identifying the critical parameters of a spectrometer related to its assembly in a laboratory environment and to those related to fabrication tolerances of the lenses.

The spectrometer and its preparation for tolerancing

The spectrometer we are considering for tolerancing is a lens-grating-lens (LGL) spectrometer with a bandwidth of 50 nm at 880 nm wavelength. It has been designed for Optical Coherence Tomography (OCT) applications and its design and optimisation are described in the Knowledgebase article “How to build a spectrometer – implementation”. The spectrometer has the following structure:


The spectrometer will be set up on an optical breadboard using optical table supports for the optical components. Consequently, we are interested in the following questions related to tolerancing:

  • How is the spectrometer performance affected when its elements are assembled on the optical breadboard?
  • How do fabrication tolerances of the optical elements affect the performance of the spectrometer?
  • How can performance degradation be reduced and/or compensated?

Preparing the lens file for tolerancing

Open the sample file 'Spectrometer_tolerancing.zar', from the article attachments, and have a look at the lens file. The first step we need to take in the tolerancing process is to turn all variable parameters and chief ray solves to fixed and convert semi diameters to circular apertures:

Once this step is completed, we can go for the first part of the tolerance analysis, the assembly tolerances.

Assembly tolerances

Roughly speaking, in the tolerancing process, OpticStudio will vary the parameters of the optical elements in the system and calculate how much the system performance is affected. So, we need to supply two types of information to OpticStudio: A merit function boiling down the system performance to a single numerical value and a tolerancing file specifying the parameters and associated tolerances to be considered in the analysis.

Merit function

The performance of our spectrometer is defined by one parameter: How much energy of one wavelength is concentrated in one pixel. Open the Merit Function Editor in the Optimize tab and implement this target as follows (or open the file Tolerancing_DENF.MF):

For the three reference wavelengths of our system (865 nm, 880 nm and 905 nm), we use the DENF operand to calculate the fraction of energy enclosed in a slit of 5 um width (corresponding to the pixel size of the line camera). The OSUM operand takes the sum of the three values and the DIVB operand is configured to calculate the percentage of energy loss with respect to the nominal performance. Note that the Factor argument of the DIVB operand (nominal value, red rectangle) needs to be inserted manually as one hundredth of the value of the OSUM operand.

Defining assembly tolerances

Like in a merit function, tolerancing involves operands that are listed in a tolerancing file and executed in the tolerancing process. Because the number of tolerancing operands can be quite large, it is convenient to use the Tolerance Wizard located in the OpticStudio Tolerance tab to generate the tolerancing file automatically. We investigate the tolerances associated with the assembly, so we consider only the Element Tolerances (Decenter and Tilt of elements) and the thickness in the Surface Tolerances group:

Click OK and OpticStudio comes up with a list of tolerances containing TTHI, TEDX, TEDY, TETX and TETY operands (these have been saved as the tolerance file Tolerancing_assembly.TOL). Since the thickness operand (TTHI) was introduced for every surface, we need to manually delete those not related to spaces between elements (red framed):

This done, we are ready for tolerancing.

Tolerancing: sensitivity analysis

When you click Tolerance…Tolerancing…Tolerancing a window containing many options will pop up. We need to adapt the settings in the Criterion and in the Monte Carlo sections:

With these settings, OpticStudio will performance a sensitivity analysis of the system once you have clicked OK. As a result, a Text Viewer window containing many lines of text will appear. For the sensitivity analysis, OpticStudio changes step by step every parameter listed in the tolerancing file to its Min and Max value and recomputes the Merit Function. These computations are all listed in the Text Viewer after the header. If you scroll down in the file, you will get to the more useful part, to the list of worst offenders:

This list shows those parameters affecting the performance of the system (as computed by the merit function) most. In our case, the worst of all offenders is the thickness of surface 0, i.e. the space between the fibre and the collimator lens. If this space is 0.2 mm too small, the amount of light on the detector pixels will decrease by more than 80 %!

The following offenders are all related to spaces between elements. It’s only on the 8th position in the list where the first decentre operand appears, reducing the system performance by less than 3 %.

The conclusion of this exercise is that great care must be taken to adjust the spaces between elements when the spectrometer is assembled on the optical breadboard, particularly in the collimating unit. All other alignment errors, including decentre and tilt, are less grave.

Fabrication tolerances

The second aspect of our tolerance analysis treats the performance degradation related to fabrication tolerances of the optical elements. Since these tolerances are of stochastic nature, we will use a Monte Carlo analysis to estimate their influence.

Defining fabrication tolerances

Setting the fabrication tolerances in the OpticStudio Tolerance Wizard is not straightforward because every manufacturer has different default tolerances, different ways of specifying tolerances, and even different tolerances for different lens types. Moreover, the lens tolerance parameters depend on each other. The settings in the screenshot below were chosen according to the manufacturer’s specifications and are an average of all available values.

Clicking OK generates a tolerancing list (see also Tolerancing_fabrication.TOL) with 85 lines, and we need again to remove some tolerancing operands as they cannot be computed. This is the case for TSTX, TSTY and TIRR on surface 0 (lines 60, 35 and 34).

Tolerancing: fabrication tolerances

Set the tolerancing options as follows and click the OK button:

As opposed to the sensitivity analysis, OpticStudio will now randomly modify all parameters listed in the Tolerance Date Editor at the same time. The results are again displayed in a Text Viewer, where the result of the Merit Function is displayed for each of the 1000 Monte Carlo runs. A statistical analysis of the Monte Carlo runs is displayed at the end (note that the numerical values may slightly differ since they are calculated on an arbitrary basis every time):

As we can see the tolerances associated with the fabrication of the optical elements will reduce the performance of our spectrometer by 27 % on average. Both assembly and fabrication tolerances are considerable and call for a compensator in our setup.


A compensator is a parameter in the optical design which can be used to correct the effect of the tolerances related to other parameters in the setup. We have seen in the previous analysis that the space between fibre and collimator has by far the largest effect on the performance of the spectrometer. For this reason, the fibre needs to be set up with a kinematic mount for accurate alignment. It is thus obvious to use the same kinematic mount as a compensator. In this section, we will investigate if this is a feasible strategy.

Merit function for use with compensator

The use of a compensator calls for a new merit function. The reason is the following: When OpticStudio runs tolerancing, it will again perform Monte Carlo Runs, but in addition re-optimise the system using the compensator in every run. The optimisation process is time consuming, hence we need a merit function that uses efficient operands and converges quickly. For our system, a standard Merit Function targeting minimal spot size is suitable. Configure the Optimization Wizard as follows and click OK (see file Tolerancing_spot.MF):

Tolerances for use with compensator

We will also create a new tolerancing file to include the compensator. Since we want to compensate for all possible tolerances in the system, we configure the Tolerance Wizard as follows:

When you have clicked OK and the tolerance file is generated, delete the lines 80, 55, 54 and 13 (TIRR, TIRY, TIRX and TTHI on surface 0) since they are not used. Then add a new line at the top with the COMP operand for surface 0 being our compensator (see file Tolerancing_compensator.TOL).

Tolerancing: compensator

Now we are ready to go for tolerancing. We first have a Monte Carlo Run without considering the compensator. To do so use the same settings as in the previous section about fabrication tolerances. The result will look like this:

From the result we can learn that, on average, our Merit Function is about 50 % worse than the nominal Merit Function if we do not compensate for assembly and fabrication tolerances. Now let’s do the same analysis, but under consideration of the compensator:

The computation will now take longer since optimisation is performed in every Monte Carlo run. The result we eventually get looks much better:

The mean value of the Merit Function is now only about 3 % worse than the nominal Merit Function. This result shows that the compensator we have chosen (the space between fibre and collimator lens) enables us to compensate for most of the performance degradation due to fabrication and assembly tolerances.

It should be noted that some of the Monte Carlo Runs yield a slightly better Merit Function than the nominal. This behaviour is because our nominal system had been optimised with a Merit Function targeting encircled energy, whereas we were tolerancing with a Merit Function targeting Spot Size.

The tolerance analysis of our spectrometer has shown that the most critical parameter in our system is the space between fibre and collimator lens. Therefore, the fibre needs to be set up with a kinematic mount. The space fibre—collimator lens is also suitable to compensate the tolerances of all other parameters in the optical system. So, when the spectrometer is set up, this compensator will be used to adjust the system. With this strategy it is possible to reduce the average system degradation due to assembly and fabrication tolerances to only 3 % with respect to the best performance.

This article is the first component of the How to Build a Spectrometer free tutorial.

Previous Article: How to build a spectrometer - implementation
Next Article: How to build a spectrometer – Stray Light Analysis


Was this article helpful?
18 out of 21 found this helpful



Article is closed for comments.