Box of Rainbows

This is a device that can accurately measure the different wavelengths that make up a beam of light. It’s useful for identifying materials, characterizing light sources, and calibrating other devices. You can even tell what stars are made of using this!

I had found some guides online about how to build a very simple spectrometer, but I wasn’t happy with the optical setup (there was none) or the software suggested, so I made my own.

The device works by accepting light through a narrow slit and collimating it. This light is then passed through a filter called a diffraction grating. The filter has a bunch of grooves in it that cause different wavelengths of light to interfere with each other. This creates a vertical line pattern and separates the colors. The light is then focused down onto a camera and the intensity is measured.

Daylight fluorescent
iphone LED
Warm fluorescent
RGB Lasers

I used some math to figure out the best optical arrangement based on the grating and lenses I had. I ended up ordering some new lenses with better specifications to make the device more efficient. Entrance slit was about 50-µm which is pretty huge, but helped with the low light issues in the camera.

The software was written in processing (java). I used a cubic equation for calibration based off regression analysis of data gathered from a known light source.

On capture, the unit uses a dark frame, spatial, and temporal integration (averaging) to get a clean signal. Polynomial smoothing was applied using a selection of convolution kernels (blue line). Peak detection based on a moving window was used to find and highlight the strongest spectra, which can help you identify different elements.

I was able to get down to 5nm per pixel of spectral resolution. However I had no calibrated radiance light source, so the intensity information is only relative (and arguably not even that). A good example of this is illuminant A, which on my spectrometer appears as a hump rather then a ramp (not shown). I do have matching data from both a high-end spectrometer and mine of the same source, which I could use to calibrate it.

I’ve been working on a new version that will be more accurate. This will use a custom built camera based around a linear CCD sensor. In previous builds I was using a webcam with a cmos sensor. These are particularly noisy in low light situations and not very sensitive. The linear CCD provides great low light performance with about the same accuracy, and has no filters over it. I also want to make use of reflective optics (instead of refractive) to avoid the chromatic aberration problems introduced with lenses. This would include a reflective holographic grating.