Translator Disclaimer
8 October 2015 Measuring and teaching light spectrum using Tracker as a spectrometer
Author Affiliations +
Proceedings Volume 9793, Education and Training in Optics and Photonics: ETOP 2015; 97931L (2015)
Event: Education and Training in Optics and Photonics: ETOP 2015, 2015, Bordeaux, France
In this work we present a simple and low cost setup that allows obtaining the light spectra and measuring the wavelength of its features. It is based on a cheap transmission diffraction grating, an ordinary digital camera and using Tracker software to increase measuring accuracy. This equipment can easily be found in most schools. The experimental setup is easy to implement (the typical setup for a pocket spectroscope) replacing the eye with the camera. The calibration is done using a light source with a well-known spectrum. The acquired images are analyzed with Tracker (freeware software frequently used for motion studies). With this system, we have analyzed several light sources. As an example, the analysis of the spectra obtained with compact fluorescent lamp allowed to recognize the spectrum of mercury in the lamp, as expected. This spectral analysis is therefore useful in schools, among other topics, to enable the recognition of chemical elements through spectroscopy, and to alert students to the different spectra of illuminating light sources used in houses and public places.



As teachers, we know how students are fascinated by optics and optical phenomena. The spectra of a light source allow us to know many characteristics of that source. Students use some simple spectrometers to see the different color components of white light, learn the theory of the light emission and observe the emission spectrum of some chemical elements.

Nowadays it is relatively easy to produce a spectroscope and watch the light spectrum of sunlight (the rainbow colors) or of artificial light. There are lots of optical prisms and diffraction gratings in the market, at a low-cost price that can disperse the white light into its components. However spectrometers are usually expensive.

In this work we show how to build a low-cost spectrometer with a reasonable measuring accuracy, using affordable components (commercial diffraction grating), a digital camera and the free software video analyzer Tracker.



The theory of light diffraction from a grating is a very well explained phenomenon in every book of general Physics1,2.

Figure 1 shows parallel light rays crossing a diffraction grating and hitting to a target. If d is the spacing between centers of adjacent rulings (grating spacing), D is the distance between the grating and the target, big enough to consider the two rays converging to the target parallels and x is the distance from point P to the central point O at the target plane, then the condition of (first) constructive interference at point P is:


Figure 1:

Scheme of the interference of light on a target, after crossing a diffraction grating.


Where θ = tan-1 (x/D) and λ is the wavelength of light.

Therefore, the value x for each wavelength of light is simply given by the relation


In most textbooks, this equation is simplified assuming x<<D, as:


Every time a polychromatic light is diffracted, the different colors (different wavelengths) hit the target at different positions x (or different angles θ). The accuracy to distinguish each color depends on resolving power of the system. This depends on the dispersion of the grating and on the spot size at P (usually a focusing system is used to reduce this spot). Including the spot size dependency on lens size and wavelength, the accuracy ends up to be directly proportional to the number N of rulings in the diffraction grating3. The accuracy of the spectrum lines obtained depends also on the slit width used to produce a narrow source of light.

In this work the target will be a photograph camera so the parallel light rays coming from the diffraction grating are focused by a converging lens, assuring we are under Fraunhofer conditions. Thus the distance D can be considered as infinite. Point O is always the position of slit image (zero-order).



About Tracker and wavelength measurement

Tracker is a video analyzer and modelling software created by Douglas Brown4,5 (Brown, 2008; Brown & Cox, 2009) and is a project of the Open Source Physics6. This software is frequently used for motion studies in mechanics, but also optics as recently reported7.

Tracker software has a tool called Line Profile that allows users to measure the intensity of the image pixels along a straight line with length defined by the user. One can increase the line width changing the spread value; image pixels above and below the line are averaged in order to reduce noise and/or increase sensitivity. So we can detect the maximum and minimum intensity of light along a line in an image and the distance between them, in pixels or, after calibration, in meters. This means that we can use this tool to identify the peak of intensity of each color line in a light spectrum, with more accuracy than the human eyes!

Spectrometer construction

The spectroscope can be built using a commercial transmission diffraction grating (the typical setup for a pocket spectroscope), replacing the eye with the camera (figure 2). The most simple is placing a grating in front of the camera lens (with some adhesive tape), and then make a thin slit to put it in front of the source light in order to create a thin line spectrum. In our case we used two razor blades close to each other. This setup usually requires a darkened room.

Figure 2.

Experimental setup. C - digital camera; TG - transmission grating; S - screen; SL - spectral lamp; A - aperture.


The slit aperture must be narrow enough to resolve the spectral lines detected by the camera. The width of the lines is important in determining the correct wavelength of each line.

The positions of the colors on the screen, as seen from the camera, correspond to the different wavelengths within the light beam. These wavelengths can be computed using Tracker tools, after calibration of the device (shown in the following). The transmission grating needs to be chosen according to the camera lens: a high number of lines/mm increases the spectral resolution, but it also increases the diffracting angle which can be a problem if the spectral lines go out of the optical field of view.

The novelty in our work is that with very simple, common and affordable materials such as a camera and a diffraction grating, we can build a spectrometer with very good resolution (accuracy of about 2 nm/pixel in our case, but it depends on the quality of the image). This can be calibrated using only a well-known light source.

So far we have considered the ideal situation when all spectral lines are aligned in the plane of the screen. However this may not be entirely true because of the lens distortion.

Spectrometer calibration

The calibration is done using a light source with a well-known spectrum (a sodium lamp or an economizer lamp).

The calibration must be done before measuring the spectra of any light source, because it depends on the experimental conditions of the setup – usually a simple shot with a calibrating light is enough.

In schools, teachers can also use any available spectral lights from sodium or Helium lamps, but we do not recommend Hydrogen lamp due to the complex spectrum of H2. Teachers can also use other available light sources, such as a commercial He-Ne laser. We recommend not pointing the laser directly to the camera lens because this can damage the camera CCD; instead point it to a white background (e.g. a white sheet of paper) behind the slit.

After capturing an image of the laser spectrum, Tracker can be used to calibrate the image dimensions as described in Rodrigues & Carvalho7.

Experimental measurements

The first thing to implement is the experimental setup. We can place the camera with the grating in front of the aperture from which light comes from the spectral lamp, as represented in figure 2. The relative positions of the camera and screen must not move along all the experiment (otherwise, calibration must be restarted). Using the opaque tube setup we avoid this problem. Photo resolution must also be fixed for all the photos.

We then need to control the light intensity coming into the camera and the shutter speed: high light intensity creates bright spectral lines but can blur the spectra; however with very low light intensity, some lines can become “masked” in darkness. Therefore some photos must be taken in order to identify the best experimental shooting conditions and the spectral lines. The photos can be taken in normal room light or in a dark room for more beautiful spectrum photos. The more dark the image background the more visible are the intensity peaks of the spectrum lines.

Starting with the simplest spectra, the Sodium, the yellow spectral line (which, in fact, are two) at 590 nm corresponds in figure 3 to an average displacement x from the central line of about 330.4 pixels. The average displacement was used to minimize the misalignment between the camera, the grating and the plane of the slit. From equation (2), we can calculate the effective distance D in pixels, which will be fixed for the whole experiment and corresponds to our most important calibration parameter.

Figure 3.

Plot of Tracker main view showing the central and the yellow spectral lines of Sodium, and the corresponding light profiles. In the photo (left side), the distance is measured in pixels; in the plot (right side), the distance is converted to wavelength via equation (2).


The conversion from pixels to wavelength can be done using an Excel sheet, but in a more easy way it can be done with Tracker, using equation (2) in the Data Builder tool. This way allows students to analyze spectrum light directly in the Tracker’s plot as shown in figure 3.

Tests of this setup were made with Mercury, Helium and economizer lamps, with a grating of 530 lines/mm (distance between rulings, d = 1/530 mm).

The maxima for each spectrum were measured by Tracker’s measuring tool Line Profile.

The average distances from the central line to each line of the first constructive interference pattern in all lamps are presented in Table 1, together with the corresponding values referred in literature.

Table 1:

Wavelengths of spectral lines of helium and mercury bulbs, after calibration with the sodium lamp. The accuracy is about 2 nm. The experimental values are compared with those found in literature.

ColourExperimental (nm)Literature Values (nm)Error (%)
Heliumblue453447 81.3
green506502 80.8
yellow588588 80.0
red664668 80.6
Mercuryblue441436 91.1
green548546 90.4
yellow580579 90.2
economizerblue/violet442436 (Hg)91.4
light blue492
green547546 (Hg)90.2
yellow587579 (Hg)91.4

Results above confirm that the major Mercury lines are easily identified on its spectrum. Therefore we can use commercial economizer lamps to calibrate the low-cost spectrometer.



The main idea for the development of this setup is to provide an easy and low-cost experiment for teaching light spectra in schools and universities. If a school cannot afford a reference spectral lamp such as sodium or mercury, teachers can improvise with an economizer lamp.

Our spectrometer, because of its simplicity, can be used to introduce the study of diffraction phenomena and spectra. There are many ways to implement this setup inside and outside schools. The teachers can take some spectrum photos and give them to students for the analysis. We recommend that students, individually or in groups, make their own photos after some planning with teacher’s help, improving student’s engage and providing a more effective learning.

The advantage of this setup is to provide an instrument that anyone can build and use everywhere, to study spectrum light and simultaneously learn how a spectrometer works.

Teachers can apply this setup as school project, homework, laboratory activities and at classroom to teach about spectrum and/or diffraction phenomenon.


This work is partially financed by the FCT – Fundação para a Ciência e a Tecnologia (Portuguese Foundation for Science and Technology) within projects UID/NAN/50024/2013 and UID/EEA/50014/2013.



Young, H. D., Freedman, R. A., [University Physics] (9th edition), Addison-Wesley Publishing Co., New York, 1176–1179 (1996).Google Scholar


Serway, R. A., Beichner, R. J., [Physics for Scientists and Engineers with Modern Physics] (5th edition), Saunders College Publishing, Philadelphia, 1224–1227 (2000).Google Scholar


Hecht, E., [Optics] (2th edition), Addison-Wesley Publishing Co., New York, 424–428 (1987).Google Scholar


Brown, D., “Video Modeling: Combining Dynamic Model Simulations with Traditional Video Analysis”, American Association of Physics Teachers (AAPT) Summer Meeting, Edmonton <> (5 April 2015) (2008).Google Scholar


Brown, D., Cox, A.J., “Innovative Uses of Video Analysis”, The Physics Teacher, 47, 145–150, (2009). Scholar


Open Source Physics Collection on ComPADRE <> (5 April 2015) (2011).Google Scholar


Rodrigues, M., Carvalho, P.S., “Teaching optical phenomena with Tracker”, Physics Education, 49(6), 671–677, (2014). Scholar


Hyperphysics, “Atomic Spectra Helium”, <> (5 April 2015).Google Scholar


Hyperphysics, “Atomic Spectra Mercury”, <> (5 April 2015).Google Scholar

© (2015) COPYRIGHT Society of Photo-Optical Instrumentation Engineers (SPIE). Downloading of the abstract is permitted for personal use only.
M. Rodrigues, M. B. Marques, and P. Simeão Carvalho "Measuring and teaching light spectrum using Tracker as a spectrometer", Proc. SPIE 9793, Education and Training in Optics and Photonics: ETOP 2015, 97931L (8 October 2015);

Back to Top