Sciencemadness Discussion Board

webcam near UV-VIS-NIR spectrophotometer(proof of concept)

Ubya - 31-10-2019 at 18:18

being able to identify what compound we have is particularly hard for amateurs chemists, we can usually try melting/boiling points, using test reagents, someone even has an HPLC, a spectrophotometer could be useful in the lab, for qualitative or quantitative identifications.
i had in mind to build a spectrophotometer even before taking my spectroscopy class at uni, but after learning more about it in class i really felt an urge to build something.
this is just a proof of concept, a design pretty well explored on the internet, i did it just to dip my toes in the project and get some positive results before hitting my head on the harder (and better) version.

this spectrophotometer was build in more or less 15 minutes using scavenged staff around my house, it is not meant to be durable, but could be a little funny project for anybody interested.

Materials used:
-a webcam
-a CD
-a cardboard box
-2 razor blades

first of all we need a webcam, the one i used is a microsoft lifecam HD-3000. i previously removed the IR filter and added an IR pass filter to make some pictures in the NIR spectrum, i removed the IR bandpass filter for this project as the visible part of the spectrum is quite important for this project.
a webcam with a variable focus is recommended, mine has the screw lens glued to the mount, and by removing the IR filter the focus somehow changed, this influences the spectrum resolution quite a bit.

next important part of the spectrophotometer is the diffraction grating, they are sold on ebay for around $5, 1000 lines/mm is recommended. of course i didn't buy one (yet) so i improvised with a CD. the distance between the tracks is 1.6 micrometers, equivalent to a 625 lines/mm. i could have just used a piece of CD has it is, as a reflective diffraction grating, but doing so requires a different setup and a bit more tweeking, so i turned it into a transmission diffraction grating.
to do so i needed to remove the aluminium layer from the cd and get only the polycarbonate layer, with a knife i scored the aluminium layer, then i put a piece of scotch tape on the scored line and then i pulled it off, the aluminium layer sticks to the tape and is remived with it leaving the clean polycarbonate.

next i cut a square piece from the outer edge of the cd, the tracks have a spiral path, and near the outher edge they are straighter because the radius is bigger (straighter lines give straight diffraction lines).
looking at a light through the clear CD i could clearly see the first and second order of diffraction, in this project i only used the first.
i attached the square piece of CD to the webcam lens being careful of aligning the CD tracks vertically (as my slit), to do so i just used two pieces of kneaded eraser (being careful to not cover the lens).

i attached the webcam PCB to an aluminium support, but i did this only because i previously broke the casing.

i used a carboard box as the housing, just the box a normal smartphone is sold in. i cut a small square opening with an exacto knife and i covered it with two razor blades spaced about 0.1mm and secured to the box with tape.

i spray painted the interior of the box in matte black, as to minimize reflections.

next i just attached the webcam at a 30° angle to the slit, checking through the monitor that the slit was not in view and only the first order of diffraction was visible.

i closed the box and connecter the webcam usb to my laptop.

to transform the picture of a diffraction pattern to a graph i used the free Theremino spectrophotometer software, it is really easy to use.

i registered a few spectra: sunlight, a white LED, a 400nm LED, a tv remote LED, a CFL lightbulb, a candle flame.





cfl_01.jpg - 456kB luce led uv.jpg - 464kB IMG-20191030-WA0000.jpg - 420kB IMG-20191030-WA0001.jpg - 446kB sun.jpg - 420kB

lcd bianco.jpg - 454kB

20191030_124124-1.jpg - 2.7MB

the resolution is pretty bad, probably because i'm using a CD as diffraction grating (i touched it barehanded many times, i could have ruined part of the tracks) and because the webcam is out of focus (the lens is glued to the mount, i will see if i can maybe unstuck it with acetone or just replace the mount with a 12mm standard one and get a proper lens)

[Edited on 1-11-2019 by Ubya]

j_sum1 - 31-10-2019 at 20:08

That is extremely cool. This puts vis/uv spectroscopy within reach of pretty much everyone.

I'd love further details of your image processing and software used.

Twospoons - 31-10-2019 at 20:25

The resolution in the IR seems particularly bad - I would expect an IR LED in a TV remote to be much narrower. Its quite possible the lens is failing to focus properly in that region, as it will have been optimised for visible light. You might get better results with a pinhole, though you would need a longer exposure. The other thing working against you in the IR is penetration depth in the silicon sensor increases with wavelength, resulting in blur from pixel to pixel. This is because as the free carriers created by the photons can drift sideways and end up in the wrong place.

Good effort though.

See if you can find a cheap and nasty DPSS green laser - you might be able to see the Nd:YAG line at 1064nm and the pump laser at 808nm. The line widths should be under a nm, and will give you a better idea of your achievable resolution.

[Edited on 1-11-2019 by Twospoons]

Sulaiman - 31-10-2019 at 20:34

Nice introductory project.

Regarding the above post ... would it be better to use a slit rather than a pinhole ?

I'd like to know how to interpret the data,
various bonds and elements, molecular spectra etc.
is there a free library of the spectra of various molecules ?
Better still ... is there any free software that can identify bonds and molecules from the spectrum ?
(preferably with auto-calibration using known spectral sources)

[Edited on 1-11-2019 by Sulaiman]

Ubya - 1-11-2019 at 05:53

@j_sum1 the software is free to use (https://www.theremino.com/wp-content/uploads/files/Theremino...), it reads the live stream from the webcam, you can see in real time the diffraction pattern from the camera and the interpreted spectrum. calibration of the scale can be done manually or automatically (using the light from a CFL light bulb) by dragging the 2 peaks to the right value.

it is very easy to use.

@Twospoons, i agree, the resolution is quite bad in my opinion, i already know what's wrong with it, it is a focus problem, but when optimized it could register really good spectra. an example of someone that used better optics (same cfl light spectrum)
CFL_COLD_1.jpg - 171kB

@sulaiman on how to interpret the data, atomic emission is quite easy, there are libraries for the emission lines of each element. for example i calibrated the scale on two mercury peaks from the mercury emission in the cfl lightbulb.

as to recognize molecular bonds it might be harder. uv-vis spectroscopy is not as good as IR spectroscopy to identify bonds. c-c bonds absorb in the far UV, in the near UV and Vis part of the spectrum emit/absorb only very conjucated molecules (carotenoids as an example), plus the solvent system can cause big shifts in frequency and intensity of the peaks, libraries may exist, but i think that it would be quite hard to get any automatic match. you still need the knowledge to interpret each spectrum


[Edited on 1-11-2019 by Ubya]

G-Coupled - 1-11-2019 at 06:13

That is an awesome project.

Astrophotography has also come on in leaps and bounds the last few years a lot due to cheap webcam technology and the software to take advantage of it.

andy1988 - 1-11-2019 at 11:37

Thank you for sharing. I think it would be fun to play with spectra in situations like this.

Here is an article I had bookmarked on the subject, in the comments are links to better articles.
So much fun stuff to try.

At an old workplace we characterized and calibrated UV/VIS/IR sensors as well (very expensive ones), so that the measurements with post-processing would more closely reflect reality (within defined uncertainties). Not me though, all that was over my head.

mayko - 1-11-2019 at 17:36

Quote: Originally posted by andy1988  
Here is an article I had bookmarked on the subject, in the comments are links to better articles.
So much fun stuff to try.


that........ was me! :o:o:o

I managed to extend that design a little bit, but never got past gluing trash together, and never got a reading that I really, truly believed:
https://web.archive.org/web/20131219000212/http://arkfab.org...
https://web.archive.org/web/20130826091002/http://topologico...

I did get a workable handheld spectroscope from the glue & garbage method though. I have been known to swagger around at night, looking at sodium & mercury lights.

handScope.jpg - 93kB


Right now I'm actually working on a polarimeter, but I really want to get back to this at some point. I'm glad to see people working on this!




[Edited on 2-11-2019 by mayko]

12thealchemist - 2-11-2019 at 12:12

I tried a similar sort of project some months ago, but had mixed results. It could be a different webcam that made it so much worse/better respectively.

The pictures below are some of my results

Left to right: Fluorescent bulb, incandescent bulb, neon or helium/neon discharge bulb
Fluorescent.jpg - 442kB Incandescent_01.jpg - 368kB Neon light.jpg - 370kB


The software will also give you a CSV printout of the spectrum. I had a go at using my setup to analyse solutions of metal salts (CuSO4, KMnO4, KCr(SO4)2), but couldn't get the spectra to accurately reflect what I was expecting, intensity-wise.

Ubya - 2-11-2019 at 12:27

Quote: Originally posted by 12thealchemist  
I tried a similar sort of project some months ago, but had mixed results. It could be a different webcam that made it so much worse/better respectively.

The pictures below are some of my results

Left to right: Fluorescent bulb, incandescent bulb, neon or helium/neon discharge bulb



The software will also give you a CSV printout of the spectrum. I had a go at using my setup to analyse solutions of metal salts (CuSO4, KMnO4, KCr(SO4)2), but couldn't get the spectra to accurately reflect what I was expecting, intensity-wise.


did you use a real diffraction grating? or you also used a CD?

12thealchemist - 3-11-2019 at 01:17

Quote: Originally posted by Ubya  

did you use a real diffraction grating? or you also used a CD?


I used a real diffraction grating - 1000 lines/mm

[Edited on 3-11-2019 by 12thealchemist]

Ubya - 3-11-2019 at 10:34


using CD as a diffraction grating
cfl cold_01.jpg - 476kB
using a DVD as diffraction grating
cfl hot dvd.jpg - 503kB

i still can't fix the focus problem, but by using a DVD as diffraction grating i can get a wider separation between the lines.
if you look at what the webcamm sees, the lines pretty much fill all the field of view.
the IR lines that were not resolved before, now are resolved.
i still cant resolve the lines between 570nm and 600nm, they are too close to each other even with a DVD (equivalent of 1350 lines/mm)

12thealchemist - 4-11-2019 at 09:54

I hadn't considered the possibility of using a finer diffraction grating; from your results that could well be worthwhile.

Ubya - 4-11-2019 at 10:22

Quote: Originally posted by 12thealchemist  
I hadn't considered the possibility of using a finer diffraction grating; from your results that could well be worthwhile.


finer diffraction grating and better optics to get sharper focus.

i'm thinking about even using a different sensor, like the CCD used in a scanner, as i would have to worry only about 1 pixel in height, and being the sensor much wider i could use no lenses at all, and just reflect the diffraction pattern on the sensor (right now it's in transmission mode)

Twospoons - 4-11-2019 at 14:38

Hamamatsu have some nice sensors : https://www.hamamatsu.com/jp/en/product/optical-sensors/imag...

Having data on sensitivity vs wavelength could be handy too.

Tdep - 4-11-2019 at 16:56

How far into the NIR can webcams go? I have a basic webcam at my uni lab that monitors a tuneable laser, and it can see 980 nm but can't see 1000 nm well.
Is there an ability to push this out any further? I wonder if its possible to cool the sensor to lower the thermal noise, improve sensitivity?

Twospoons - 4-11-2019 at 18:24

Cooling the sensor will improve noise (kTC reset noise is a major contributor), but it wont increase the maximum wavelength. Silicon is basically transparent to wavelengths beyond ~1100nm.

DraconicAcid - 4-11-2019 at 20:48

This is really cool- would you get better results from a BluRay disc? i think they have more lines than a DVD.....

I've been googling ....

Sulaiman - 5-11-2019 at 05:13

ccd and cmos camera sensors are sensitive from about 350nm to 1050nm,
so no point aiming for a wider spectrum.
Here is a typical sensor spectral response;
sony ccd.jpg - 45kB

and clearly some form of compensation for sensitivity vs wavelength is required.


If you want to use longer wavelength light then you should use a coarser (less lines/mm) grating,
as diffraction gratings have a cutoff wavelength when 1/2-wavelength >= grating spacing.
e.g. 1200 lines/mm = 833nm/line, so wavelengths of interest should be much less than 1666nm
These three graphs are from Dynasil, they are for 300, 600 and 1200 lines/mm.
(mode 0 is straight through, mode 1 is the first diffracted spectrum, the one that we want)

300.jpg - 242kB

600.jpg - 205kB

1200.jpg - 193kB

to get spatial resolution on your sensor just use a greater distance between grating and sensor ?


I want to join in so I've ordered a cheap 600 lines/mm diffraction grating from China :D
https://www.ebay.com.my/itm/36x38-38x20mm-PET-Nano-Engraving...

P.S. on reflection,my suggestion in my first post above to use a slit instead of a lens makes no sense,
a lens seems necessary, but a lens that has a constant focal length over the required sectrum would be complex and expensive.
The lens seems to be a limiting factor for a simple setup.
Maybe a parabolic mirror from a cheap/used telescope ?

[Edited on 5-11-2019 by Sulaiman]

Ubya - 5-11-2019 at 07:26

" a lens that has a constant focal length over the required sectrum would be complex and expensive."
achromatic lens is the answer, they are not that expensive

Sulaiman - 5-11-2019 at 08:37

Quote: Originally posted by Ubya  
" a lens that has a constant focal length over the required sectrum would be complex and expensive."
achromatic lens is the answer, they are not that expensive

We would need something like or better than an apochromatic lens.
https://en.wikipedia.org/wiki/Apochromat
Maybe they can be found cheaply ?
.. but for applications that I'm familiar with, photography and astronomy, they are definitely not cheap.

andy1988 - 5-11-2019 at 09:39

Also an issue is transmittance/absorbance of the lens/optics, it varies by wavelength and material. Finding suitable windows with high IR transmittance was tricky, even ran into issues with hydrophilic windows (crystalline, I don't recall the material) getting irreversibly damaged by water droplets mid calibration, made small cavities in the window surface. Everyone was devastated and unspeakably upset at the technician responsible... takes a year or more to manufacture such windows (grow them, polish them, some break in process). If anyone wants to get into that business that would be neat, suppliers are rare.

Neat recent development for IR lenses, hopefully inexpensive!

Quote: Originally posted by Ubya  
" a lens that has a constant focal length over the required sectrum would be complex and expensive."
achromatic lens is the answer, they are not that expensive

I expect issues like that can be worked around via moving the stages/platforms around to match the focal length of whatever wavelength is being characterized. But I'm not sure what is best really, all this is over my head.

[Edited on 5-11-2019 by andy1988]

Ubya - 5-11-2019 at 09:56

Quote: Originally posted by andy1988  
Also an issue is transmittance/absorbance of the lens/optics, it varies by wavelength and material. Finding suitable windows with high IR transmittance was tricky, even ran into issues with hydrophilic windows (crystalline, I don't recall the material) getting irreversibly damaged by water droplets mid calibration, made small cavities in the window surface. Everyone was devastated and unspeakably upset at the technician responsible... takes a year or more to manufacture such windows (grow them, polish them, some break in process). If anyone wants to get into that business that would be neat, suppliers are rare.

Neat recent development for IR lenses, hopefully inexpensive!

Quote: Originally posted by Sulaiman  
Quote: Originally posted by Ubya  
" a lens that has a constant focal length over the required sectrum would be complex and expensive."
achromatic lens is the answer, they are not that expensive

We would need something like or better than an apochromatic lens.
https://en.wikipedia.org/wiki/Apochromat
Maybe they can be found cheaply ?
.. but for applications that I'm familiar with, photography and astronomy, they are definitely not cheap.

I expect issues like that can be worked around via moving the stages/platforms around to match the focal length of whatever wavelength thing is being characterized.

[Edited on 5-11-2019 by andy1988]


but it shouldn't be a big deal in the near IR, glass is pretty much clear in this region, we are not dealing with medium or far IR, the webcam sensor wouldn't pick it up anyway

[Edited on 5-11-2019 by Ubya]

Twospoons - 5-11-2019 at 13:32

A first surface mirror would probably be easier and cheaper, simply because building an achromat that's good from UV to NIR is going to be much more challenging than building one for VIS only - and VIS only isn't exactly cheap.

from what I can find, a prism may be better than a grating for a wideband spectrometer. You get better efficiency and avoid the problem gratings have with the second order diffraction overlapping the first order diffraction. The penalty is poorer, and non-linear, dispersion.

Worth reading:
https://journals.sagepub.com/doi/full/10.1177/00037028177204...


[Edited on 6-11-2019 by Twospoons]

wg48temp9 - 6-11-2019 at 03:29

Quote: Originally posted by Sulaiman  
ccd and cmos camera sensors are sensitive from about 350nm to 1050nm,
so no point aiming for a wider spectrum.
Here is a typical sensor spectral response;


and clearly some form of compensation for sensitivity vs wavelength is required.


If you want to use longer wavelength light then you should use a coarser (less lines/mm) grating,
as diffraction gratings have a cutoff wavelength when 1/2-wavelength >= grating spacing.
e.g. 1200 lines/mm = 833nm/line, so wavelengths of interest should be much less than 1666nm
These three graphs are from Dynasil, they are for 300, 600 and 1200 lines/mm.
(mode 0 is straight through, mode 1 is the first diffracted spectrum, the one that we want)







to get spatial resolution on your sensor just use a greater distance between grating and sensor ?


I want to join in so I've ordered a cheap 600 lines/mm diffraction grating from China :D
https://www.ebay.com.my/itm/36x38-38x20mm-PET-Nano-Engraving...

P.S. on reflection,my suggestion in my first post above to use a slit instead of a lens makes no sense,
a lens seems necessary, but a lens that has a constant focal length over the required sectrum would be complex and expensive.
The lens seems to be a limiting factor for a simple setup.
Maybe a parabolic mirror from a cheap/used telescope ?

[Edited on 5-11-2019 by Sulaiman]


From my understanding of the original set up a lens focuses the spectrum on to the detector. If the diffraction grating is moved further away the ends of the spectrum will not fall on to the small diameter lens that most cams have. So it will increase the resolution but only over a limite interval.

It should be possible to correct for the chromatic distortion of a lens by tilting the sensor relative to the lens.

The variable spectral sensitivity of the whole system can be correct for by a reference measurement without a sample or with a white sample.

Some spectroscopes use curved gratings or curved mirrors to focus the spectrum on to the sensor. Old large laser printers and photo copiers have a variety of optical bits in them, front surface mirrors, large lenses and some have special lens that are wide (~300mm) but narrow actually the middle slice of a 300mm dia lens. they may be useful. Some have a spinning mirror that could be used to scan the spectrum across a single photodiode.

Incidentally those printers and copiers also have a laser, HT supplies, motors, gears and a selection of shafts, bearings clutches and solenoids.

Search google with "curved grating spectrograph" for configurations

images.png - 6kB

[Edited on 11/6/2019 by wg48temp9]

Sulaiman - 6-11-2019 at 03:34

Quote: Originally posted by Twospoons  
Worth reading:
https://journals.sagepub.com/doi/full/10.1177/00037028177204...

My head hurts :(
______________________________________________________________
Folowing Twospoons coment above, it seems that a diffraction grating is only really useful over one octave of wavelengths :(

A simple version of the diffraction equation is sin( Θ ) = m.λ/d

sin(angle of diffraction) = m.(wavelength)/(distance between lines)
m = mode = 0,1,2,3.. etc.

so for example, (mode 1 900nm) will be at the same angle as (mode 2 450nm) also (mode 3 300nm) etc..

Ubya - 6-11-2019 at 07:14

Quote: Originally posted by Sulaiman  
Quote: Originally posted by Twospoons  
Worth reading:
https://journals.sagepub.com/doi/full/10.1177/00037028177204...

My head hurts :(
______________________________________________________________
Folowing Twospoons coment above, it seems that a diffraction grating is only really useful over one octave of wavelengths :(

A simple version of the diffraction equation is sin( Θ ) = m.λ/d

sin(angle of diffraction) = m.(wavelength)/(distance between lines)
m = mode = 0,1,2,3.. etc.

so for example, (mode 1 900nm) will be at the same angle as (mode 2 450nm) also (mode 3 300nm) etc..




orders-in-spectrometer-e1569506556802.png - 200kB

Figure-4-1024x408.png - 29kB

Yea overlapping patterns are a common problem, real spectrophotometers have filters after the diffraction grating, so if you want to see 900nm in the first diffraction order, you put a filter that lets pass only light over 800nm for example, this way you block the other orders. Or better they use spacial diffraction gratings that have triangular grooves(blazed grating). But this is relevant only for precise measurings, the second order of diffraction has pretty weak intensity, before using the DVD I tried to just tilt the webcam and use the second order to get a bigger resolving angle between the lines, but I could barely see any distinguishable peaks over the background noise. So yea if we build a real spectrophotometer of course we need more things, it's not a coincidence their high price.


[Edited on 6-11-2019 by Ubya]

Sulaiman - 7-11-2019 at 19:51

before I get too involved in yet another significant project i'd like some advice;

IF I made a spectrophotometer for visible light (e.g. 380nm to 760 nm),
with 1nm resolution and 30dB to 40dB SNR,
would it be useful for my general chemistry hobby ?

e.g. could such an instrument analyse the products of sugar:yeast fermentation ?
EDIT:________________________________________________________________
D'oh ! ... the answers are obvious (after a little more googling)
only chemicals/pigments/dyes that can be seen by eye are going to be 'seen' by a VIS spectroscope,
so the most I could do is Beer–Lambert law type concentration measurements ... boring.
It seems that parts of the UV spectrum have some use in chemical spectroscopy,
but all of the interesting stuff is in th IR (micrometers) range :(

[Edited on 8-11-2019 by Sulaiman]

Twospoons - 8-11-2019 at 02:01

I see what you mean. So the answer there is a monochromator using a ZnSe prism for dispersion, and hacking the sensor out of a PIR ( they work out to 10um or more)

Sulaiman - 8-11-2019 at 02:25

I have more than enough ongoing major projects,
so I'll give diy spectrometry a miss.
I'll probably just use the grating for amusement,
and possibly for a little astronomy.

At least I now see why a couple of members were stimulated by the Raman spectrometer thread.

phlogiston - 8-11-2019 at 03:23

Another application may be atomic emission spectroscopy. Spray a sample into a flame, or excite it in some other way (eg. sparking between metals, low pressure gas with high voltage)

It would be interesting to see to what extent you can do elemental analysis with a simple setup like this.

Being able to do qualitative analysis (is element X present or not?) would be pretty useful.

Tdep - 13-11-2019 at 21:20

Ok I've been convinced that this is cool. I'v invested $12 total to get a webcam and a 1000 line diffraction grating, and we'll see what happens when they arrive

wg48temp9 - 14-11-2019 at 01:39

I think to do any analysis the system needs to be developed to the point that lines are visible. From a brief play with the software it does not have any calibration function and the zero level is not zero. I suspect that's due to the image not being black clamped meaning black (zero signal) is not at a specific level.

Ubya - 14-11-2019 at 07:28

Quote: Originally posted by wg48temp9  
I think to do any analysis the system needs to be developed to the point that lines are visible. From a brief play with the software it does not have any calibration function and the zero level is not zero. I suspect that's due to the image not being black clamped meaning black (zero signal) is not at a specific level.


Yeah the intensity scale it's not fixed, it varies with the maximum peak, even pure darkness won't show a flat line as the sensor noise will just be amplified in the scale.

wg48temp9 - 14-11-2019 at 12:24

Quote: Originally posted by Ubya  

Yeah the intensity scale it's not fixed, it varies with the maximum peak, even pure darkness won't show a flat line as the sensor noise will just be amplified in the scale.


Yes exposure/integration time, video gain and color balance need to be fixed on the webcam and not set to auto but not all webcams have the option to switch off the auto control of them.

The software apparently integrates many frames from the webcam and may have its own auto functions for some reason..


Assuming the auto functions can be turned off, a black area could be added to one end of the spectrum so the software could then adjust the offset of the whole image so that that area is zero in the spectrum.

I do not recall if the software is open source or not. But if we were going to that much trouble it would probably be best to use a camera board for a arduino to replace the webcam.

In a thread about GC, free software was mentioned but I don't recall name. and can not find the thread. That software may be a more sophisticated alternative.

Found it. Its called Openchrom see https://lablicate.com/platform/openchrom

[Edited on 11/14/2019 by wg48temp9]

Sulaiman - 15-11-2019 at 01:39

From what i read it looks like that software is for analysing various file formats,
not for live camera interface/control, display and interpretation.

Ubya - 15-11-2019 at 02:23

Quote: Originally posted by Sulaiman  
From what i read it looks like that software is for analysing various file formats,
not for live camera interface/control, display and interpretation.


the theremino software should be able to export the spectrum data (not just the image as the few i posted here), but i don't know if the formats are compatible

wg48temp9 - 15-11-2019 at 05:05

Quote: Originally posted by Sulaiman  
From what i read it looks like that software is for analysing various file formats,
not for live camera interface/control, display and interpretation.


Yes that's correct. It takes a series of values stored in a file and processes it and can then display as various types of spectrums (graphs), compare to references, perform calibrations and area under peaks and much more.

I should add I down loaded the software from the link I gave. Its huge almost 1/2 Gbyte but I could not get it to install due to problems with the length of paths of some files (maybe a problems on this PC) and problems with my java.

On a previous PC I was able to load a version of the software and was able play with it.

If I remember correctly there are plugins that are available that allows it to be used in real time but I doubt there is one for a webcam.

Apparently there are also other open source versions of this type of software that appeared to be free but I have not confirm that because I haven't used them.

Ubya - 13-12-2019 at 16:58



cfl hot dvd_01.jpg - 499kB
from this spectrum i noticed that the near IR lines were much more resolved vs the lines on the left. at first i thought it was a lens problem, but then i tried to rotate the webcam so i would have the lines shifted on the right side of the sensor/grating.
i guessed right.
flc best_01.jpg - 492kB
apparently the dvd diffraction grating is not uniform, the resolution is better on the right of the viewing field. now i can get a bit better resolution but i can't get a full spectrum.


another thing i did i tried to measure the transmittance spectrum of a dilute copper acetate solution
cuac transm.jpg - 478kB

i used an incandescent tube as a light source, i can't recognize any specific lines, just a general absorbtion in the red/near infrared spectrum

G-Coupled - 13-12-2019 at 19:08

Really interesting stuff - wouldn't different CD/DVDs have different grating patterns on them?

Have you tried using different discs?

Maybe burning a CD/DVD with a particular bit pattern on it (0,1,0,1 etc.) provide a more predictable, structured pattern?

Ubya - 5-2-2020 at 09:57

Quote: Originally posted by G-Coupled  
Really interesting stuff - wouldn't different CD/DVDs have different grating patterns on them?

Have you tried using different discs?

Maybe burning a CD/DVD with a particular bit pattern on it (0,1,0,1 etc.) provide a more predictable, structured pattern?


honestly i didn't try that, i used virgin DVDs and CDs. IMO they are good only if you don't have other options, if you need to find and burn a particular bit pattern you are better just buying a diffraction grating on ebay, even the plastic cheap ones are better than the better tweaked diffraction gratings made from DVDs or CDs.
diffraction gratings from discs have an intrinsic curvature, i always used the outer edge of the disc where the radius is biggest, but still, you could see the curved spectral lines.

for christmas my girlfriend gave me a diffraction grating as a gift (10x30cm PET diffraction grating 1000 lines/mm for like $6.90), and i used right now less than 1x1cm, but the results are clearly visible.

cfl hot dvd.jpg - 503kB vero reticolo flc cold.jpg - 332kB

on the left my best cold CFL spectrum using a dvd grating, on the right the first spectrum made with my new grating. as you can see the lines are much thinner, and some bands are more resolved

Twospoons - 5-2-2020 at 13:27

xmas list.png - 15kB

You getting a diffraction grating for christmas reminds me of my poor mum going to radioshack with my list in hand when I was a kid. If not for the helpful sales people she would have been completely lost.

Its an interesting comparison though, between the DVD and the grating.
The grating is clearly better, but the DVD isn't actually that bad really.

Ubya - 5-2-2020 at 16:26

Quote: Originally posted by Twospoons  


You getting a diffraction grating for christmas reminds me of my poor mum going to radioshack with my list in hand when I was a kid. If not for the helpful sales people she would have been completely lost.

Its an interesting comparison though, between the DVD and the grating.
The grating is clearly better, but the DVD isn't actually that bad really.


it's been years since i got a "normal" gift :D. for my graduation my collegues gave me a 60cm chromatography column, i still need to try it.

anyway, yea the dvd is not bad, but it bugged me a lot that the resolution would change so much going to the outer edge of the disk, you can still work with it though, you just need to cut your spectrum in multiple pieces and register each piece at the outer most edge of the grating (remembering to calibrate each time), it can be done, but honestly i prefer to spend $7 and have pretty much a life supply of diffraction gratings (for this spectrophotometer at least).

Ubya - 17-7-2024 at 14:44

well it's been a while!
i've been playing on and off with my spectrophotometer, and i recently got some way better results by changing the webcam lens.

if you can find a webcam that already has a 12mm lens holder, great, otherwise you'll have to do like me and come up with some janky adapter.
From this

to this




650nm red laser
0_28.jpg - 955kB

Hot CFL
0_27.jpg - 1.1MB

UV Blacklight (fluorescent tube type)
0_21.jpg - 1012kB

UVC mercury lamp (very weak)
0_20.jpg - 1012kB


the peaks are much more resolved and the sensitivity is quite a bit higher. with the older lens I couldn't distinguish at all from the background noise the mercury peaks of my UVC lamp, now I can at least see some.

while I'm very pleased there are still a few things I need to work on. the focusing is odd, I can't get the whole spectrum focused at the same time. It's not a professional lens, but I don't think this is chromatic aberration from the lens design.

I also played a bit with the webcam and grating positions/orientations. this is what i ended up with. probably the easiest configuration, but it has its issues. I could try to move away the grating to get more of the spectrum in the view field.

new lens.jpeg - 151kB

I'm also screwing around and learning with random lenses at home and a simulator online (https://phydemo.app/ray-optics/). The resolution of the spectrophotometer is also influenced by the number of illuminated slits in the grating, so I want to add a collimator lens to illuminate a width equivalent to the sensor lens and get the best out of this simple setup.