The SpectraCam Project: Revision 5.

Welcome to the SpectraCam: Revision 5 project page hosted by Walla Walla University. This project was developed and is maintained by Dr. Tom Ekkens. If you have comments or suggestions please send email to tom.ekkens@wallawalla.edu. This page was last updated on November 19, 2017.

Spectrometers are available in a variety of types and costs.  A simple one can be made with a cardboard box and a piece of DVD.  Commercial ones use a computer to acquire data and cost hundreds or thousands of dollars.  Public Lab (publiclab.org/wiki/spectrometry) has an excellent version that can be purchased and built.

This project uses the camera section of the Public Lab spectrometer but changes the housing and software.  The goal was to make the housing strong enough that it could be used for general use.  The housing was also extended to improve resolution.  New software was written that can be used without an internet connection.


Bill of Materials

DescriptionPart NumberCostSource
2x 1½ ABS cap012871529771$2.56Home Depot
11¼” of 1½" pvc conduit722669$4.77Home Depot
2" ABS right-angle611942029051$2.85Home Depot
1½ to 1½ Flexible Coupling018578000032$3.90Home Depot
Flexible Cap018578000483$2.97Home Depot
USB 2MP webcamJDEPC-OV05$30.00Public Labs
Flat Black paint020066197674$3.63Home Depot
Plastic Diffraction Grating 1000 lines/mm$5.00Ebay
Black Card Stock759598993705$8.26Walmart

Set up the Camera

  1. Remove the lens from the camera.
  2. Turn the lens housing over and remove the reddish glass.
  3. Spray with compressed air to clean and reassemble the lens to the camera.
  4. Plug in the usb camera to a computer running Windows 10 - 64 bit.  
  5. Copy “SpectraCam.exe” and “opencv_world330.dll” to the computer.  The file “opencv_world330.dll” is part of the OpenCV 3.30 package.  The file “SpectraCam.exe” can be obtained by emailing the author of this page at the address above.
  6. Start SpectraCam, check “Full Image” and “Camera On”.  You should see the live image from the camera.  If not change the USB Port from 0 to 1.
  7. Once you have a good image, set the focus to about 11 inches.  Work slowly, the image is averaged over a few seconds.
  8. Prepare the diffraction grating.
    1. Cut a 5 mm x 5 mm piece of diffraction grating to fit over the camera.
    2. Orient the diffraction grating so that light is bent along the long axis of the camera board.
    3. Put a tiny bit of black paint on the camera housing and glue the diffraction grating down to the top of the camera.  Do not get so much paint on that the camera hole is covered.

Machine the PVC

  1. Drill a hole in the center of one of the ABS caps.  This will now be referred to as the front cap.  
    1. Use a 0.0217” drill bit and try to put the hole as close to vertical at the exact center as possible.  Be aware that the drill bit is very fragile.  
    2. Use a 0.0276” drill bit by hand to make the hole a bit bigger.
    3. The completed part is shown in the picture below at left with the location of the hole indicated by the red arrow.
  2. Drill a hole at the end of the other ABS cap.  This will now be referred to as the back cap.  
    1. Use a 3/8” end mill bit to drill a hole 0.75” deep moved in 0.10” from the outside wall the cap.
    2. The completed part is shown in the picture below at right.
  3. Prepare the PVC tube.
    1. Use a saw to cut a piece of 1½ inch PVC conduit to a length of 11¼”.  (This lets one sheet of paper sit in the tube without bumping.)  Smooth the ends of the cut if desired.
    2. Clamp the tube into an end mill, load the 1/8” end mill bit and follow this recipe:
      1. Move to the left end and zero the y-axis.
      2. Move in 1.3”, find the center by just touching the top.  Zero x and z at that point.
      3. Drill all the way through and then go 0.15” in each direction in x.
      4. Move up to -0.07” in z, and right to 1.33” in y.
      5. Repeat the 0.15” in each direction in x. 

Assembly

  1. Obtain an 8.5 x 11 piece of cardstock.  On the short side, measure in 100 mm and cut a slot 8 mm x 32 mm.  Cut 19 mm of the tab off.  The slot and most of the short side of the paper are shown in the picture at right.
  2. Roll the cardstock up and slide it into the tube from the front end (opposite the milled hole). Make sure the slot in the paper goes around the milled hole.
  3. Remove the hose clamps from the flexible coupling and slide it over the tube into the approximate center of the tube to that the milled slot is still visible.
  4. Slide the front cap unto the tube and lightly push it down.
  5. Slide the camera into the slot so the circuit board is just even with the surface of the tube.  Align the white usb plug to the center of the tube.  

Alignment Check

  1. Plug in the camera to the computer.
  2. Start the software, check “Full Image” and turn on the camera.
  3. Aim the tube a fluorescent light.  You should see a picture similar to the one at the right.
  4. If the colored dots are not close to a horizontal line, you will need to rotate the camera focus knob slightly to get them as close to horizontal as possible.  If the dots slope down, rotate the camera lens slightly clockwise.  If the dots slope up, rotate the camera lens slightly counter-clockwise.
  5. Once the dots are horizontal, hot glue both ends of the camera to the tube if desired.
  6. Slide the back cap over the white usb plug and push it on until it touches the white plug.
  7. Attach the usb cable to the camera.
  8. Slide the 90 degree elbow over the end cap with the opening opposite to the usb cable.
  9. Hot glue the elbow to the end cap and the end cap to the tube with four spots of hot glue each.
  10. Glue the usb cable at two locations to the right-angle pipe.
  11. Insert the flexible end cap into the elbow to keep the cable from moving and seal out the light.
  12. Slide the coupling over the milled slot to keep out the light.  The finished assembly should look about like the picture at the top of this page.

Calibration

  1. Start the SpectraCam program and point the spectrometer at a fluorescent light.
  2. Click the “Start” button to begin capturing data and once again to end capturing data and hold the last data.  You also can use CTRL + Space Bar to toggle the camera.  You should see a picture similar to the one below.  If a warning message about the camera not being found appears, change the “Camera #” from 0 to 1.
  3. With the camera stopped, press the “Auto” button.  The two numbers in the “Blue” and “Red” boxes should change slightly.
  4. Check the quality of the calibration by selecting “Fluorescent Light” from the dropdown box titled “Fit”.  This will add colored bars indicating the expected peak location to the line scan. Many of your peaks should line up with the bars.  (This calibration data is adapted from https://www.nist.gov/pml/handbook-basic-atomic-spectroscopic-data ).
    1. The first order lines are shown in red and the second order lines are shown in green. 
    2. You can adjust the “Blue” or “Red” numbers slightly to try to make the peaks line up better.
    3. The camera doesn’t show all the lines since it only has a range of 380 nm to 900 nm.
  5. Once the camera is calibrated, these two numbers should be entered for each set of data.
    1. The calibration data scan be saved to the local computer by using the the “Save Calibration” entry from the menu accessed by left-clicking on the upper-left icon.
    2. Moving the camera to another computer will require the numbers to be entered by hand but will not require another spectra of the overhead lines to be taken.
  6. The “Brightness” dropdown box can be used for dim samples.
  7. Data Saving.
    1. The data can be saved using the “Save As” entry from the menu accessed by left-clicking on the upper-left icon.  This data can be loaded back into the SpectraCam software and modified.
    2. The data can also be exported as columns of numbers from that same menu.  Once it is in that format, it cannot be loaded back into SpectraCam.
    3. Also from that menu, the view on the screen can be saved to a PNG file.  The resulting file cannot be loaded back into the program.

Using the SpectraCam

Once the SpectraCam is completed, it is time to use it and measure things.  The most obvious sample is the fluorescent light that was used for calibration.  In the picture below, the red and green lines are the expected values for the first and second order lines.

 

In the picture below, a sodium street light bulb has been measured.  The strong yellow line is actually two lines so close together that they appear as a single line.

 

In the picture below, a neon sign has been measured.  This section of the sign was mostly orange.  The expected values have been added again.

 

Finally, we have data from a blue LED shown below.  From this picture we conclude that the transitions that the electrons make in a semiconductor must be less restrictive than those in a gas but that is another story.