>First, the (bandpass) Bayer color filter arrays on cameras limit their color resolution pretty sharply. It might be a better (if less elegant) approach to use the ambient light sensor and scan it across the spectrum generated by the diffraction grating.
The diffraction grating spreads the different frequencies physically across the sensor. So the camera sensor doesn't need any color information, you only need position and brightness information.
Right, but the different physical locations on the sensor have different spectral sensitivities due to the bayer CFA. Ideally, you'd have panchromatic pixels with no bayer pattern.
Oh I hadn't thought of that. I assume some calibration would be required for each device anyway, I wonder how hard it would be to detect and correct for this effect?
using a 2D sensor, you could actually just block one half of the slit at a time with your sample, and let the other half of the slit pass through unchanged... that way you could get a calibration shot for every sample, assuming the dynamic range of the sensor was high enough that the calibration lines didn't bleed (or conversely that your sample didn't get buried in noise because exposure wasn't high enough)
People have done it for a variety of purposes (natural image statistics, astronomy, etc). I can post references later. Problem is that it almost universally requires you to photograph a standard light source or a standard reflectance target under a standard illuminator. Or a monochromator. So you can calibrate your cheapy device but you need an expensive/scarce standard.
It's an interesting problem and I look forward to seeing how they solve it.
Back in the day, standard illuminants were candles made from spermaceti--the wax substance from the cavity of a sperm whale (it was also used as space-grade lubricant until very recently). Nowadays, CIE Illuminant D represents a sort of model of natural daylight. I bet a blue sky sunny day could be used for calibration, if the instrument is pointed straight up and a function corrects for lon/lat and time of the year.
For reflectance measurements, the highly-lambertian Spectralon material is basically just well-controlled Teflon sheet. Some PTFE sheet from McMaster might do the job for DIY purposes.
You want a "peaky" light source to build the spectral response model, xenon or deuterium flashbulbs are cheap on amazon... I would lean towards using deuterium because I think the relative power of the peak to the blackbody floor (the rest of the light freqs) is less than the xenon, so you'd have less chance of the peaks dominating your sample with a less sensitive webcam type sensor
B&W security cameras are inexpensive and lack Bayer masks. I've used one to make a spectrometer before. Pop the lens off the front and you're good to go.
Edit: some of them have ethernet or other fun connectivity options. Better for getting data out of a DIY instrument than screen capture.
Of course, any understanding of spectroscopy should include some background of the physics behind what you're measuring. Any modern physics book would be fine: Krane, etc.:
The diffraction grating spreads the different frequencies physically across the sensor. So the camera sensor doesn't need any color information, you only need position and brightness information.