Sciencemadness Discussion Board
Not logged in [Login ]
Go To Bottom

Printable Version  
 Pages:  1  2
Author: Subject: webcam near UV-VIS-NIR spectrophotometer(proof of concept)
Sulaiman
International Hazard
*****




Posts: 3704
Registered: 8-2-2015
Location: 3rd rock from the sun
Member Is Offline


[*] posted on 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..




CAUTION : Hobby Chemist, not Professional or even Amateur
View user's profile View All Posts By User
Ubya
International Hazard
*****




Posts: 1247
Registered: 23-11-2017
Location: Rome-Italy
Member Is Offline

Mood: I'm a maddo scientisto!!!

[*] posted on 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]





---------------------------------------------------------------------
feel free to correct my grammar, or any mistakes i make
---------------------------------------------------------------------
View user's profile View All Posts By User
Sulaiman
International Hazard
*****




Posts: 3704
Registered: 8-2-2015
Location: 3rd rock from the sun
Member Is Offline


[*] posted on 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]




CAUTION : Hobby Chemist, not Professional or even Amateur
View user's profile View All Posts By User
Twospoons
International Hazard
*****




Posts: 1325
Registered: 26-7-2004
Location: Middle Earth
Member Is Offline

Mood: A trace of hope...

[*] posted on 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)



Helicopter: "helico" -> spiral, "pter" -> with wings
View user's profile View All Posts By User
Sulaiman
International Hazard
*****




Posts: 3704
Registered: 8-2-2015
Location: 3rd rock from the sun
Member Is Offline


[*] posted on 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.




CAUTION : Hobby Chemist, not Professional or even Amateur
View user's profile View All Posts By User
phlogiston
International Hazard
*****




Posts: 1379
Registered: 26-4-2008
Location: Neon Thorium Erbium Lanthanum Neodymium Sulphur
Member Is Offline

Mood: pyrophoric

[*] posted on 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.




-----
"If a rocket goes up, who cares where it comes down, that's not my concern said Wernher von Braun" - Tom Lehrer
View user's profile View All Posts By User
Tdep
National Hazard
****




Posts: 519
Registered: 31-1-2013
Location: Laser broken since Feb 2020 lol
Member Is Offline

Mood: PhD is done! It isn't good but it's over lol

[*] posted on 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
View user's profile View All Posts By User
wg48temp9
National Hazard
****




Posts: 785
Registered: 30-12-2018
Location: not so United Kingdom
Member Is Offline


[*] posted on 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.



I am wg48 but not on my usual pc hence the temp handle.
Thank goodness for Fleming and the fungi.
Old codger' lives matters, wear a mask and help save them.
Be aware of demagoguery, keep your frontal lobes fully engaged.
I don't know who invented mRNA vaccines but they should get a fancy medal and I hope they made a shed load of money from it.
View user's profile View All Posts By User
Ubya
International Hazard
*****




Posts: 1247
Registered: 23-11-2017
Location: Rome-Italy
Member Is Offline

Mood: I'm a maddo scientisto!!!

[*] posted on 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.





---------------------------------------------------------------------
feel free to correct my grammar, or any mistakes i make
---------------------------------------------------------------------
View user's profile View All Posts By User
wg48temp9
National Hazard
****




Posts: 785
Registered: 30-12-2018
Location: not so United Kingdom
Member Is Offline


[*] posted on 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]




I am wg48 but not on my usual pc hence the temp handle.
Thank goodness for Fleming and the fungi.
Old codger' lives matters, wear a mask and help save them.
Be aware of demagoguery, keep your frontal lobes fully engaged.
I don't know who invented mRNA vaccines but they should get a fancy medal and I hope they made a shed load of money from it.
View user's profile View All Posts By User
Sulaiman
International Hazard
*****




Posts: 3704
Registered: 8-2-2015
Location: 3rd rock from the sun
Member Is Offline


[*] posted on 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.




CAUTION : Hobby Chemist, not Professional or even Amateur
View user's profile View All Posts By User
Ubya
International Hazard
*****




Posts: 1247
Registered: 23-11-2017
Location: Rome-Italy
Member Is Offline

Mood: I'm a maddo scientisto!!!

[*] posted on 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





---------------------------------------------------------------------
feel free to correct my grammar, or any mistakes i make
---------------------------------------------------------------------
View user's profile View All Posts By User
wg48temp9
National Hazard
****




Posts: 785
Registered: 30-12-2018
Location: not so United Kingdom
Member Is Offline


[*] posted on 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.




I am wg48 but not on my usual pc hence the temp handle.
Thank goodness for Fleming and the fungi.
Old codger' lives matters, wear a mask and help save them.
Be aware of demagoguery, keep your frontal lobes fully engaged.
I don't know who invented mRNA vaccines but they should get a fancy medal and I hope they made a shed load of money from it.
View user's profile View All Posts By User
Ubya
International Hazard
*****




Posts: 1247
Registered: 23-11-2017
Location: Rome-Italy
Member Is Offline

Mood: I'm a maddo scientisto!!!

[*] posted on 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





---------------------------------------------------------------------
feel free to correct my grammar, or any mistakes i make
---------------------------------------------------------------------
View user's profile View All Posts By User
G-Coupled
Hazard to Others
***




Posts: 287
Registered: 9-3-2017
Member Is Offline

Mood: Slightly triturated

[*] posted on 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?
View user's profile View All Posts By User
Ubya
International Hazard
*****




Posts: 1247
Registered: 23-11-2017
Location: Rome-Italy
Member Is Offline

Mood: I'm a maddo scientisto!!!

[*] posted on 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





---------------------------------------------------------------------
feel free to correct my grammar, or any mistakes i make
---------------------------------------------------------------------
View user's profile View All Posts By User
Twospoons
International Hazard
*****




Posts: 1325
Registered: 26-7-2004
Location: Middle Earth
Member Is Offline

Mood: A trace of hope...

[*] posted on 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.




Helicopter: "helico" -> spiral, "pter" -> with wings
View user's profile View All Posts By User
Ubya
International Hazard
*****




Posts: 1247
Registered: 23-11-2017
Location: Rome-Italy
Member Is Offline

Mood: I'm a maddo scientisto!!!

[*] posted on 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).





---------------------------------------------------------------------
feel free to correct my grammar, or any mistakes i make
---------------------------------------------------------------------
View user's profile View All Posts By User
Texium
Administrator
Thread Moved
29-11-2023 at 12:04
Ubya
International Hazard
*****




Posts: 1247
Registered: 23-11-2017
Location: Rome-Italy
Member Is Offline

Mood: I'm a maddo scientisto!!!

[*] posted on 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.





---------------------------------------------------------------------
feel free to correct my grammar, or any mistakes i make
---------------------------------------------------------------------
View user's profile View All Posts By User
 Pages:  1  2

  Go To Top