Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

My 3D-printed DIY spectrograph

  • Please log in to reply
66 replies to this topic

#51 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 05 February 2021 - 02:04 PM

My SMD soldering skills are a bit rusty, but I just successfully followed my own old instructions posted here ( https://www.cloudyni...-3#entry7504157 ) to solder 6 pieces of the 1W LEDs with a sun-like spectrum to a small PCB:

 

50912296211_74e16e79d9.jpgTesting  Bridgelux SMD 2835 1W 9V Thrive LEDs by First Last, on Flickr

 

Here is a short video of the LED in action (using a bench power supply providing the precise amount of juice these need - 100 mA per pop):

 

https://www.youtube....h?v=EM2aINjuRco

 

They are super bright (I'd say the same surface brightness as the sun) - don't look at them directly!

 

Now it's time to use them with my spectroscope, to check for the spectra variability...



#52 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 06 February 2021 - 06:08 PM

I finally measured spectra from all 6 pieces of Bridgelux SMD 2835 1W 9V Thrive LEDs I have. I used a thick white paper as a diffuser, which is not perfect, but at least allowed me to measure how variable their spectra are, and get a guesstimate on the spectral response curve of my spectroscope (including the diffuser).

 

I measured all 6 spectra under identical circumstances - distance from the slit ~30cm, facing the slit, powered with a constant 100mA current (~8.9V) from a bench power supply. I let each LED glow for at least 1.5-2 minutes before measuring. I had to use full gain and long exposure (15s) with my ToupTek camera, as the diffuser is thick, and the distance from the LED is fairly large. I averaged 10 exposures for each LED (150s integration time per LED), and also did a 30-exposure dark frame. I did a fresh recalibration of wavelengths for my spectroscope using my CFL bulb target.

 

Here are the results.

 

First - the raw (no response correction applied) individual spectra for all 6 LEDs. The only correction - they are renormalized to remove global brightness variations.

 

SMD2835_many_log.png

 

It actually looks pretty good - in part because it uses a log vertical scale. Deviations seem to be around 0.03 dex or less.

 

Here I plot the average spectrum (black line) and average plus minus standard deviation (std) computed for each wavelength (so each std is calculated from 6 values, for the 6 LEDs, at each wavelength):

 

SMD2835_many_std.png

 

To make even more clear the std behaviour, here is the plot of the amplitude of the std (in dex) as a function of the wavelength:

 

SMD2835_many_std2.png

I am getting the worst error (0.037 dex, or +-9%) around 420 nm. The green-red parts of the spectra are better, with std < 0.01 dex (+-2%).

 

So even though there is some spectral variability, it seems to be fairly modest, with the blue side having the worst errors.

 

And here I plot both the manufacturer-provided "typical" spectrum (red line) and my measured spectrum (blue line; the average over the 6 LEDs):

 

SMD2835_orig_result.png

Finally, I divided the blue curve (measured spectrum) by the red curve (manufacturer's data), to get a guesstimate on my whole system response curve (including contributions from the camera, IR filter in the camera, diffraction grating, both lenses, and the diffuser - thick paper). In red I show the actual response curve, black line is a 11-order polynomic fit:

 

SMD2835_resp_fit.png

There are some very suspicious features in the red curve (likely artifacts) - like the blue peak around 450 nm - an artifact of the blue 450nm source present in all white LEDs (even though this feature is less obvious in this model of LEDs). Also I don't believe abrupt increases in the red and blue ends of the response curve - I suspect the real response curve should continue to decline on both ends.

 

Using a polynomic fit at least mostly got rid of the 450 nm artifact. And as long as I use this data within 410...700nm, the left and right bumps should not be present.

 

Again, it is just a guesstimate. I think the results a positive enough that I can consider making a more accurate measurement - moving the LED in front of the slit, in place of using a diffuser.



#53 robin_astro

robin_astro

    Apollo

  • -----
  • Posts: 1,224
  • Joined: 18 Dec 2005

Posted 07 February 2021 - 07:50 AM

Flick ups at the extreme ends of the response are usually caused by a false zero. Did you subtract the bias from the images?



#54 robin_astro

robin_astro

    Apollo

  • -----
  • Posts: 1,224
  • Joined: 18 Dec 2005

Posted 07 February 2021 - 08:34 AM

Flick ups at the extreme ends of the response are usually caused by a false zero. Did you subtract the bias from the images?

Scattered light can also give the same effect. Some of this can be subtracted using the areas above and below the slit as the link to Buil's method shows but light scattered in the dispersion direction is more difficult to deal with and depends on the quality of the grating. 

 

This is all getting rather off topic for this part of the forum though which is really for scientific astronomical observations. Perhaps it should be moved to ATM Optics and DIY?

 

Cheers

Robin


Edited by robin_astro, 07 February 2021 - 08:37 AM.

  • Stu Todd likes this

#55 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 07 February 2021 - 09:36 AM

Scattered light can also give the same effect. Some of this can be subtracted using the areas above and below the slit as the link to Buil's method shows but light scattered in the dispersion direction is more difficult to deal with and depends on the quality of the grating. 

 

This is all getting rather off topic for this part of the forum though which is really for scientific astronomical observations. Perhaps it should be moved to ATM Optics and DIY?

 

Cheers

Robin

Indeed, but how can I move it to ATM Optics and DIY?

 

I suspect the end artifacts are more about scattered light than false zero - they are at quite different heights, and also wouldn't subtracting a dark frame take care of the bias?



#56 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 07 February 2021 - 04:34 PM

I asked the moderator to move this thread to ATM Optics and DIY.

 

I finally got back to my original idea - using the ratio of the incandescent bulb spectra measured at two different temperatures - to recover both temperatures, and then use them to compute the response curve for the spectroscope. This relies strongly on the assumption that the incandescent bulb spectra are very close to blackbody radiation, which as I posted here earlier is not quite the case.

 

Anyway, before trying something more fancy (like using  published incandescent bulb spectra, in place of blackbody approximation), here is what I got with the simplifying blackbody assumption.

 

I used a 12V/20W automobile incandescent bulb at 5 different voltages (from 12V*1.60A=19.2W down to 7.4V*1.25A=9.25W). I used the same diffuser as with LEDs (thick white paper), the bulb was ~5cm away from the slit. With ToupTek B&W astrocamera, I used 150ms exposures at the maximum (1000) gain. I averaged 500 frames per spectrum, and then also computed the dark frame from 1000 frames. I used the same spectral calibration as with LEDs.

 

First - the five raw spectra (for the five filament temperatures), the bluer the hotter:

 

spectra_bulbs.png7

Interestingly, I see the same zigzaggy effect on the red side of the spectrum as I saw before with my CFL bulb spectra - so these are obviously artifacts from my spectroscope, not real features.

 

Next - the same spectra, only normalized to the same brightness. Effects of the changing temperature on the shapes of the spectra are more obvious now (the hotter the filament is, the more to the blue the spectrum is shifted):

 

spectra_bulbs2.png

Now to the interesting part. Assuming all these spectra are blackbody radiation with unknown temperatures, I used my method of dividing one spectra by another, and then fitting an analytical division of blackbody radiations at two temperatures to the former, to derive both temperatures by means of non-linear fitting (using Octave). I instantly discovered  that the results strongly depend on which two of the five temperatures I used in my analysis - not a good sign! I suspect this is primarily because the actual spectra are rather different from blackbody radiation.

 

Interestingly, using different pairs (out of 5) of spectra, many produced very poor fit in my analysis. For example, using temps #1 and #4 (#1 being the hottest, #5 being the coldest), I get this rather poor fit:

 

spectra_bulbs_1_4.png

The recovered temps are also not good - 2001, 1816K (where I expected them to be around 2500-3000K). Worse still, once I expand the range of temps used in non-linear fitting, the recovered temps tend to approach zero (and still being not a good fit to the data).

 

Then I tried all possible combinations of the spectra, and got a much better fit when using temps #3 and #4 - the std went from 0.0095 dex in the above plot, down to 0.0006 dex. This fit looks quite believable:

 

spectra_bulbs_3_4.png

The temperatures recovered are still not realistic - 4521K, 4138K (they are like factor of 2 larger than expected). But the point is the temperatures do not have to be exactly realistic - I am just trying to find two values of "blackbody temperatures" which produce blackbody spectra similar to the observed ones, in the given spectral window.

 

Finally, I used the above recovered "temperatures" to compute my spectroscope's response curves from both spectra - #3 (red line) and #4 (blue line):

 

transpose_3_4.png

Again, this is all based on the assumption that  blackbody radiation is a very good fit to incandescent bulb spectra, which is not the case. Still, the above response curve looks quite interesting, and almost believable. It is quite symmetric. It has a bump around 640nm which I'm sure is an actual feature of my response curve, as I saw this feature on other pairs of spectra. The two response curves (red and blue) are very close to each other, which is a promising sign. Even the fine-scale structure (zigzag between 600 and 700nm) are practically identical for both red and blue lines - so I can actually get rid of this artifact in all my spectra by using this response curves! Meaning that I shouldn't try to fit a polynome to these curves, but rather use them as is, with all these fine features.

 

This response curve is very different from the one I derived previously, based on LED spectra. Probably meaning they are both rather wrong.

 

Nevertheless, I think I am moving in the right direction, so I will try to do a better job with the same data - instead of blackbody radiation assumption, I'll try to use published incandescent spectra for this analysis. (Of course once you start getting into such details, different bulbs have different spectra, at the same temperature, which makes the analysis more difficult.)


Edited by syam, 07 February 2021 - 04:42 PM.


#57 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 08 February 2021 - 02:27 PM

I think I am finally onto something - things are starting to converge.

 

As I explained earlier, blackbody approximation is not a very good one for incandescent (tungsten) bulbs, so not a surprise that my method of recovering the true filament temperatures (with an unknown spectroscope response function), which relies on this approximation, didn't produce good results.

 

So I made the next step. I searched the literature, and found an analytic expression for tungsten emissivity as a function of the temperature and wavelength (Larrabee, 1957; page 46 in the PDF file). (Emissivity is a function which needs to be multiplied by the backbody radiation at the same temperature, to produce the actual spectrum. In other words, it is a correction to the blackbody radiation.) It is rather limited - derived from the range of temperatures 1600-2400K, for wavelengths 450-680nm. Here is this emissivity function:

 

E = 0.4655 + 0.01558*lambda + 2.675e-5*T - 7.305e-5*lambda*T

 

Here lambda is in nm, T is in K.

 

So I went ahead and modified my Octave scripts. Now instead of fitting the division of two measured spectra by a ratio of two blackbody radiations, I use a ratio of blackbody radiations times the emissivity. Otherwise my algorithm is exactly as before.

 

What I discovered is that this approach seems to produce much more believable results - but only for the two lowest temperatures I tried so far (my cases #4 and #5). The fit has a great quality (std is only 0.0005 dex):

 

spectra_bulbs_new_4_5.png

 

And now the temperatures recovered are totally believable - 2711K and 2570K. BTW, these numbers are also consistent with the power consumption by the bulb, which I measured to be 11.17W for #4, and 9.25W for #5. In the first approximation, power used by the bulb should go as a fourth power of the filament temperature (Stefan-Boltzmann law). I get (2711K/2570K)^4 = 1.24 which is pretty close to (11.17W/9.25W) = 1.21. Also, my temperature estimation for the nominal bulb power (20W) is 2711K *(20W/11.17W)^1/4 = 3136K, which is in the ballpark of normal filament temperatures (2800–3300 K).

 

Now to the best part. With this new model and the recovered temperatures, my new spectroscope response curve (blue line) looks much closer to the one I derived earlier using a completely different method (red line; using LED spectrum published by manufacturer):

 

transpose_led_tung.png

They are obviously still quite different, but the major features are roughly the same - the peak is around 450-500nm, it drops to ~-0.5 on the left side, and to ~-1.5 on the right side. I can even see the same bump around 630nm. Importantly, what looks to be artifacts on the left and right ends of the red (LED) curve, are absent in the blue (tungsten) curve, so the latter looks to be more reliable.

 

All other spectra combinations I tried resulted in completely wrong values for the temperatures, and much worse fit. I think one has to use very low temperatures (<2500K) for this method to work, in part because the emissivity curves were derived for temperatures 1600-2400K. With my 12V / 20W bulb, this roughly corresponds to the consumed power 1.4 ... 7W. Of course, the bulb will be much dimmer at these temperatures, and the blue end will suffer the most, but it still might work very well. I will try measuring spectra at these lower temperatures, to see if I can get a more consistent and reproducible result.


Edited by syam, 08 February 2021 - 03:07 PM.

  • R Botero likes this

#58 rnyboy

rnyboy

    Messenger

  • -----
  • Posts: 494
  • Joined: 29 Oct 2019
  • Loc: Rochester, NY (Bortle 7/8)

Posted 12 February 2021 - 04:00 PM

Cool topic!  Way back when, in 1973 while in HS Chemistry, we were each given a similar 35mm slide sized diffraction grating, a couple of razor blades to make the slit, a length of ruled tape in cms for measuring the relative locations of lines, some flat-black painted thickish cardboard, and the instructions on how to make a spectroscope.  It worked great!  We measured the Balmer lines of H and used those to obtain energies for the emission lines from other gas discharges like Ne, Ar, Kr, O, N, etc.  I'm 100% sure I still have it somewhere in a box up in the attic.  

 

It was very light weight and about the size and shape of a typical book.  I wouldn't be that surprised if a bit more rigid setup of similar size couldn't be used with a DSLR or CMOS sensor on a telescope if a way to connect it to the scope and sensor were worked out.

 

We had a fantastic chemistry teacher, who I remained friends with while working my way towards my eventual PhD in Analytical Chemistry.  Sadly, he passed away a few years after I obtained my degree and I was then living about 1000 mi away from my HS hometown.


Edited by rnyboy, 12 February 2021 - 04:00 PM.

  • jcruse64 likes this

#59 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 13 February 2021 - 01:29 PM

After some more tinkering, here are my conclusions:

 

  1. My idea of using the ratio of two tungsten bulb spectra measured at two different temperatures to figure out the values of the both temperatures may work in theory, but in practice (with noise and imperfections) is not useful - the temperatures I am getting are all over the place. Even when trying to optimise together multiple ratios (with multiple temperatures), the temperature accuracy is 400K or worse, which makes it unusable for spectroscope calibration. (The ratios of the temperatures, on the other hand, are extremely accurate.)
  2. Still, using tungsen spectrum would be much more preferrable over using an LED spectrum, for calibration, as the tungsten spectrum is known to a high accuracy (probably better than 2%). LED spectra have strongly fluctuating features.
  3. So what I did next was to fit a response curve I obtained using an analytic tungsten spectrum (with the temperature being a fitting parameter) to a response curve I got from measuring my "sun-like" spectrum LEDs. (The idea is that even though some narrow parts of the LED spectrum may fluctuate between different units, the overall color temperature should be fairly well confined.) This allowed me to compute quite accurately the tungsten temperature. Unfortunately, there is a serious problem on the blue end (<450nm), where my LED seems to be producing much less (~0.35 dex) light than expected. One possibility is that my non-ideal diffuser (a thick white paper) works rather differently with an LED ( a point-like source at 30cm) and tungsten bulb (~1cm long filament ~5 cm away).

Here is the plot:

response_curves.png

 

Here the blue line is the response curve derived from LED spectrum. The red curve is the part of the response curve derived from a tungsten bulb used for fitting (so red line is as close to the blue line as possible; the std is not bad - 0.04 dex). The black line is the continuation of the tungsten response curve. The result of this fitting is the estimate of the tungsten filament temperature - 2486K. (The bulb was at the nominal 12V.) It is a bit on the lower end for filament temperatures, but still plausible.

 

BTW - the analytic expressions for the tungsten emissivity (Larrabee 1957, page 46) have a serious typo - the description says the wavelengths are in nanometers ("millimicrons"), where in fact they must be in microns! I haven't noticed this right away.


Edited by syam, 13 February 2021 - 02:56 PM.


#60 Octans

Octans

    Mariner 2

  • -----
  • Posts: 235
  • Joined: 13 Aug 2009

Posted 13 February 2021 - 01:53 PM

Might not be a problem here, but be careful with the paper you're using as a diffuser on the blue/UV end as some kinds can fluoresce (I think done intentionally, to make them look brighter). One easy way to tell is to point a 405 nm laser at it, and you'll get back a spectrum with a lot of >405 nm light which is often visually noticeable (deep violet laser makes a blue-green spot on the paper).


  • syam likes this

#61 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 13 February 2021 - 02:57 PM

Might not be a problem here, but be careful with the paper you're using as a diffuser on the blue/UV end as some kinds can fluoresce (I think done intentionally, to make them look brighter). One easy way to tell is to point a 405 nm laser at it, and you'll get back a spectrum with a lot of >405 nm light which is often visually noticeable (deep violet laser makes a blue-green spot on the paper).

Thanks - a good point! Any suggestions for a better diffuser? Or just to experiment with different kinds of paper? I don't have a blue laser.



#62 Octans

Octans

    Mariner 2

  • -----
  • Posts: 235
  • Joined: 13 Aug 2009

Posted 13 February 2021 - 03:24 PM

Something like an opal or ground glass diffuser (like https://www.edmundop...ng-glass/11914/ or https://www.edmundop...ffusers/12287/) would be probably be ideal, though much more expensive than paper. (Take note of their transmission curves though if you go with one)

 

You could try different kinds of paper and see if the blue end looks different between them and if you have several with similar and good blue/UV transmission, go with those. If you have a black light/UV light, that could visually show fluorescence too (anything that glows under one is not something you'd want to use). Or maybe a sheet of paper that is intentionally made to be dull or gray colored (though dye could introduce a more complicated transmission function, not sure).


Edited by Octans, 13 February 2021 - 04:12 PM.

  • syam likes this

#63 rnyboy

rnyboy

    Messenger

  • -----
  • Posts: 494
  • Joined: 29 Oct 2019
  • Loc: Rochester, NY (Bortle 7/8)

Posted 14 February 2021 - 08:38 AM

There are glass etching kits for about $10 online or at hobby stores.  You could etch a piece of window pane glass on one or both sides to make a diffuser.  I don't know how uniform the surface needs to be for your application but $10 isn't all that much to see if it fits the bill for a diffuser in this application.

 

You could try bead blasting a piece of window glass too but you'd have to have the bead blaster or know somebody that does to try this approach.

 

If you search on glass etching you may find out you have the necessary supplies already inhouse to make a DIY diffuser.

 

And most white paper, white clothing before a few washings, and I think all fabric softeners and many laundry detergents have UV brighteners added to make clothes look whiter.  So those aren't really suitable for your application.


Edited by rnyboy, 14 February 2021 - 08:56 AM.


#64 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 14 February 2021 - 01:50 PM

Indeed, I already noticed these 10$ etching cans on ebay, with nice "Extremely dangerous!" labels smile.gif . May be, in the future. For now I'll try something I have - a piece of matte plastic (cover for my Moto cell phone it came with). Seems to be very diffusive and even. Definitely no fluorescence here. Also, this time I'll be much more careful - placing both LEDs and the tungsten bulb in exactly the same spot, relatively far (30cm) from the spectroscope. I just need to see if I can match the LED response curve with a tungsen one to a much better degree than I've managed so far.

 

BTW I have perfected my technique of getting good spectra with a SharpCap + a B&W astrocamera. Here is my procedure:

 

  • Find a nice spot on my spectra (vertically), tune ROI region to cover that part (full width - 1280 pixels, 32 pixels high in my case). Save it as a SharpCap profile.
  • Use Capture / Capture Dark method to compute averaged spectrum from your source (up to 1000 frames). In my tests, format doesn't matter - whether it is PNG, TIFF, or FITS, it stores the identical data - unsigned 16-bit greys.
  • Cover the spectroscope, and again use Capture / Capture Dark method, with the same (or larger) number of frames, to capture the averaged dark frame.
  • For processing, I wrote this simple Python script (for PNG, and perhaps some other formats):
import sys
import numpy
import imageio

data = imageio.imread(sys.argv[1])
dark = imageio.imread(sys.argv[2])

data32 = data.astype(numpy.int32)
dark32 = dark.astype(numpy.int32)

signal = data32 - dark32
A = numpy.mean(signal,axis=0)

f = open("spectrum.dat", "w")
for i in range(len(A)):
   f.write(str(i) + " " + str(A[i]) + "\n")
f.close()

You use it on a command line like this:

$ python script.py  light_image.png  dark_image.png

The script first converts the images to 32-bit signed integers, subtracts the dark frame from the light frame, then collapses the result to a single pixel vertically (averaging pixels vertically), and writes the resulting spectrum in "spectrum.dat" file, with two columns: horizontal pixel index, and the floating point values for the spectrum (0...65535 range). These are then read by my Octave scripts, for post-processing.

 


Edited by syam, 14 February 2021 - 02:08 PM.


#65 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 15 February 2021 - 11:45 AM

One more attempt at matching the response curves from my "sun-like" LED and a 12V tungsten bulb. This time I did a much more careful job:

 

  • Using new diffuser (plastic cover from a cell phone) - should not have any fluorescent issues.
  • Placing both LED and the bulb fairly far from the slit (20cm), and at exactly the same spot (right in front of the slit, accurately facing the slit).
  • Pre-heating both (5 minutes)
  • Bulb is at 11V (at 12V its brightness keeps increasing as it heats, not good for long exposures)
  • LED is precisely at its working 100 mA
  • Using the maximum number of frames (1000) for both light and darks. (I used between 100 and 200 ms exposures.)

The result:

 

response_tung_led.png

I'd say it looks significantly better than in my earlier attempt (up on this page). The std is now 0.02 dex (+-5%), which is fine for my purposes. I still see a significant (~0.2 dex) drop in the LED response curve on the blue end - between 410 and 440nm. The only explanation I can think of is that there is a significant variations on the blue end of these LEDs. I don't see it in my sample of LEDs, but they are all from the same batch.

 

At this point the match between LED and tungsten response curves (in the 440...680nm interval) is convincing enough that I can say that the tungsten temperature (2533K)  - the fitting parameter - was derived pretty accurately, and now I can use the tungsten response curve (red + black lines) as a good estimate of the real response curve of my spectroscope, for the full range of wavelengths I am measuring (393 - 715 nm).



#66 syam

syam

    Vostok 1

  • -----
  • topic starter
  • Posts: 188
  • Joined: 11 Jun 2009
  • Loc: Hamilton, Canada

Posted 16 February 2021 - 10:06 AM

I wonder if this will do well as a diffuser? This is a "32mm Frosted White Optical Glass for Biological Microscope" from aliexpress, only 5$ CAD with shipping:

 

frosted_glass.png


Edited by syam, 16 February 2021 - 10:20 AM.


#67 rnyboy

rnyboy

    Messenger

  • -----
  • Posts: 494
  • Joined: 29 Oct 2019
  • Loc: Rochester, NY (Bortle 7/8)

Posted 16 February 2021 - 06:10 PM

For $5 how can you go wrong in giving it a go?




CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics