Introduction: A Homemade Webcam-spectrometer for Emission and Absorption Spectra


Spectroscopy plays a very important role in physics, chemistry and astronomy. A spectroscope usually splits (visible) light into its components. We all know the colors of a rainbow. This is because the drops of water split the sunlight. Light of different colors is broken differently. Thus, blue light is usually more refracted (distracted) than red. Instead of the water drop you can use a prism. But even an optical grating splits the individual wavelengths of light. In the case of the grating this is due to the so-called diffraction. Here, red light is more diffracted than blue.

Step 1: Parts

The following parts are required for the webcam spectroscope:

  • a webcam with a high resolution (f.e. I use the logitech quickcam pro 9000 with 1600 x 1200 pixel)
  • a zoom lens for the webcam (ebay)
  • a diffraction grating with 1000 lines / mm (ebay)
  • a lens with f = 10 cm as a collimator
  • 2 razor blades and a smaller plate made of aluminum for the gap
  • the software Theremino (Theremino) or ImageJ (ImageJ) for evaluation
  • Wood for the housing

The structure is actually very simple. On the front of the case a relatively narrow gap is created with the 2 razor blades. The narrower it is, the sharper the spectrum becomes. But then it gets darker too. Therefore you have to find a compromise between sharpness and brightness. At a distance of the focal length of the lens (e.g., 10 cm), the collimator is mounted behind the gap. It ensures that parallel light rays hit the grid and that as much light as possible from the gap is used. The diffraction grating is now positioned behind the collimator. To see where to mount the webcam now, it's best to light the gap with a flashlight and see where the maximum of the 1st order is. With the zoom lens not only a sharp image of the gap is generated, but also set the desired magnification. Namely, the entire visible spectrum up to the infrared range (from 390nm to about 800nm) will be displayed. This requires some adjustment work. It is best if the webcam is already connected to the computer for this adjustment and the generated diffraction image is checked live.

Step 2: Calibration and Resolution With Emission Spectra

If you have found a suitable setting of the zoom lens, the spectrograph must still be calibrated using a laser pointer. I always use 3 laser pointers in the colors blue (λ = 405nm), green (λ = 532nm) and red (λ = 650nm). Using the webcam software, one image is taken and loaded into ImageJ.

Then you create a line profile (plot profile) and look at which pixel is the intensity maximum. This is repeated with the other two laser pointers. Now you have 3 pixel values, which you can assign a wavelength λ. Then you have to match a suitable straight line to the 3 points. Its slope k now indicates the resolution of your spectrograph in nm / pixel. In my case, this value was 0.19 nm / pixel. The lower wavelength limit, which can still be detected, now corresponds to the d of the straight line. In my case 401.6 nm. So if you have set up the linear equation λ = k * pixel + d, you can assign a wavelength to each pixel. Since my webcam has a resolution of 1600 pixels, the upper detectable limit is 0.19 * 1600 + 401.6 = 707 nm. Of course, this depends on the specific settings (zoom, webcam).

If you use the software Theremino, you can calibrate the spectrum best with the help of an energy saving lamp. To do this, place the lamp directly in front of the gap and look at the computer generated spectrum. Now if you know the wavelengths of the prominent lines, you can shift the wavelength scale until the best possible match exists. The wavelength range recorded with Theremino would actually have to match that determined by ImageJ. In my case, these were [401,707] nm. The advantage of Theremino is that one directly obtains the colored spectrum as a function of the wavelength. If you use ImageJ, you first have to create a line profile and then edit it in Excel using the familiar linear equation. The advantage, however, is that one obtains the higher-resolution raw values and thus, e.g. the actual resolving power of the spectroscope can be determined or absorption spectra can be calculated with two raw spectrum-data.

In my case, I was able to separate the two emission lines of the energy-saving lamp at λ = 577 nm and 579 nm without any problems.

I've made another, more challenging test for my spectroscope using a sodium low pressure lamp. The emission spectrum just consists of two orange spectral lines, which are very close together. One at 589.0 nm and the other at 589.6 nm. As you can see in the pictures, my spectroscope is not able to clearly separate those two lines. So the resolution is lower than 0.6 nm.

Step 3: Absorption Spectra

For an absorption spectrum of liquids or filters you need 2 shots. Once you take the spectrum only with water or without a filter and then with the liquid to be examined or with a filter. After that, divide the second brightness values by the first and multiply this result by 100. In this way one obtains the wavelength-dependent transmission or absorption in percent between 0 and 100%.

I've done this with chlorophyll and a color-filter from Rosco...

Step 4: Conclusion

With this spectroscope, it is thus possible to examine wonderfully different light sources (for example monochromatic lasers, energy-saving lamps or LEDs) or to produce absorption spectra of liquids or filters. This can be done for example in your physics- or chemistry- lessons.

I would be delighted if one or the other also tinkers a spectroscope for teaching or private purposes.

Here on my youtube channel (youtube-channel) you can find more physics projects.

more physics projects:

In this sense, much success and Eureka.

STEM Contest

Participated in the
STEM Contest