Tuesday, January 25, 2022

Spectrometer

 Throughout the summer I had been recording some very high air quality readings on my weather station, This is a terrible situation for anyone with breathing issues. Personally, I do not have such issues (yet) but I like to know what is floating around in the air at any given time so that I may not develop such issues.

I had started to notice that whenever the air quality was particularly bad, that we would have some of the most amazing sunsets ever granted for human eyes to ever behold. This got me doing some research and I found out that the California wildfires were the cause. The smoke was literally working its way across the country and causing breathing problems thousands of miles away.

So it was all smoke that was making the sunsets so nice. Immediately I had thought about something I read some time ago about how astronomers use the light from a star passing through the atmosphere of a planet to determine what the atmosphere was made of. This begged the question, "Could I look at the light from one of these sunsets to see what was in the atmosphere between me and the horizon?" 

I would imagine that I would need something that could split light into its components, then I could take pictures and compare them with a clear day and see at very least the difference. I started mulling over a design in my head. I would need some sort of prism, and an adjustable aperture, and perhaps a plate to project the scattered light onto. A small hole with a camera could be fashioned to record things.

I took to the internet and quickly realized that other people have been collectively working on a DIY spectrometer for some time. As always I was late to the game but this allowed me the luxury of having most of the work done for me. Even the software was freely available.

The effort is called Theremino. If you scroll some way down on their page you can find the blog entry about the spectrometer. Or you can just go directly to this article and it will explain things,

In a nutshell, its really just a box with a slit in it to allow light to enter. The box has a webcam in it with a diffraction grating to split the light. Make sure the inside of the box is as dark as you can get it. That includes making the interior black. Software on your computer looks at this real-time picture and it allows calibration to associate where different bands of light are and maps then to a wavelength of light. Once calibrated I was astonished at its accuracy.

I won't speak too much of the particulars of how, why, & what does all of this. Just download the software and play with it. I will however outline my version of this DIY spectrometer.

A few things were needed before I could start playing. A webcam and a diffraction grating. 

I had considered using a prism that I have but in reality it is just too bulky and doesn't allow for the simplicity that a diffraction grating has. When selecting a diffraction grating you want to select anything that is at or above 1000 lines/mm. I  believe this one would work. 

As for the webcam. I had picked up 3 or 4 of them at Microcenter since they were only four dollars each. There is a Microcenter close to where I work so it was just the natural selection of place to purchase from.

One note about webcams is that if you want to read infra-red light you will either need a webcam that can see this or remove the filter from the webcam that cannot. You'll have to do your own research for this. Because I had so many webcams that I had purchased I sacrificed one to see if I could find the IR filter in the optics. I did not immediately see anything of the sort so I merely hoped for the best.


Here you can see my rough prototype, using a box I slapped together with some 2x4's and old Pergo flooring. The aperture is two razor blades I fastened over a hole using painter's tape. The Theremino software is running, although not calibrated. I had used the Infra-red light on my security camera to test if the webcam was sensitive to that light and as you can see there is a spike indicating that it is.

At this point things were loosely cobbled together. You couldn't even move the box lest you screw all the adjustments up. I needed a way to secure everything properly and make it in someway articulating to allow for pointing it at a light source.

This is when it is nice to have a 3D printer at your disposal. I used a pretty neat free online CAD site called TinketCAD That allows you to import and create 3D objects. I knew I wanted the aperture to be adjustable and have the precision of a razor's edge, so I found a 3D file for a razor scraper and modified it a bit and created a holder for it. Also I wanted something that I could mount the camera to that would also hold the diffraction grating. Below I have provided a link to my STL files. You might have to manipulate them to suite your own needs.




Here you can see the assembled aperture in place. I had created screw holes but in the end I just ended up gluing them to the front of the scope. Things were a little loose so I jammed some folded cardboard behind the sliders. After all its not rocket science, I just want it to be able to roughly adjust how much light gets in.




Moving to the inside of the spectroscope, you can see my camera mount and diffraction grating holder. Just a note here that a lot of the literature I read says that you need about a 30 degree angle to the incoming light to get the proper spectrum on your webcam. I designed the mount with a screw hole so things an be adjusted. The black construction paper is there to cut down on any sort of glare. In my experience this doesn't do much. If the light is bright enough it will glare.


Since I was planning on pointing this at the sun, and shooting lasers at it, I anticipated that glare, and proper light alignment might be an issue. So I installed this diffuser. This is made from an old alcohol bottle that I cut up. I merely velcro'ed it to the aperture holder so I could remove it in darker conditions.


Finally I mounted the whole thing onto an old telescope mount I had picked up at the thrift store. This allows me to move the entire assembly around.

Calibration was a little tricky in the beginning, before I had installed the light diffuser. You can see the results before and after the diffuser was installed. There is nothing too complicated about calibrating it. The software has designated markers for a few different types of light. The best being a florescent CFL bulb. These bulbs have very specific wavelengths of light that you can place markers on. Ones that is done I have noted that my spectrometer is accurate within a nanometer. More on that in a bit.

Here you can clearly note how much glare there is. The spectrum repeats itself and falsely reports light in the infra-red range. The software allows you to "tighten" the view boxes that it looks at. This helps a little but would completely ignore upper and lower bands depending on how you have things adjusted.


 Once the diffuser was installed the spectrum looked a lot cleaner. And the CFL bulb had clearly defined peaks that I could place markers on. Now that it was properly calibrated, we can verify by shooting some lasers at it.

Every laser I have had the pleasure of playing with has always had power and wavelength clearly labeled on it. Using this information I could compare what what the manufacturer lists alongs with what I can read with my new spectroscope.

This is my green laser. It was dead-on at 532nm. There was some glare since it it an 80mw laser.

Next was a cheap red laser that had a "range" of what it emitted. Its escapes me as to what those numbers are but the peak was near the center of this range. I was satisfied with what I was reading and was confident that I could successfully identify the wavelength of the light entering the scope.

Now it was time to see how sensitive the scope was to infra-red light.

This is the IR spotlight from my security camera.


This is a UV LED


I was curious how close to the spec my grow light was. As you can see this is before I had the diffuser installed.

Things were VERY close to the manufacturer's spec.

Finally I took everything outside on a clear day to get some sunlight.

I believe that same day we had a full moon and I decided to capture the moonlight. The aperture was nearly full open to gather enough light to get a sample. I found it interesting that there seems to be less green light. I would have anticipated that the sample would look just like the full sun.

This was a very fun project with good intention. However, by the time I got everything built and calibrated properly the summer was long over and the wildfires were under control enough so as not to cause us ill effect here in New Jersey. We are just going to have to be happy with our own home grown pollution for now. That is until California catches fire again next year.

More to come on this next summer I hope.




No comments:

Post a Comment