Turning A Webcam Into A Spectrometer

If you want to find out what something is made out of, you’ll probably be using a spectrometer. These devices allow scientists to determine what something is made of by shining light through an object and recording what colors are absorbed. Professional spectrometers cost many thousands of dollars, but you can build your own using a simple USB web cam, an old DVD-R, and a VHS cassette case.

In this tutorial of Public Labs’ DIY video spectrometer, [Jeffery] takes us through the process of building a spectrometer. After cutting a small bit of plastic from a DVD-R and mounting it on the lens of a web cam, [Jeff] puts the webcam in a VHS case and shines a light through a small slit. The result is a rainbow pattern captured by the webcam, and by putting different translucent materials in front of the light source, the spectrum slightly changes.

Of course a DIY spectrometer is nearly useless without a library of materials and their associated spectra. [Jeffery] is working on this as well with a wiki-style app called Spectral Workbench.

There’s a video tutorial for making your own DIY spectrometer available after the break. It seems like an easy build, if you can find the requisite VHS cassette case in your basement and/or attic.

[youtube=http://www.youtube.com/watch?v=IA5BTD-aelo&w=470]

22 thoughts on “Turning A Webcam Into A Spectrometer

  1. I was reading in make magazine about a service that allows you to upload your spectral image and get a result but I can’t seem to find the magazine right now. Does anybody know?

  2. I really like these kinds of projects, and this is mostly how scientists can tell that such and such galaxy thats billions of light years away is made up mostly of whatever element. But I digress,
    the next step in 3D printing might be a device that analyzes the components of objects and recreates their structures.

  3. The SpectralWorkbench.org website allows you to upload an image of spectral data. But it also connects directly to your webcam (or your mobile phone’s camera) via the HTML5 mediastream API in Chrome/Opera.

  4. Didn’t the old S*** T*** tricorders have spectrometers in them?

    *sigh* More old SciFi stuff that’s becoming everyday common stuff in our pockets. I’m not sure wither to rejoice or be saddened…

  5. While it is important to have a spectral library, it is also necessary to calibrate the spectrometer. Calibration comes in two forms; spectral calibration and radiometric calibration.

    Spectral calibration is required in order to know that each pixel represents a particular range of light wavelengths. This is usually performed by exposing the spectrometer to a light source with absorption and emission bands at known wavelengths, such as a neon gas lamp. Where these bands of absorption and emission fall on the detectors tells you what wavelengths each detector represents.

    Radiometric calibration is required in order to know the actual intensity of light falling on each detector according to the number value (counts) returned. Three factors that affect this are the spectral response of the detectors, the linearity of the detector outputs, and the spectral characteristics of the light source.

    The spectral response of the detectors indicates how they respond to light at different wavelengths. Given that most USB webcams use inexpensive silicon detectors, the response will not be the same for all wavelengths in the visible and infrared wavelengths. The peak will be around 600 nanometers and fall off with shorter and longer wavelengths. The same intensity of light at different wavelengths will yield different number values (counts) from the same detector.

    The linearity of the detector response needs to be known in order establish a relationship between the intensity of the light and the number of counts provided by the detectors. A doubling of the light intensity should result in a doubling of the counts value.

    The characteristics of the light source need to be known because few (if any) light sources have uniform intensity over all wavelengths of light. A light source, such as an incandescent or tungsten-halogen lamp, have characteristic black body spectral signatures, which are vastly different from fluorescent lamps. The spectral characteristics of the light source will weight the spectral characteristics of the reflectance spectral signature of the target material. This weighting will need to be compensated in order to retrieve the actual spectral signature of the target material.

    As a final comment, the Bayer filter found on color webcams will skew any spectral signatures received. A monochrome camera or monochrome scanner sensor would be a better choice, since there would be no Bayer filter getting in the way. Still, this is an interesting use of webcams for introducing beginners to amateur spectroscopy.

  6. The website didn’t connect to my webcam (chrome 21+ with flags enabled on Windows 7 64bits). Also, the software is openning a big fullscreen gray screen on my computer. Any ideas? If not, I could use some help on rewriting it on matlab..

  7. Hi, I am working on a project related to NDVI images and crop analysis. And to achieve this I need to get NIR image of the crops and the plants to generate the NDVI map. But I have no means to find out if the images taken by me has near IR band in it or not. Can you guide me through the procedure of how to check if there is a near IR spectrum in the image or not?

      1. I have done the same following publiclab.org’s instruction. I am using a canon sx280 and I have removed its IR filter from it. I am receiving a magenta looking plants. But how can I be certain that there is a NIR spectrum in the images taken? That’s where I require your help.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.