Kevin's Digital Camera Spectrometer
This is a dirt-simple spectrometer based on a digital camera, a slice of CD-R for a grating, and a piece of optical fiber to carry in the light and act as an entrance slit. The idea was to produce a workable spectrometer out of common, cheap items, assuming that a person already has a decent digital camera. Most of the complexity of the device is the software I wrote to harvest the spectra from the images and then analyse them.


The spectrometer consists of a black-painted steel sheet (cut from the "lid" of a VCR) that has been screwed down to a sheet of wood. The CD diffraction grating assembly and the entrance slit assembly are held to the steel sheet by powerful hard drive magnet plates that have been screwed to the bottoms of the assemblies. This allows the assemblies to be moved and adjusted, but also causes them to "stay where they were put". The camera (a Nikon CoolPix 995) is bolted to the board and plate with a bolt, wing nut, and washer which fits the standard "tripod mounting screw hole" in the bottom of the camera. The rear of the camera is made even and parallel with the edge of the black steel plate.

The "CD slice" diffraction grating assembly as seen by the camera. The CD slice is screwed onto a piece of wood, which is held to the black steel sheet by a hard drive magnet plate. You can correct "tilt" in the spectrum (spectrum is not perfectly horizontal across the image) by rotating the CD slice about that screw you see at the bottom. You can move the spectrum left and right in the image by rotating this whole assembly about its vertical axis (perpendicular to the black steel sheet). We are looking at the label side of a unlabeled CD-R that was carefully cut with a dremmel tool, here. By using the label side, we have a more-or-less "first surface" reflector. This means that the light does not have to go through the (relatively thick) acrylic of the CD, which would produce multiple images of the spectrum lines, as we got various reflections back and forth between the two surfaces of the acrylic.


Two images of the entrance slit. The black "wire" coming out the back of the slit is a black-plastic-clad fiber optic light pipe with about 50 strands in it. The strands have been arranged in a vertical single-file column between two pieces of electrical tape. This assembly was then strongly pinched between two copper flanges from a large contactor and wrapped with more electrical tape. This assembly was then mounted onto a piece of wood as shown. The wood has a hard drive magnet plate screwed to the bottom. Note that the diameter of each individual strand / fiber of the light pipe is 10 thousandths of an inch (.010"). Obviously the resolution of this device could be improved by putting a razor blade slit in front of the fibers. I will try this the next time I get some free time.

A wooden lid completes the project. The gaps between the pieces of wood have strips of black felt pinched between them to make it light tight. There is a big opening in the front where the camera is. This is covered with a big flap of felt, to keep the light from leaking in around the camera. The big felt flap can be easily lifted to see the camera's LCD display. The little felt flap at the top where the big felt flap attaches covers a 1 inch hole that is positioned above the camera's shutter release button. To fire the camera, lift the little flap, quickly remove your finger and shut the little flap, and pull your hand away. This can all be done in the second or so it takes the camera to "get ready" to take the picture. That way, you are not touching the assembly during the picture - no vibrations!
Unfortunately, adjusting the time exposure time of the camera can cause the camera to rotate very slightly between pictures, causing misalignment of successive spectra. This was cured by using a laptop and a serial cable to control the camera remotely. Now, exposures and exposure times are all controlled from the laptop - I never have to touch the camera, so I don't push it out of alignment between pictures! The camera control program I use is a wonderful little program I found on the web called The Force. It lets me very easily set exposure times and snap pictures all from the computer, so I don't have to even touch the camera.
After each exposure, I lift the big felt flap to see how the picture turned out (you get a little time to look at the picture while the Noise Reduction "reference photo" is being taken and processed). From this, I can tell if I need to increase or decrease the exposure time for the next picture.
In order to save the camera batteries (there are often large time gaps between pictures as I set stuff up), I run the camera off of an AC adaptor hooked to wall power. This consists of an old PC computer power supply that I modified to output the correct voltage (8.4 VDC for the CoolPix 995).
Before and after taking a set of spectra, I take one or two mercury spectra, using a mercury lamp powered by a neon sign transformer or microwave oven transformer. It does not need to be bright at all. Here is an example set of mercury reference spectra, using longer and longer exposure times for each one:

Scroll left and right - the spectrum images are wide. Note the clear separation of the yellow lines in the uppermost spectra. In order to be able to see the fainter lines, it was necessary to use longer exposure times, which caused the strong yellow, green, and purple lines to bloom and wash out badly. The range of the camera is not as large as it could be. It appears that the people who designed the digital camera did not do it with spectroscopy in mind... :-) For this reason, I generally take two or three images of each spectrum - a short exposure, a medium exposure, and a long exposure. That generally allows me to get at least one "clean" version of each spectrum line, be it a strong, medium, or weak line. The big red arrow shows a flaw with this system - a pair of green lines where they "should not" be (lines in that area should be aqua/blue colored). This is probably a pair of lines from a higher order spectrum. That's what happens when you use a slice of CD as a grating, rather than a $1000 diffraction grating. These lines could be fairly easily removed with a little image processing based on "knowing" what hue "should" be at each X-position of the image. Any lines that are the wrong hue could be subtracted from the image.

Here is a mercury reference spectrum and then a pair of spectra of the light produced by exploding a small piece of copper wire in air with an enormous pulse of electricity. The copper lines are plainly visible. In this case, different exposure times are meaningless, since the entire "wire explosion" lasts only a few microseconds. The upper copper spectrum is brighter because I put the end of the fiber optic light pipe closer to the exploding wire, so it would collect more light.
Unfortunately, there is a little non-linear distortion in the spectrum images. I don't know if it comes from the optical system of the camera, or what. Fortunately, it's easily corrected. My analysis program lets you click on the leftmost yellow Hg line (579.1 nm), the Hg green line (546.1), and the Hg 404.7 nm purple line, and it automatically calibrates itself and detects and corrects for this distortion, based on the positions of those three lines.
If there is interest, I will post my spectrum harvester and analyser programs, so other people can try them out. Note that this is not commercial "clean" software - it's just programs I have written for my own personal use...