How to build a spectrometer - implementation

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 implement a lens-grating-lens (LGL) spectrometer using commercially available optical elements. It features the setup of the spectrometer and addresses the improvement and optimisation of its design.

Authored By Lorenz Martin


Article Attachments


This article describes how to implement a lens-grating-lens (LGL) spectrometer using commercially available optical elements and how to optimise it in terms of aberrations and performance. The article relies on the Knowledgebase article "How to build a spectrometer – theory" for the basic understanding of an LGL spectrometer.

Basic design of the LGL spectrometer

When designing and implementing a spectrometer, some prerequisites must be known and some initial decisions regarding optical elements and platforms must be taken (links to the manufacturer websites are given at the end of the article). In our case, we develop a spectrometer for Optical Coherence Tomography (OCT):

  • The bandwidth of the spectrometer is chosen to range from 855 nm to 905 nm to match the spectrum of the OCT source being favourable for the examination of the human eye.
  • The diffraction grating we use is a WP-HD1800/840-25.4 volume phase holographic grating with 1800 l/mm manufactured by Wasatch Photonics. This grating has been developed for OCT applications and it is optimised for optimal performance in the desired wavelength range. Having a diameter of 1’’, the grating also defines the aperture of our system.
  • Consequently, we will use 30 mm cage elements and 1’’ lenses by Thorlabs to implement the spectrometer.
  • The sensor we use is a Teledyne e2V AVIIVA EV71YEM4CL2010-BA9 line camera with 2048 pixels of 10 µm width and 20 µm height.
  • Setting the focal length of the spectrometer’s focusing lens to 125 mm will illuminate the sensor almost entirely, and the Airy disk radius of 9.2 µm at the central wavelength is in the order of the sensor’s pixel width (check the Knowledgebase article "How to build a spectrometer – theory" to learn how to calculate these parameters).


Implementation of the LGL spectrometer in OpticStudio

System setup

In our example, we are assuming that the light entering the spectrometer originates from a single mode fibre. For this reason, we can model the entrance pinhole as a point source. Consequently, the Aperture Type is set to Object Space NA and the Aperture Value to 0.12 in the System Explorer. This setting corresponds to the acceptance angle of the fibre. In addition, we select Gaussian Apodisation with a Factor of 1.0 to account for the intensity profile of the beam. The wavelengths are set as 0.855 µm, 0.880 µm (primary) and 0.905 µm to cover the desired bandwidth of the spectrometer.



Collimator lens

OpticStudio comes with a large catalogue of commercially available lenses. They can be found and inserted into the lens file through the Lens Catalog:


The lens we choose here is a Thorlabs achromatic doublet with a diameter of 1’’, an effective focal length of 60 mm and a coating suitable for our wavelength range. The 60 mm EFL was selected so that the diameter of the collimated beam illuminates the diffraction grating entirely. Having a large aperture is favourable for having a small diffraction limited spot size on the detector.

Inserting the lens on surface 1 will add three new lines in the lens file. The manufacturer has optimized the lens for infinite conjugate ratio, i.e. an object at infinity is imaged to the focal plane. But we would like to do the opposite, i.e. collimate a point source (the fibre). For this reason, the lens needs to be reversed. This is accomplished in OpticStudio by marking the lines to be reversed and pushing the Reverse Element button:



Since the EFL of the lens is 60 mm, we set the thickness of surface 0 to 60 mm in order to account for the distance from the fibre to the collimating lens. Moreover, we add the space between collimating lens and diffraction grating. The value of 30 mm for this space is uncritical, since the beam is collimated. And we make surface 1 the stop:



If you now open the 3D Layout of our setup you will notice that the rays are not collimated after the lens. The reason is that the lens is not yet at the good position with respect to the fibre. OpticStudio’s Quick Adjust feature (Optimize...Quick Adjust) is a very convenient tool to carry out simple optimization tasks. We choose the parameters as follows and adjust twice:



The thickness of surface 0 will be changed to 55.718 mm (which corresponds to the back focal length as specified by the manufacturer) and checking the 3D Layout confirms that the beam after the lens is now collimated:



Diffraction grating

Next, we insert the diffraction grating into our system. With reference to the grating specifications, enter the following lines into the lens file:



Have a look at the Knowledgebase article "How to build a spectrometer – theory" for detailed information about diffraction gratings and how to implement them in OpticStudio.


Focusing unit

As discussed in the article mentioned in the previous paragraph, the focusing unit is the most delicate element in a spectrometer. Here we start with a simple approach and choose a single Thorlabs AC254-100-B lens having an effective focal length of 100 mm. Doing so enables us to check if the optical design holds and what aberrations occur. So, let’s add the space grating – focusing lens (60 mm), the lens and the space focusing lens – detector (97.1 mm corresponding to the back focal length of the lens) to our lens file:



In the 3D layout we can see that the beams are already well focused on the detector:



However, a check of the Matrix Spot Diagram reveals that the spot size is close to the diffraction limit (shown as Airy disk, black circles) at the centre wavelength (880 nm), but not for the peripheral wavelengths:



The aberrations we see here are related to the field curvature, i.e. the spots of the peripheral wavelengths have a shorter focal length than the central wavelength. There exists a couple of standard strategies to reduce field curvature. We select the following, together with some other design principles, for the focusing unit of the spectrometer:

  • We use off-the-shelf lenses since they are much cheaper and faster available than custom made lenses.
  • We use singlet instead of achromatic doublet lenses because singlet lenses are cheaper than doublets. We don’t need to correct for chromatic aberration, since the grating is splitting the colours. The different focal lengths of the colours will be accounted for by tilting the detector.
  • We use best form lenses. This type of lenses is optimised for focusing a collimated beam.
  • Instead of using one lens we split the optical power between two lenses. This measure yields two benefits: (1) Aberrations are reduced because the surface curvatures of the lenses is lower. (2) We introduce one more thickness in our system that can be set variable in the optimisation process.
  • We add a third, divergent lens after the convergent lenses to reduce the field curvature (field flattener lens).

Our improved design will look like this:



Note that the spaces between the lenses have been chosen arbitrarily. The lenses were selected so that their EFL is close to the 125 mm we need to illuminate the sensor entirely. We will see in the next section how to efficiently compute the EFL of the focusing unit.



Before optimising our system, we need to decide which parameters can be set variable. In our case we set all spaces between the lenses variable, as well as the space fibre – collimating lens. Moreover, we insert a coordinate break in front of the detector to make it tiltable, as announced in the previous section. So, we get the final shape of our lens file:



Once the variables are set, we can start optimising our design. We will do that in two steps: First find the global optimum using OpticStudio’s Global Search feature and then squeeze the most out of the design by hammering it.


Global search optimisation

The crucial part in the optimisation process is the Merit Function which needs to be adapted to the design, the optimisation goal and to the optimisation method. Download the attached Merit Function MF_for_global_optimisation.MF, save it in the folder Zemax\MeritFunction and open it in OpticStudio’s Merit Function Editor:



The lines in the Merit Function have the following effect:

  • Lines 2 to 11: Define the upper (FTLT) and lower (FTGT) boundary of the spaces between the lenses and of the position of the entrance pinhole. The weight of the operands is chosen so that the lenses cannot overlap (lines 6, 8, and 10) and that the position of the fibre won’t run away (lines 2 and 3). The maximum boundary of the space grating – lens 1 is introduced to avoid vignetting of the peripheral wavelengths.
  • Lines 12 to 13: Define the upper (PMLT) and lower (PMGT) boundary of the tilt angle of the detector.
  • Lines 15 to 19: Calculates (REAY, DIFF) and sets (ABGT, ABLT) the boundaries for the detector width. The weight is set so that the detector is not over-illuminated.
  • Line 21: Calculates the EFL of the focusing unit. This operand is not used in the optimisation process (weight 0) and is only there to monitor the EFL of the focusing unit.
  • Lines 22 and following lines: Optimise for minimal spot size. These lines are generated efficiently and automatically with the optimisation wizard as illustrated in the picture above.

Clicking Optimize...Global Search will open the Global Optimisation window, and starting the optimisation will find the global optimum of our system after only a few seconds:



The spot size at all three wavelengths is now already close to the diffraction limit:



Hammer optimisation

The next and final step is to optimise the resulting solution by hammering it. Doing so calls for a modification in our Merit Function, since we are now touching the diffraction limit of our system. We will no longer optimise for rays, but for diffraction limited enclosed energy. This goal is achieved by deleting the lines 22 and larger in our Merit Function and by replacing them with the following three operands:



The DENC operand is configured so that it optimises for maximum energy in y direction with reference to the centroid of the three wavelengths, respectively. After some minutes of hammering (Optimize...Global Optimizers...Hammer Current) OpticStudio will find a solution which looks worse in terms of ray optimisation:



But if we check the Fraction of Enclosed Energy (Analyze...Image Quality...Enclosed Energy...Diffraction) we notice that we are already close to the diffraction limit of our system:



Remember that we have a detector with a pixel width of 10 µm. It is thus important to monitor the fraction of enclosed energy at a distance of 5 µm in y-direction from the centroid, and we can see that we are only some percent below of what can be achieved with respect to the diffraction limit.

The hammer optimisation could be run longer and be followed by a local optimisation to find an even better result, but what we have achieved so far is a very good solution. The diffraction limited spot size is in the order of the pixel size (9.3 µm with respect to 10 µm) and the detector is almost completely illuminated (18.5 mm of 20.5 mm) while the encircled energy is close to the diffraction limit.


Spectral resolution

It has already been discussed in the Knowledgebase article “How to build a spectrometer - theory” how to define and calculate the resolution of a spectrometer. Here we extend the discussion towards the limitations imposed by diffraction and by the pixel size of the detector being a line camera. The discussion relies mostly on the Knowledgebase article “Resolution of diffraction-limited imaging systems using the point spread function”.


Diffraction limited resolution

The Rayleigh criterion states that the images of two point sources can be discriminated if the distance between them is not smaller than the Airy disk radius (9.3 µm at 880 nm in our case). In a spectrometer, however, we do not resolve points in the object plane, but wavelengths. So, with the illuminated detector width of 18.5 mm we may resolve approx. 2000 wavelengths in our spectrometer. Given the bandwidth of the spectrometer (50 nm) we get a diffraction limited resolution of 25 pm.

Let’s check with OpticStudio if this calculation holds. First, we adapt the wavelength settings to have only two wavelengths differing by 25 pm:



Then we click on Analyze…Huygens PSF Cross Section. As we can see in the appearing plot, the point spread functions (PSF) of the two wavelengths are close to each other, but they can still be identified as two peaks at 0 µm and approx. -9 µm, respectively:



So, with this analysis, we can confirm that the diffraction limited resolution of our spectrometer is 25 pm.


Pixel limited resolution

Another factor limiting the spectrometer resolution is the pixel width when the spectrum is sampled with the line camera. OpticStudio offers a very convenient way to check this behaviour in the Huygens PSF Cross Section plot: Setting the Image Delta to 10 will average the signal over a width of 10 µm, which is the width of the camera’s pixels. As you can see, the two peaks are no longer distinguishable:



Here, another consideration comes into play: The Nyquist-Shannon sampling theorem claims that at least two sampling points are needed to resolve the Airy disk radius. So, to resolve two PSF on the line camera, their distance must be at least 20 µm (twice the pixel width of 10 µm). This distance, in turn, corresponds to a spectral resolution of 50 pm.

You may verify this result by changing the second system wavelength to 0.880050 µm and see that the peaks are then again distinguishable in the Huygens PSF Cross Section plot. We can hence conclude that the pixel limited resolution of our spectrometer is 50 pm.

So, in the end, the resolution of our spectrometer is limited by the pixel size of the line camera and not by diffraction. It would be nice to replace the line camera with another one having 4000 pixels of 5 µm width to fully sample the diffraction limited spots. Unfortunately, such a camera is not available. Another way would be to allow larger diffraction limited spot sizes in the spectrometer. But then the detector would be over illuminated, and we would lose a part of the spectrometer’s bandwidth.



Previous Article: How to build a spectrometer - theory

Next Article: How to build a spectrometer – tolerancing


Was this article helpful?
2 out of 2 found this helpful



Article is closed for comments.