Published: 2018-03-24 | Categories: [»] Engineeringand[»] Optics.

In today’s post I will be revisiting the former spectrometer designs that I posted a while ago to cover the complete design and assembly of a 400 nm to 800 nm spectrometer. The resolution of the spectrometer presented here was tested to be better than 2 nm at 640 nm over the whole field of view and uses a sensor that is sensitive to the photon levels at low costs. The complete spectrometer is given in Figure 1 can be assembled for a bit less than 1400€ (VAT-excluded).

Figure 1 – Photography of the spectrometer

The overall spectrometer design is not so complex and is schematized in Figure 2. It consists of a fiber input (or a slit) placed at the focal position of a collimating lens, a 300 lines/mm blazed grating, an imaging lens and a CMOS sensor. It is worth mentioning that the design was fashioned around a 4-f system to reduce [»] optical aberrations. That is, the distance between the lenses and the grating are also equal to the focal lengths. Please note that the grating acts as the optical stop of the system.

Figure 2 – Spectrometer schematic

In the following sections I will first cover the theoretical design of the spectrometer presented here before moving to its assembly (including the base plate layout and 3D models) and the experimental results obtained with it.

Spectrometer Design

To design spectrometers, there are a few equations that you can use. However, I have noticed that in practice you are often limited by the availability of the off-the-shelve components. For instance, gratings are available in ½”, 1” and 2” sizes only and with groove frequencies of (typically) 300, 600, 1200 and 1800 l/mm when working with first-order blazed grating. For the lenses, you usually have more flexibility although the ½”, 1” and 2” diameters are also fairly common. The choice of detector is also relatively scarce and is usually driven by either a sensitivity issue. While commercial spectrometer often uses linear CCD arrays, I like to work with monochrome cameras such as the FLIR BFLY-PGE-31S4M-C used here. Each pixel of this camera is sensitive to a limit of 4 photons over 1 seconds (although FLIR says the camera shutter time can be extended to 11 seconds I still have not found how to activate this feature on my camera).

Because the detector is to me the limiting factor, what I now advice is to start from the detector size, waveband range and resolution. Here I will be using an IMX256 sensor with 1280 pixels of 3.45 µm which makes a total length of 4.4 mm. The wavelength span of our spectrometer is 400 nm (400 nm to 800 nm). A quick approximation to the required input slit width (or fiber core) is that the wavelength span must be divided by individual copies of the input slit (or fiber core) with steps given by the required resolution:

To achieve a 400 nm span with a 1 nm resolution on a 4.4 mm sensor, the slit width must be about 10 µm.

Please note that the wavelength range will be limited by the order overlaps of the grating. So there will always be the relation

The only way to overcome this restriction is by implementing order sorting which falls beyond the scope of this post. The only thing that you have to remember is that, for the current spectrometer design, you will be limited to the range 400…800 nm (or 350…700 nm if you prefer that range, or even 450…900 nm and so on). To prevent light below 400 nm from perturbating the measurement, a 400 nm long-pass filter has to be used.

It is also important to select a wavelength range in which your optical system will be compliant. For instance, here I am using Thorlabs lenses which are designed to be operated between 400 and 700 nm. Outside of this range the focal shift of the doublet will increase and the aberrations will start to deteriorate the resolution of the spectrometer. Thorlabs offers lenses optimized in the 650 to 1050 nm region as well as the 1050 to 1700 nm region. Since our detector is sensitive only to 350 nm to about 1050 nm, I would disregard the latter solution and uses the two former for visible and NIR spectrometers. To cover different ranges, it is possible to design custom optics (expensive…) or to use off-axis parabolic mirrors. I will leave this last option for a future post.

Once you have identified your working element size, you select either a fiber solution or a slit. When using a fiber, the numerical aperture of your system will be fixed by the numerical aperture of the fiber. Indeed, working with a larger NA for your system will just make it more expensive for no reasons and making the NA of your system smaller will make you lose photons and potentially have more straylight issues. If you use a slit, then you are free to select your working NA. However, remember that for efficiency reason you will always want to use the largest NA possible. Obviously, to get a performant system you will also need a more complex optical design to cope with the aberrations as we have seen [»] previously.

Once you have set your numerical aperture, the focal length of your lenses will be given by their outer diameter. Here the 10 µm fiber has a NA of 0.10 which would make a focal length for 1” optics with 90% clear aperture of

However, I decided to design the system for a NA of 0.22 because I have other projects were I only need about 5 nm accuracy and were a 50 µm fiber with 0.22 NA would suits better. Please note that the 50 µm 0.22 NA fiber can couple 121 times more light than the 10 µm 0.10 NA one!

I therefore set the focal length to 50 mm. The system can still work with the 10 µm fiber to achieve the ~1 nm resolution but it just does not fill the pupil of the system completely. That is not an issue at all, it just makes the system uses 1” optics whereas ½” could have been enough for a 10 µm fiber.

Concerning the imaging side, most of the time you will use a factor 1 magnification which means that the imaging focal length will also be equal to 50 mm. Using a different magnification factor is possible but I have never found any practical cases where it gave added benefits.

Now that we have set the detector size and focal lengths, we can only play on the grating frequency and input/output angles to set the wavelengths at the proper position on the sensor. To choose the best parameters we will use the equation of the grating:

with λ the wavelength, G the grating period in mm/lines, θi the input angle, θo the output angle and m is the diffraction order.

What I like to do is to express θo as the input angle, θi, minus a deviation angle, δ, plus a small angle to code for the angle subtended by each pixel, β. The equation then becomes

as a function of the pixel position, x, with

with N the number of pixels, p the size of one pixel and fimaging the focal length of the imaging system.

Graphically speaking, δ is the angle between the axis of the collimating system and imaging system in Figure 2. It need to remain practical and I would recommend staying in the 40°…50° range for most setups and never going outside of the 30°…60° range. Concerning θi, I would advise staying below 35°.

You can solve the equations analytically but I have found Excel to be a very nice friend to play in real time with the settings. For instance, here is what Excel will plot for the current system with δ=40° and θi=25.5° using a 300 l/mm grating. The results are shown in Figure 3.

Figure 3 – Excel plot of the system with δ=40° and θi=25.5° and 300 l/mm grating

The dispersion of the spectrometer, s(x), (i.e. the wavelength change per pixel) can be found by deriving the expression of λ(x) either analytically or numerically:

And the resolution can be obtained by multiplying the dispersion, s(x), with the size of the image of the slit. This image size is both limited by the diffraction effects which change with the wavelength (Airy disk) and the optical aberrations which vary in the field of view and so the x position.

An approximation to the diffraction-limited performance of the spectrometer is obtained by considering that the image of the slit is the sum of the diffraction effect and the real dimension of the slit multiplied by the magnification ratio of the system (1 here):

with NA the numerical aperture of the imaging lens.

The expectation for the current system using a 10 µm slit are given in Figure 4.

Figure 4 – Excel plot of the expected resolution at diffraction limit

Please note that the resolution will ultimately be limited by the number of illuminated lines on the grating. So with a 300 lp/mm grating and a pupil of 10 mm (10 µm fiber), the maximum resolution will be 1/3000 of a wavelength (0.2 nm at 640 nm). In practice, imperfections in the grating manufacture will decrease this theoretical limit to 1/1000 or even less.

Finally, it is possible to estimate the efficiency of spectrometer in terms of light throughput. The lenses are the easiest elements as their transmission is usually available from the supplier. The camera quantum efficiency is more difficult to obtain but a typical, normalized, value is the one of silicon photodiodes. The grating efficiency is more difficult to estimate as it depends on many parameters but R. Casini and P.G. Nelson have proposed the following simplified (sic!) model that works relatively well for blazed grating under unpolarized light:

with θb the blaze angle and


I have found convenient to add this model to my Excel spreadsheet just to be sure that I am using the blazed grating in an optimized way. The plot for the current system is given in Figure 5.

Figure 5 – Efficiency of the blazed grating in the current design
Spectrometer Assembly

The optomechanical setup is shown annotated in Figure 5 and can be built under 1400€ (ex-VAT). It was designed for the parameters discussed in the previous section but can easily be extended to other ranges.

Figure 6 – Annotated opto-mechanical setup

The collimation system can be built using either a slit or a fiber, a 50 mm lens and a variable length tube. The length of the tube is adapted in front of an [»] autocollimator until the image of the slit is projected at infinity and appears sharp on the autocollimator camera. The imaging system is built in a similar way except that the threading of the variable length tube had to be shortened on a lathe to a remaining thread of about 7 mm. If you cannot machine the part yourself, you may contact Thorlabs directly and ask a quotation for a custom part (at higher costs…).

All the elements are placed on a custom base plate that you can either make yourself using a vertical column drill or a mill or you can also download a 3D model for SLS printing. I have not tested the 3D model yet but I designed it on the very same basis as the DIY layout so I’m 99.9% sure it will work. If you are using the 3D model, you will need to tap some holes using M4 helicoils. The 3D model link is given at the end of the post.

To make the part yourself you can also download the layout of Figure 6 at the end of the post. Simply print the pdf using 100% size (no scaling) option on adhesive paper and fix it on a 160×80×10 mm block of aluminium. I got mine from [∞] RC Machines. Drill the holes carefully at the selected positions using a vertical column drill or a mill. Do not attempt to drill by hand or you will screw up the alignment and waste your time. Tap all the 3.2 mm holes to M4 threading. To have a clean finish and reduce stray light, process the plate with coarse sandpaper and apply 2 layers of black matte paint. Finally, you will need to use some washers to get all the elements at the proper height. I have used 4 M6 washers below the CP06/M plates and 3 below the CP02B plates.

Figure 7 – Printed layout for drilling the holes

Once you have assembled the spectrometer, you will have to align the grating and calibrate the wavelength range.

Follow these instructions:

1/ Set the grating to a roughly horizontal position and secure it. Your eyes will be a good enough judgment here.

2/ Align the grating kinematic mount to roughly the correct (25°) angle.

3/ Using a halogen light as source, rotate the camera such that the dispersion direction becomes perfectly horizontal.

4/ Using a fluorescent light as source, rotate the slit tube until all the slits are perfectly vertical. If using a fiber, this step can be omitted.

5/ Still using the fluorescent light as source, turn the kinematic mount in tip and tilt until you have centred your wavelength range of interest into the field of view of the camera.

6/ Cover the spectrometer with blackened aluminium foil to prevent ambient light from entering into the setup.

7/ Use a neon light source to calibrate the wavelength response of your spectrometer.

Congratulations, your spectrometer is now ready to be used!

Experimental Results

The spectrometer has been tested using both a fluorescent lamp (Figure 7) and a neon lamp (Figure 8). A wavelength calibration was obtained from the Neon peaks using the [∞] astrosurf data. The pixel to wavelength relationship was found to be perfectly linear (R²=1) as predicted by our equations as shown in Figure 3. The span was a little bit smaller than expected with a range of 425 nm instead of the expected 455 nm. Nonetheless, it successfully covers the 400 to 800 nm region.

Figure 8 – Fluorescent lamp spectrum – 10 µm fiber
Figure 9 – Neon lamp spectrum – 10 µm fiber

Although it is difficult to measure the actual resolution of the spectrometer as plotted in Figure 4, it is possible to estimate an upper bound using the neon spectrum in Figure 8. Indeed, several peaks of the neon spectrum are relatively close such as the one at 638.3 nm and 640.2 nm which are distant by 1.9 nm only. These lines are clearly resolved in the nominal configuration (the one that was used to generate Figure 8), so we can say that the resolution is better than 2 nm at 640 nm.

One of the factor that can limit resolution is the aberrations which are known to change in the field of view as we go from the centre of the field to its edge. To measure the effect of aberrations on the resolution, the grating was tilted such as to move the two lines near 640 nm at different location in the field of view. The results are shown in Figure 9. The lines are clearly resolved in all parts of the field of view and we can therefore say that aberrations are unlikely to affect the <2 nm resolution measured previously.

Figure 10 – Resolution of the neon lines at different locations inside the field of view

The other factor that can affect resolution is the colour of the light. To have an insight in how colour affects resolution, the spectrum of the fluorescent lamp can be used (Figure 7). The only difficulty here is that the lines are more distant. For instance, the two green lines of terbium and mercury are located at 542.4 nm and 546.5 nm and are distant by 4 nm. They are correctly resolved as we could have expected. We also have several lines at 577.7 nm and 580.2 nm for instance (distant by 2.5 nm) which are also correctly resolved. It is however difficult to tell more from this spectrum and different light sources should be tested for resolution.


To reproduce the optical bench, please download the [∞] layout file and print it on adhesive paper. All the 3.2 mm holes shall be tapped to M4. Once all the holes have been drilled/tapped, prepare the surface by first sanding it with coarse grain and degrease it properly. Apply a thick layer of matte black paint to reduce stray light.

If you do not have the possibility to build the optical bench yourself, you can download a [∞] 3D model. Print the model in black using SLS printing technology (FDM is not recommended). All the holes of the layout file that were 3.2 mm are here 4.3 mm and should be tapped to fit M4 helicoils. Please pay attention to the orientation of the helicoils before placing them.

[⇈] Top of Page

You may also like:

[»] Dynamic Range Analysis of a 350-700nm Spectrometer

[»] Raman Imaging Lens Upgrade

[»] High-Resolution Spectroscopy

[»] Resolution in Spectroscopy

[»] 400-800 nm Spectrometer Performances