Public Lab Research note


High-Rez WebCam Spectrometers

by stoft | October 23, 2016 07:16 | 2,225 views | 8 comments | #13641 | 2,225 views | 8 comments | #13641 23 Oct 07:16

Abstract

Having experimented with software algorithms to enhance the PLab-3 spectrometer data, I decided to experiment with a two higher pixel-density webcams; with monochrome as one of those. The objective was to look at the effect of the hardware sensor on the recovered spectrum and to gain a better understanding of the cost / performance trade-off. The same source light conditions were created for each spectrometer test and the Matlab test software was designed to recover only native-mode pixel data. The data presented here raises additional questions not answered by any of these three designs so this note just represents a starting point. Finally, an advantage with programming the interface for all three (3) cameras is that the exposure can be set to 'manual' and other features such as brightness, gain, contrast, temp deg-k, etc can be controlled -- though the specific setting options is not all the same for each camera (and the monochrome has only a couple).

More observations may be added later......

Hardware

The three spectrometers are 1) the orignal PLab-3 SANM CM-020 color webcam 1600x1200 native, 2) an OVA-2710 based webcam at 1920x1080 native and 3) an MT9P031-based monochrome webcam at 2592x1944 native. This first image is of the OVA2710 camera + diffraction assembly:

[ One additional observation is that the tiny polycarbonate 60-deg lenses of th SANM type webcams is a definite disadvantage. The other two webcams were fitted with 8mm glass lenses where focus was considerably more accurate. ]

Color.jpg

...and this image is of the monochrome webcam + diffraction assembly:

Monochrome.jpg

While the monochrome webcam is quite expensive, it was valuable to include because it is 1) higher native resolution, 2) it does not have the RGGB Bayer filter or the JPEG effects and 3) it has 12-bit dynamic range (as opposed to the RGB cameras at 8-bit depth. The 1920x1080 resolution webcam is moderately priced so provides an interesting combination of price-performance.

Components

[SANM] Obviously, the PLab-3 SANM camera is available from PLab.

[OVA-2710] This camera is from ELP and can be found on Amazon for about $45.

[MT9P031] The monochrome camera is available from the Mfg E-Con and is expensive.

[LENS] Both of these camera will require a new 8mm M12 lens from Amazon for about $6; a minor additional cost.

Plots

All plots show normalized values, CFL-calibrated wavelengths to a calculated 0.1nm resolution and Solux 4700K gain-corrected intensity.

The first plot is the now-traditional comparison of a 2700K CFL.

CompareCFL2700k.jpg

This next plot is the same data; just a "zoom-in" look at the green 546nm peak to observe the differentiation of the "double peak" to give a general sense of resolution.

CompareCFL546pk.jpg

The next plot looks to observe the effect of using a 0.12mm slit made from two sharp blade edges and a film-based slit while looking closely at the green 546nm double-peak of the SANM camera.

CompareSlits.jpg

Next, I attempted to measure the true spectrometer resolution by observing a ~650nm pocket laser and calculating the approximate Full Width Half Max (FWHM) bandwidth. Using a laser for this measurement is valid because lasers are extremely narrow bandwidth so the measured value is going to be many, many times wider than the actual source. It appears possible to achieve ~1nm resolution.

[ Specs of laser point BW are very hard to find, but one reference claims the typical laser pointer at 630nm (red) has a spectral linewidth of 100MHz (i.e. the 'noise bandwidth') which can be converted to ~0.0001nm. While there is likely to be significant variation between laser devices, relative to a PLab spectrometer, a laser pointer would appear to be a near ideal source. LEDs, of course, will not work because their BWs can be 10-20nm. ]

CompareLaser650nm.jpg

The plot below shows 1) the reference Solux 4700K output spectrum and the gain-calibrated measured Solux spectras of each of the webcams. Note that while all corrected spectra closely fit the Solux curve, each webcam shows its own sensitivity bandwidth.

CompareSolux.jpg

Finally, this plot shows the Solux gain-corrected spectra of November mid-day sun (as measured through a double-glazed window) as compared with a "typical ideal" solar spectra. The fact that they are all different from the "ideal" was not too surprising. It should also be noted that taking a solar spectra is a difficult challenge.

CompareSun.jpg


8 Comments

Great to see this comparison. Do you have a link to where these webcams might be purchased, and prices?

Also - I think you had some thoughts on the Raspberry Pi camera which is pretty affordable and high resolution. Would you mind linking to them or re-iterating here? I just bought one myself, and during the #webvalley tests this past summer found that they have very low baseline noise in the "black" regions of a spectrum.

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Jeff, I inserted the component details in the note above, just before the plots.

As to the RPi camera, it seems to have two "difficulties" which need solutions: 1) a "convenient" solution for interfacing the camera, controlling parameters and extracting image data from it (i.e. USB or other? ... I've just not seen a clean option) and 2) the lens. The mount and lens are very small and I've discovered (as noted in the above note) that a better lens (~8mm) is really necessary. All the added pixel data is useless if the lens is junk.

There has been some hacks to the RPi for other mounts, but the RPi board is very small so the hacks are not easy or a clean drop-in -- from what I've found so far. I also have not found specs on the chip sensitivity and dynamic range -- which is necessary for comparing cameras. If the sensitivity is low, then the background noise can also "seem better" -- but that is not a measure of image "quality" -- it is sensitivity and dynamic range that count.

Also, it would be good to compare cost of RPi + uC vs USB module types. The added pixel resolution of the monochrome I used did not appear to provide "clearly better" results than the more moderate cost ELP. No, that is not definitive numbers, but it just indicates additional details worth observing so as to compare specs that are of importance to the resulting spectra. So, I'm not rejecting the RPi, it just does not yet appear to be a drop-in option.

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Great, thanks -- and just to link to the question I'd asked about this earlier: https://publiclab.org/questions/warren/09-28-2016/upgrade-a-diy-spectrometer-with-a-raspberry-pi-camera (i'd also linked to a possible approach there to the interface question -- a good one)

Also -- any thoughts on sensitivity as measured here? https://publiclab.org/notes/khufkens/11-02-2015/ov5647-raspberry-pi-camera-spectral-response-quantum-efficiency

Thanks!

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


What I've read is that the RPi camera used to use the OV5647 camera chip but has "upgraded" (changed chips) to a Sony IMX 219 PQ CMOS image sensor for which I've not found comprehensive specs -- like sensitivity and dynamic range. They only claim 3280x2464 native and 44.5dB "PGA" max -- which 'might be' related to dynamic range, but does not state it is -- and no sensitivity or sensitivity curves. The PLab link you gave to the OV5647 did not have that data either. That chip is 2592x1944 but the spec sheet does not quote sensitivity or dynamic range.

Reply to this comment...


khufkens-pi-camera-response-curves-3342e29_-3-.zip @warren,@stoft This may provide additional info.

Stef

Reply to this comment...


@stef, thanks for the curve data. While the data is useful for comparison with relative sensitivity curves of other cameras, the data, unfortunately, is all relative values and did not include specific information about sensor chip absolute sensitivity, noise or dynamic range. All silicon sensors have similar response curves, as do camera Bayer filters, but their absolute sensitivity, noise and dynamic range can be quite different -- and those three factors play a more important role within a spectrometer application.

Reply to this comment...


I tried this camera https://www.aliexpress.com/item/HD-Surveillance-camera-1080p-Full-Hd-MJPEG-30fps-High-Speed-CMOS-OV2710-Mini-CCTV-Android/32811887520.html , but it have a bug with manual exposure setting. The exposure is set to a drastically lower value (picture is dark), so for spectrometer is useless.

These is my 1st Beta Spectrometer with borrowed industrial camera, "written" in LabView SpectrometerTM.png On a screen is a spectrum of two white along with two 660nm LEDs

Reply to this comment...


Nice graphics. Yes, white LEDs are not broad spectrum. If it's of any help, I set (Matlab code) the ELP camera to: Manual Exposure, Exposure=-3 (-14:-1 range), Gain=0 (0:100), Gamma=100 (70:500), Brightness=0 (-64:+64), White Balance=Manual, WB=6500 (2800:6500), Contrast=32 (0:64), Sharpness=2 (0:6), FrameRate=12 (12.000), Brightness=64 (1:128).

Reply to this comment...


Login to comment.

Public Lab is open for anyone and will always be free. By signing up you'll join a diverse group of community researchers and tap into a lot of grassroots expertise.

Sign up