Building a (fast) low resolution light spectrometer


Despite the limitations that a low resolution light spectrometer
has (like the inability to detect the atmosphere absortion bands),
it still can be useful to investigate the light spectrum from
multiple light sources, like the Sun, the Moon, LEDs and mercury lamps.


The output of a light spectrometer is a wavelength dependent light intensity, to archive this the light to be analysed has to be separated into its constituent wavelength. This separation can be done with a prism or by grating, on this post we will use the second. The working principle can be find here.


– Support box – this will provide the support for the webcam, grating and slit, ensuring that all of them have the proper alignment.


The main requirements of this box are that the grating support makes a 60 ° angle with the horizontal (we also tried 45 °, but the results were not better) and ensure that the camera always fit exactly on the same place.

– Slit – the slit is in a panel that should fit on the open face of the “box”. It should be very narrow for better resolution of the spectrometer, however the resolution is limited by other factors in this case making less important the width of the slit. We tested with multiple slit widths 0.8mm worked well, less narrow slit adds sensibility to the spectrometer.


– Filter – this setup is missing a collimator mirror, this requires that the light being analysed  is already collimated. The sunlight is nearly collimated and can be analysed directly, but other point light sources need some kid of correction. Failing to apply collimated light will create too many reflections on the grating with disappointing results.

Filter, 3D printed with transparent PLA

The 3D printed filter is not great, but it is better than no filter.

– Grating – the grating is a surface with very closely spaced holes, this  is not easy to fabricate at home, but an old CD would do, you can also buy a grating on ebay.s_20150809_233101

– Webcam

We used a very cheap webcam (costed ~ 10CHF), a better camera would be a major improvement, this camera has the advange of being very small but has only 0.3 MPixel.



All the parts together

Glue a small piece of CD into the grating support, making sure that all the support is covered.


Fit the silt panel in the open face of the box.


Finally out the camera and the filter in place.


And the hardware is ready!

The Software

Just a quick python script, using OpenCV for webcam image manipulation and matplotlib for plotting. You can download it at the bottom of the page.

Grating Spectra up and running

The figure above shows the spectrum of a white led. As you can see the resolution is not great, the rainbow looks a bit blur. Despite the blur and aliasing, the spectrum is very clear. Also this spectrometer is very fast, we can analyse 20 spectrum per second!

Downloads: – Python software
box.scad – drawing files for 3D printing.


Leave a Reply

Your email address will not be published. Required fields are marked *