[PublicLab] Calibrate your spectrometer in Spectral Workbench (#13410)

16 views
Skip to first unread message

notifi...@publiclab.org

unread,
Dec 29, 2020, 12:17:22 PM12/29/20
to notifi...@publiclab.org

Calibrate your spectrometer in Spectral Workbench

Read and respond to the post here: https://publiclab.org/notes/warren/09-01-2016/calibrating-your-spectrometer-in-spectral-workbench


Goals

In Public Lab's spectrometry project, we've long used compact fluorescent lamps (CFLs) as a reference to wavelength calibrate our DIY spectrometers. This guide will show you how to do this in about 15 minutes.

I believe that if your spectrometer is properly constructed, you should be able to get to about 1nm resolution -- complete the activity and post your results to help determine if this is true (read more here)!

What you'll need

What we're doing

Basically, when you look at a graphed spectrum (as in the image above), you see a graphed series of intensities for each color along the spectrum, but the first time you do it, you won't see the wavelengths labelled in nanometers. This is because we just start out with an image from the webcam in the spectrometer, and don't know exactly which pixel of the image is at which frequency of light.

8278433432_1a36004196_o.png

A CFL bulb is filled with mercury vapor, which when energized, emits a really well known spectrum, and one with very sharp, recognizable "peaks" -- as shown in the image above. These peaks always happen at the same wavelength, so we can recognize them by color and order, and compare our spectrum to a known reference to figure out the wavelength of each pixel of our spectrum.The two peaks we look for are:

  • the mercury 2 line - "B2" at ~435.8 nanometers
  • the mercury 3 line - "G2" at ~546.1 nanometers

Video

There's a video walkthrough of this process here:


This 10 minute video goes into greater depth on how calibration works and how to do it well:


Let's start!

Step 1: Open SpectralWorkbench

Plug in your spectrometer. Log into Spectral Workbench with a PublicLab.org ID and navigate to the Capture interface at https://spectralworkbench.org/capture.

Follow the prompts to connect to your webcam -- if it's running, you should see either a black image or some rainbow patterns from stray light. Don't choose a cross section yet, though! It'll be helpful to do this while pointing it at a CFL bulb.

Step 2: Image the bulb

Find a CFL bulb -- the spiral type is pretty common, as shown below. Point your spectrometer at it, watching the Capture window to see when the rainbow of your CFL bulb spectrum appears as in the example. If you've built your spectrometer correctly, you should be able to select a cross section of the image that cuts right through the middle of the spectrum.

IMG_20160907_142607-2.jpg

This step can be tricky -- it's good to be within a foot of the bulb or you might miss it, but it can also be too bright, and your colored peaks will "blow out" and have flattened peaks. Then we won't be able to find the very top of the peak -- so if this happens, try shining the lamp closely onto a piece of white paper or on the wall, and pointing the spectrometer up against that.

Overexposure

Note that if your peaks /are/ "blown out," they'll look like the image below. Notice that the "color channels" represented by the blue, red, and green graph lines are hitting the "100%" mark and are really not recording data anymore, they're just completely saturated:

Screenshot_2016-09-07_at_2.58.12_PM.png

If this happens, checkout these tips for reducing exposure.


Step 3: Calibrate

Once you have your CFL spectrum image saved, you'll see a blue button below marked "Calibrate" -- click it!

Screenshot_2016-01-28_at_5.36.06_PM.png

As you can see in the above screenshot, you're presented with two sliders, and a reference spectrum, a pre-calibrated spectrum which is actually a version of @cfastie's "snowsky" CFL calibration, one I've used a lot as it's super sharp and has very low noise.

  1. When you click Calibrate, it will attempt to auto-calibrate or "guess" -- trying to automatically line up the two spectra. If it looks good, just click "Save."
  2. If not, drag the sliders yourself. The "Snap" checkbox will make the sliders "stick" to nearby peaks.
  3. Once you have a good match (the colored lines or "peaks" in the two spectra are lined up), click "Save."

calibrating

Your calibration will be shown as linearCalibration in the Operations table below. If you want to try again, be sure to delete the previous calibration -- and make a new one. Don't make two calibrations!

Note: The system sometimes does not handle image reversal well. Sometimes horizontally flipped images can cause problems, so if it looks like the auto-calibration is opposite -- i.e. right to left instead of left to right. If this happens, you could try to "Set new cross-section" which will get fresh graph of data out of the image. We hope to solve reversal problems once and for all in an upcoming version.

How good is your calibration?

You may notice the green indicator that says "FIT" to the right. This is an attempt to compare the expected ratio of three known peaks to the peaks found in the image. Unfortunately, it has some shortcomings, and we'll probably be switching to a root-mean-square error approach, where we compare a much larger # of points to those of a known spectrum, after height-adjusting for the baseline and maximum peak height. We'll see if that works better, but for now, please be aware that the "FIT" indicator is not that reliable.

How often to calibrate?

It's good practice to calibrate at the beginning of each session of using your spectrometer, at a minimum. Some people may calibrate at the end too, to ensure it hasn't drifted during your tests. If you find that your calibration holds (by comparing a set of previous calibrations) you may not need to as often. But if you pack it up, travel with it, or modify it, you should definitely re-calibrate to be sure.

Cross-section

If you change the cross-section line (in the steps on the Capture page) and your spectrum is not perfectly straight, a different cross section could move your spectrum left or right, and ruin your calibration. Be sure you're using the same cross section!

Copying calibrations

What now? Once you've calibrated a single spectrum, you'll be able to apply that calibration to all of the spectra you've collected with that instrument (as long as you don't change anything, like the cross section). Since both images are the same size, Spectral Workbench will copy over the wavelength position of each pixel from the calibration image to the new image, and your spectrum will then be calibrated.

Resources

This page was adapted from these two older pages, which have some more details, especially on cross sections and brightness control:

Replicating this activity

Try it out and leave a response here, whether you need help, or if you've successfully gotten your spectrometer calibrated! And link to your spectrum so we can see how you did. And if you see a way I could improve this guide, please leave a comment!

Respond to the post here: https://publiclab.org/notes/warren/09-01-2016/calibrating-your-spectrometer-in-spectral-workbench


This post was tagged with #spectrometry by warren

You received this email because it was tagged with: spectrometry.

Subscribe to all the tags for this post by visiting https://publiclab.org/subscribe/multiple/tag/spectrometer,spectrometry,guide,response:12258,cross-section,activity:spectrometry,difficulty:easy,seeks:replications,activity:dssk,activity:foldable-spec,time:15m,response:748,status:review-me,category:verify,parent:spectral-workbench-calibration,activity:papercraft-spec,pin:activity:papercraft-spec,pin:spectrometry.

To change your preferences, please visit https://publiclab.org/subscriptions.

Report spam and abuse to: moder...@publiclab.org

Check out the blog at https://publiclab.org/blog | Love our work? Make a one-time or recurring donation at https://publiclab.org/donate If this email title has an ID in the format #0000, you can reply with the email you use at PublicLab.org and your response will be posted as a comment on the website.
Reply all
Reply to author
Forward
0 new messages