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.

Comments

  1. Zee says:

    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. ka1axy says:

    Theoretically, you could do this with a linear (scanner) array as well. The prism spreads out the wavelengths spatially and the linear array would measure intensity at intervals

  3. indiantinker says:

    Its a great tool..and i found something vaguely similar in some of the older issues of makezine..Maybe thats what Zee is talking about!!

  4. knightvoyager says:

    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.

  5. warren says:

    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.

  6. slashdottir says:

    thank you, thank you for not saying “after the jump”

  7. Necromant says:

    Cool, should make one asap.

  8. rallen says:

    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…

  9. AE5PH says:

    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.

  10. Joe says:

    Would this work better, worse, or indifferent with a blu-ray as the diffraction grating?

  11. ericoporto says:

    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..

  12. ericoporto says:

    If anyone is interested in starting a matlab version of the software, I’m all in, since I couldn’t get their software to work in windows.

    To capture I’ve used

    vid = videoinput(‘winvideo’, 1, ‘YUY2_640x480′);

    basic intro here:

    ftp://www.ap.cityu.edu.hk/Final-year-Project/AP/2010-11%20FYP/A+B/KONG%20Man%20Seng.pdf

    (not my paper..)

  13. warren says:

    Hi ericoporto – good to hear about Windows problems – i’d love to help debug; i just don’t have a Windows machine. I’m lead dev for SpectralWorkbench, though. Do you think you could file a bug report at https://github.com/jywarren/spectral-workbench ?

    Sorry you had trouble, it’s still under development and the MediaStream API is very new.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,779 other followers