Adjustable open source spectrometer

Key Achievements

✔ Built first iGEM spectrometer ever
✔ Validated minimal spectral resolution of 4.1 nm
✔ Low price 250/340$


Spectrometers are important tools in every lab and educational facility. Their application is quite diverse. From astronomy where spectral emission lines of distant galaxies are measured to industrial applications like the fine tuning of LCD displays, these devices are needed everywhere. When we looked for a spectrometer for our localized plasmon resonance sensing device, we either had the choice of using an expensive commercial $5000 spectrometer or building one on our own. We found many diy photometers but not a lot of diy spectrometers. Photometers are far easier to built compared to a spectrometer, since only one specific wavelength is measured. This specificity though, does make them not as versatile as spectrometers. For a lot of applications like LSPR only spectrometers are applicable. So we decided to built one on our own. We designed Merlin, our spectrometer, in a way that it can be used for other applications, not just LSPR sensing.

billy murray1
Figure 1: Front view of Merlin

At first, we reviewed already available spectrometers. We started looking into publications on cheap spectrometers[1]. The biggest problem with these is that they do not give actual construction data and are only result orientated. So we concentrated on open source diy designs. The ramanPi spectrometer caught our eye[2] and we based our design on it. The greatest advantage is, that it was developed open source with a detailed construction documentation.
On the other hand, the ramanPi spectrometer project was never finished and validated. Also, the design lacks adjustability for the optics that need focussing. This is the most important part of a spectrometer, because every small deviation of the optical components from their optimal position results in a drastic reduction of the spectral resolution.
To solve this problems, we changed and optimized the original design in the following ways:
- changed the position of the diffraction grating to put focus on the 600 nm wavelength
- added adjustable mounts for the slit and CCD Array for focussing
- changed the setup from a commercial $100 slit to a $5 razor blade magnet slit
- added holder to mount other probes like cuvettes


The spectrometer is based on the Czerny-Turner configuration (see figure 2). It features a slit, a collimating mirror, a diffraction grating, a focusing mirror and a charge-coupled device (CCD) sensor. The CCD sensor sits on top of a small printed circuit board (PCB), that reduces noise levels and is connected to a Nucleo microcontroller. The Nucleo can then either be connected to a computer or a Rasberry Pi with a small touchscreen for a graphical output. The firmware and the graphical user-interface is developed in the open source project TCD1304 by Esben Rossel[3].
The Czerny-Turner setup is also used in commercial products, like the Ocean Optics HR4000. These devices start at around $4000[4] and contain basically the same components as this diy version[5]. Companies offer their devices at such a high price, because they have mastered the alignment of these optics. The material cost of these is only a fraction of the price.

billy murray1
Figure 2: Czerny-Turner setup of spectrometer


The output out of the python tool, that you can run on windows or linux, gives out on the x-axis the pixel number and on the y-axis the voltage in mV. If photons hit the CCD sensor, the voltage drops. Therefore an increase in intensity leads to a voltage drop in the graph - the signal is inverted (see figure 4).

Formula calibration

To get from output in pixel to output in wavelength, a third order polynom is used. p is the pixelnumver, S is the wavelength at pixel 0 and Ax are the different polynomial coefficients. A program capable of solving third order linear regression (like Excel) and a light source with at least four peaks is needed. A common fluorescent lamp also used in the chapter on spectral resolution can be used.
Apart from calibrating the spectrometer, a tuning on the integration time is needed each time a new light source is measured. The integration time sets the time that the electronic shutter stays open. If the light source is weak, a longer integration time needs to be set. More information on this can be found on the TCD1304 page.

Spectral Resolution

To benchmark a spectrometer to a known spectrum of a light source with close peaks is needed. We used a common commercial fluorescent lamp, as these have distinct emission lines from the flourescent of certain elements. At first we measured the lamps spectrum with a calibrated commercial spectrometer (Ocean Optics HR4000). The measured spectrum can be seen in figure 3. Two distinct spectral lines are marked. 1 is the emission line of terbium Tb3+, 2 of mercury. Terbiums emmision line is at 541.72 nm, mercurys at 545.86. This results in a difference of 4.14 nm. Other sources confirm this value[5]

billy murray1
Figure 3: Spectrum fluorescent lamp - commercial spetrometer

We then used our diy spectrometer and measured the spectra of the same lamp. The result can be seen in figure 4. The two spectral lines of mercury and terbium Tb3+ can be differentiated. Hence, the spectrometer has a spectral resolution of 4.14 nm. The data is more noisy than the commercial spectrometer. This can be explained, due to a couple of factors. Firstly, there is damage on the collimating mirror, that was caused during assembly. Secondly, the slit width is by far greater than that of the commercial spectrometer. This increases noise as well. Thirdly, even though the optics are adjustable, they are probably not up to 0.1 mm perfectly aligned. Also, both peaks in the spectrum taken with our spectrometer have around the same peak, while with the professional spectrometer the peaks have different heigths. This happened as the measurement with the professional spectrometer was taken quite shortly after turning it on. The flourescent lamp's spectrum takes some time to reach a stable spectrum and is also dependent on environment variables like temperature.

billy murray1
Figure 4: Spectrum fluorescent lamp - diy spectrometer


The detailed information on how to build and align the spectrometer can be found in the construction manual. The CAD files in stl format in a zip are supplied as well. The materials needed are quite cheap and always available.

spreadsheet with all components and cost
Figure 5: List of components
spreadsheet with all components and cost
Figure 6: Overview different components


  1. Thomas C. Wilkes, Andrew J. S. McGonigle, Jon R. Willmott, Tom D. Pering, and Joseph M. Cook, "Low-cost 3D printed 1nm resolution smartphone sensor-based spectrometer: instrument design and application in ultraviolet spectroscopy," Opt. Lett. 42, 4323-4326 (2017)
  3. The firmware and python tool is developed by Esben Rossel
  4. Taken from this pricelist
  5. Ocean Optics, "HR4000 and HR4000CG-UV-NIR Series Spectrometers Installation and Operation Manual", page 23 figure