What I want to do or know
I want to know if the webcam from v2.0 is suitable for spectrometer 3....
Public Lab is an open community which collaboratively develops accessible, open source, Do-It-Yourself technologies for investigating local environmental health and justice issues.
By signing up, you agree to the Code of Conduct, which applies to all online and in-person spaces managed by the Public Lab community and non-profit.
As an open source community, we believe in open licensing of content so that other members of the community can leverage your work legally -- with attribution, of course. By joining the Public Lab site, you agree to release the content you post here under a Creative Commons Attribution Sharealike license, and the hardware designs you post under the CERN Open Hardware License 1.1 (full text). This has the added benefit that others must share their improvements in turn with you.
@stoft or @cfastie may be able to provide more info, but I believe it's been shown that the exact angle is not as important within the likely resolution of the device? I could be wrong but either way, we should link to supporting evidence from here. Thanks!
The angle is a function of (mathematical) of the detectable wavelength range and the diffraction grating (DVD) line spacing. My calculations and my published Matlab plots show that 45-deg is a good match to the 400-700nm range of sensitivity of a webcam. This makes the mounting alignment easy -- the DVD is mounted close and parallel to the camera lens and that 'sub-asssembly' is then aligned at 45-deg to the light from the slit. The alignment angle tolerance is also a function of the camera optics.
The cheapy webcams (with the tiny, low-f lenses) result in the spectral band occupying only about 'half' of the camera's "pixel-span" so alignment "feels" very insensitive. However, that is partially an illusion because as the spectral band (say 400-650nm) is 'adjusted' in "left-right position" within the camera frame, the wavelength span will no longer be 'centered' which will add some non-linearity to the otherwise linear approximation for CFL wavelength calibration.
So, I built my spectrometers using 45-degs so as to 'center' the 400-650nm band where the mid-point 525nm "ray" will be orthogonal to the plane of the image sensor thus making the image symmetrical.
So, from a practical aspect, and with tiny webcam lenses, there is plenty of image area so you'll easily get a full spectrum even if the angle is off a little bit -- but it's still good to understand where the numbers come from when making trade-offs.
[ I'm guessing that the '60-deg / 45-deg' combination came purely from fiddling with the parts or perhaps from an effort to view more of one end of the spectrum. While a webcam (sans IR filter) does detect some infrared, relative to the center 550nm green spectral sensitivity, the IR sensitivity out past 700nm is quickly in the noise. (Yes, if the signal has very little visible wavelengths, then you can 'push' the IR detection but amplitude accuracy past 700nm is very poor and noisy.) ]
That should perhaps be reposted as a "focus your spectrometer" activity at some point...
I note that 1) your spectrum does "fit" though it is 2) "offset" a bit from center which is likely related to the angle. (Just to identify what is seen; not that the effect is huge.) The broad "hump" in the 'blue' background level suggests possible light leakage, optical path skew, or some distortion -- the background (between the spikes) ideally is close to zero.
As for camera focus, the practical answer is: where the resolution of the green double-peak is the sharpest. When the distance from the slit to the grating is "longer", the slit behaves more like a 'point source' so the camera focus is closer to infinity. But these tiny, polycarbonate lenses are poor, have significant aberration and large DOF so the focus point will be just a guess at best (the effect of focus adjust on the clarity of the spectral won't be dramatic) and so final performance will be limited.
I think the blue hump was something we saw a lot on those SYBA webcams, and believe it was related to a blue LED in the webcam itself, which you can snip off without trouble (snap open the grey webcam enclosure; you can glue/tape it shut again). That was one of the (several) reasons we abandoned that camera, but it's an easy fix. I think that's right... it's been a while!!
I've focuses to 22cm, removed blue LED: https://spectralworkbench.org/spectrums/91509
The blue hump is still there. I'll try to change the DVD to see if it changes something. I'll look for light leakages, but it doesn't look like light is entering. Maybe the slit is to bright?
How to control "optical path skew" or "some distortion".
OK - i guess the blue bulge is just a limitation of the camera... i had forgotten exactly. But if you subtract a baseline reading from any readings you do, it shouldn't have a big effect -- just somewhat of a decrease in your dynamic range for that region. Is that right, Dave?
No I don't think it is just inherent in the camera. The blue led has a fairly narrow spectrum (say 25nm at most) so producing a 150nm 'spread' would mean a broad angle of light impinging on the DVD -- which doesn't appear to be right.
As I recall, some user-posted CFL spectra show this effect and some do not. My early experiments with the old camera did have some noise but not this much in the blue. I think a common problem is having the CFL source much too close to the spectrometer (so having the inverse of a 'point source') which easily causes additional internal reflections along with other issues.
Having a large, broadband 'false signal' included does a lot of damage to the data from the true signal. When the true signal is 20dB below the noise, even complex correlation techniques cannot extract the signal data so it is not just a simple subtraction to look for the difference. Noise is always a killer of signal data and, generally, signals need to be at least 6dB above the noise to be 'usable'.
To get a visual sense of the error, just compare the original CFL spectra I collected using the original PLab 'box' camera with my latest Hi-Rez configuration. The difference is dramatic -- and the plots were extracted from the same CFL (and none of them have 'broadband blue noise'.
It would be good to track-down the root-cause of the blue error. Try this: 1) a darkened room, 2) CFL at a distance of 3-5 feet, 3) could also block all light from CFL except for a 1-inch hole in a cardboard mask to further restrict the source angle, 4) DVD parallel to camera sensor, mounted very close to the lens, 5) DVD at 45-deg to direction of slit, 6) slit at least 8-10 inches from camera, 7) mechanically stable (sitting on the desk) then 8) focus for best resolution of mid-green double-peak. Under these conditions, I often just use a black cloth to cover the spectrometer parts which usually eliminates nearly all stray light.
Great idea to constrain and track this down -- it might make a good new question in its own right, esp. if it's a common issue (which seems likely). Then it'll be featured on the spectrometry page.
There's still some clipping (source light intensity too high) so a comparison, using a cardboard mask (with a small hole in it), between the two bulb types might be helpful in diagnosing if there is an association between bulb intensities or if the difference is related to having a wide-angle light source -- or, perhaps, related to spectral differences between various physical regions of the CFL.. If the Mfg of the bulb were the same that would eliminate another variable.