Today (Hackaday, April 23), I've invested the bigger part of the day into a quick hack, to demonstrate the potential use of my optical spectroscopy software SPEKWIN32 together with webcam-based DIY spectrometers. It is not perfect, but it works:-)
What it does:
- Connect to any webcam, that is recognized by Windows system
- show a webcam live view
- show a live horizontal cross section as a spectrum within a Spekwin32 plot window
- identify each measured spectrum with live time stamp
- for emission spectra: save a dark spectrum + automated live subtraction of dark
- for transmittance/absorbance: save a reference spectrum + automated live calculation of absorbance/ transmitttance
- use automated peak labeling during live view
- optionally flip the spectrum, to adjust to the original image orientation
- clipping warning for blue, green red channel
- visually define the spectrum ROI, that is used for cross-section calculation
- assign the spectrum's linear wavelength range
- access webcam settings via Windows webcam interface. Depending on webcam type: also control exposure time, white balance & the like
- Disconnect the webcam
- Keep last measured spectrum. Process with all available functions. Save data and export into different file formats (spc, dx, csv, ...). Direct copy&paste via clipboard into Excel and the like. Create plot image files. Print. ...
- Analyze spectrum images without being connected to a webcam spectrometer. Use "Load spectrum Image" from the "File" menu.
Optical setup of spectrometer:
For diffraction of light + focusing I used a concave reflective grating. The slit image is much bigger than the little CMOS chip inside the USB camera. Therefore I used the grating for spectrum projection onto a white piece of paper within the slit plane beneath the entry slit. Used the USB camera with lens to image the projected spectrum image. Works astonishingly well:-)
Application example: measuring absorbance of coloured decals:
- yellow coloured:
- red coloured:
- green coloured:
- blue coloured:
Limitations of the current version => to be improved:
- linear attribution of wavelength information is possible, but w/o calibration.
- => Implement wavelength calibration procedure
- For emission type spectra: wavelength-dependent sensitivity of detector not corrected.
- => Implement sensitivity correction procedure (function already there, not connected to live spectra)
- Not working for Raman measurement type
- => Implement live view for "Raman shift" as x axis + live baseline correction (this function is also already there, but not yet connected to live view)
- Using dark spectrum + reference spectrum at once does not work reliably (actually also not neccessary). "Save reference spectrum" only work reliable in "Intensity" mode.
- => Bug fixing. Make it more stable.
- Needed: Turn off white balance. Control gain + exposure time. Since p4: access to webcam settings, should be possible to control these parameters (depending on webcam type). Could not try with my webcam, these options were not accessible:-((
What annoyed me most:
The webcam had a habit, which is normally useful, but very annoying for spectroscopy: the automated auto-exposure always makes sure to get images with medium intensity. Which means that spectral measurements are severly hampered. It tends to produce partly overexposed data, at least for some of the three color channels. For measuring transmittance or absorbance spectra, it is crucial that the reference spectrum is still applicable when measuring the sample. Which is only the case, if a) the light intensity is still the same and b) the exposure time didn't change. However, as soon as you put the (light-absorbing) sample into the light path, the cam does increase the exposure time, in order to compensate the decreased light level. Which basically means, that only the first one or two frames after putting the sample into the light path give something near to the real sample absorbance. Due to this behaviour, I had to do the above screenshots for presenting results.
I am curious to learn about...