Apparently a lot of people were interested in my spectrophotometry project! It was picked up by several websites including BoingBoing and HackADay. An update is long 0verdue [ed: HERE], but first some answers to questions I got. A few things I should have mentioned (the -photometer actually uses a transmission diffraction grating, which is what you see in those glasses that put rainbows on everything, [eg, these.] They work slightly differently but the principle is the same.) I also left a lot of detail out because I didn’t think people would be interested. Here’s the dirt:

What about the width of the light source? [BB#3; TO comment from James]

As it happens, the shape of the light source is one of the factors effecting the resolution of the device. When a beam of light hits the diffraction grating, ‘copies’ of it get reflected at different angles, and thus get projected to different locations. If the beam is thick, then the red copy of the beam will also be thick, and will overlap significantly with the orange copies. If the beam is very wide, there will be so much overlap that all colors overlap in the middle of the spectrum, and you get a white blur edged with red and blue.

The width of the light source limits the resolution of the device; a thinner light source gives a higher resolution, because there is less overlap between the 'projections' of each color. In extreme cases, there will be significant overlap of most of the spectrum, and the colors will recombine to form 'white' light everywhere except the red and violet edges. Of course, the smaller the slit, the less light gets through...

You reduce this overlap by making the beam thinner. I do in fact do this; it is unpictured but there is a beam-narrowing slit in front of the spectrophotometer, similar to the one in the spectroscope. The ideal setup is an infinitely bright light behind an infinitely thin slit, but this is difficult to accomplish on a DIY scale, though two razor blades can be a good approximation. I used double-layered electrical tape with a ~1.5mm slit cut in it, further narrowed with bits of aluminum. Also, although a smaller slit means higher resolution, it also lets less light through, which can lead to detector sensitivity issues.

You need to remove baseline detector response! [BB#5]

I did ;D What Anon is saying is that it doesn’t make sense to claim that these data are an absorption spectrum:

this is what happens when you don't correct for instrument response

If I don’t account for the fact that the detector does this when I run blank sample:

The detector response to a sample of water.

These are graphs of the device’s response to water – water is clear so there should be no absorption; the response is purely due to the light’s spectrum and the detector sensitivity.
But what I can do is compare two runs of the instrument- one which doesn’t contain a sample, (I0) and one which does (I). Then, you define transmittance (T) as the ratio between the two:

T = I / I0

Transmittance and absorbance (A) can be calculated from one another:

A = -log(T)

By normalizing the detector response with that of a blank sample, you can quantify how much absorption there is.

Aren’t ‘white light’ LEDs are a poor choice for a light source? [BB#8, 11]

I thought this too for a long time- as I understood it, LEDs give off light only in narrow bands (a red LED, for example, only gives off red and a little yellow, not the whole spectrum.) If the colors aren’t there to begin with, how can they be absorbed by the sample you are analyzing? So I mucked around with halogen bulbs for a bit, without ever looking at the spectrum of a white light LED. This was a mistake: an ounce of data is worth a pound of theory. I can’t get a clean picture through the spectroscope but here is someone else’s. White light LEDs appear to have a fairly broad spectrum, with a band missing in the blue region.This seemed strange to me, especially given that these lights seem to have a blue tinge to them. Why would the spectrum look like this? KeithIrwin [BB#8] writes:

“As I understand it, “white” LEDs are actually blue LEDs with a phosphor coating which absorbs some of the blue and emits red and green (well, two different phosphor coatings, actually, one for red and one for green).”

So some of the blue light gets converted into the other colors, leaving a gap where some of the color was used up. Adding another light source to fill this gap, such as an incandescant bulb, would not be a bad idea.

Why not use a halogen bulb instead of whitelight LEDs? [BB#8]

Remember how I said that you get the best resolution with an infinitely thin slit? The problem is that the thinner the slit, the less light gets through, which is a problem if your detector isn’t terribly sensitive. One solution to this is to make your light source as bright as possible – infinitely bright in the limiting case. A halogen light is not infinitely bright, but it’s up there – and it doesn’t have any gaps like the LEDs do. Why not use one?

Because they’re hot.

I knew this intellectually as I set out, but just how hot they get wasn’t clear until I’d melted through one slit cut out of electrical tape. Fortunately this was before I put the diffraction grating in place, and the grating wasn’t damaged, but placing the bulb inside of a cardboard tube seems like a recipe for disaster, or at the least a recipe for Piping Hot Sample. This could likely be worked around (eg, by placing an IR-opaque window such as glass between the light source and the sample/slit) but within the setup shown, white light LEDs seem to be the best solution to the tradeoffs between heat and light. Halogen bulbs also require AC input, which decreases portability, competes with other electronic devices, and is relatively high power.

How do you calibrate the instrument?

“What I think is the most important he left out is how to calibrate it. You can calibrate the wavelengths with cheap laser pointers (total $15 – $5 for a 650nm and $10 for a 532nm from Hong Kong). Then you can calibrate the levels using photography grade incandescent lightbulbs, just relate the readings to the wikipedia graphs on the blackbody spectrum for the color temperature of your bulb, and use that to more or less correct the response of the photoresistor.” [HaD’s Whoever]

In the images I presented, I reported absorption as a function of the variable ‘sensor position’ – the position of the shadow of the sensor on a ruler taped to a wall. This is a function (in particular, a continuous bijection) of wavelength. The rainbow might get stretched or squished in places, but each wavelength has it’s own sensor position, and vice versa. In particular, the mapping is ‘well behaved’ – although the rainbow might get stretched, it never gets pinched or kinked. No attempt was made to correct for the distortion; this could be potentially problematic by interfering with perceptions of rates of change. Whoever’s comment agrees with my basic plan of calibrating for wavelength: measure light sources with known spectra and use the results to map wavelength to sensor position. Laser pointers would be a good light source, being monochromatic, as would LEDs. You can also add lamps with known emission spectra – Jonathan Thomas uses the spectrum of a fluorescant lamp; there is no particular reason that you couldn’t similarly use other lamps that were available, such as neon signs or sodium vapor bulbs. A spectrophotometer setup might be calibrated with a cuvette filled with a weak colloid (say, a few drops of milk mixed with water) with the light source directed into it. A spectrophotometer has the added advantage of measuring absorption maxima in solutions; additional calibration points could be taken with the absorption spectra of chlorophyll solutions, for example. The more data points the better to build the calibration curve!

Why the calculator? Why not just tape the tube to the meter itself and make it self-contained? [HaD’s NitPickah]

You could do that if you wanted to measure absorption only at one wavelength, but if you wanted to measure across the whole spectrum, you need something that ‘sweeps’ across all wavelenths. The calculator is there to manually move the detector across the spectrum; later generations use a reflection diffraction grating (a CD chip) whose angle is changed by a servo motor. (Stay tuned!)

Why not use a CCD as a detector? [Brett_cgb; TO comment]

Why not indeed. 😀

Why is this built out of trash?

Read this.

Why did you reverse the sample and the monochrometer?

I didn’t get this question from anyone except myself, but I thought I’d mention it. If you look up a schematic of a spectrophotometer, you’ll probably see something like this:

A typical schematic for a spectrophotometer. Click for sauce.

It may not have been obvious in the original post, but the light in my setup passes first through the sample, and then through the monochrometer. In other spectrophotometers, there is often a beam-splitter which divides the incoming light into two beams – one which passes through the sample (I) and one which is passed through a blank sample (I0); detector response to the two are compared to measure absorbance. The monochrome light is what gets split, rather than the original light source – probably to prevent mismatched monochrometers. Since the device I describe measures I and I0 sequentially rather than simultaneously (potentially problematic, but that’s another conversation…) there’s no beam splitter. Beyond that, there doesn’t seem to me to be a lot of reason to prefer the standard arrangement: red light passing through a sample and then being separated out is pretty much the same as red light that has been separated out and then passed through the sample. And there’s reason to monochrome the light after it passes through the sample: you can use it to measure fluorescence and phosphorescence spectra! Just turn off the light source, crack open a glow stick, or a highlighter illuminated with a blacklight, and the sample becomes a light source! Even if you’re not interested in fluor- and phosphorescence, they’d supply emission peaks at known wavelengths, so you can further calibrate your wavelength to motor position mapping.

What other resources are there on DIY Spectro?

Among the designs for DIY Spectro I have found on Teh Intarwubs, mine is fairly steampunk: it involves mechanically changing the detector/monochrometer relationship to physically sweep through the spectrum. I chose this design because I have in mind low cost colorimetry technology- potentially very useful for education, community environmental monitoring (especially in third world), and DIY research. Most other DIY Spectro projects seem to use an approach in which the spectrum is projected into a digital camera, and the photograph analyzed. I didn’t take this route because I was concerned how well the camera would function as a detector (pretty well, it turns out), higher costs (though not *that* much higher; some examples below use cell phone cameras), and lower rewards for the applications in mind – it seems to me like overkill if you just want to do colorimetric pH determination, for example. In other situations, though, this could be a great setup. Here’s a quick survey of other resources out there; if you know of any others that should be included let me know!

Good reference on how to build a spectroscope based off of a digital camera as a detector. Also great resources on processing the data!

Uses a cell phone camera to photograph the spectrum; the resulting image is analyzed. Presented as an educational kit; gives some good background to the mechanics of the detector. Creative Commons License! Yay!

Similar to my design; uses a photoresistor to measure transmission of light. Set up primarily as a Beer’s Law measurement device; spectrophotometer design is left open-ended. Educational focus.

A similar setup to my current one, using an Arduino, CD chip, and stepper motor as a computerized monochrometer (measurements are taken by hand, however they do use a graphing calculator to process the data :D) They claim that CDs are inferior diffraction gratings, though I don’t see why and they provide no resources. Write that “the stepper motor I’m using takes rather big steps, resulting in rather big wavelength-jumps.” I ran into the same problem when I first added the motor.

Use an Arduino-based spectrophotometer. LEDs of different colors are lit one by one and detector response recorded, so it doesn’t capture the full spectrum, but for some applications you might only be interested in a handful of wavelengths. Video here.

Uses a transmission diffraction grating and a digital camera; includes an app for analyzing digital spectrographs.

Uses a CD chip as a diffraction grating and a digital camera. Lots of examples of spectra!

Another design based upon measuring the absorbance of the sample at a selection of wavelengths using LEDs as monochromatic light sources. Interfaces directly with a USB cable rather than using a microcontroller.