Introduction: A Simple DIY Spectrophotometer

What's all this?

This instructable will explain how to build a fairly basic but working spectrophotometer out of easily sourceable parts.

Of course, this device is nothing compared to a commercial spectrophotometer, but it will allow the builder to understand how such a device works.

Huh? What are you talking about?!

A spectrophotometer measures the amount of light that a certain sample absorbs. 

The basic principle:
  • A beam of light passes through a prism or diffraction grating.
  • Out of the resulting spectrum, a certain (range of) wavelength(s) gets selected by sending the light through a slit.
  • The light passes through the sample and hits a detector.

This way, one can build a "spectrometric fingerprint" of a certain sample that will depend on the molecules in the sample.

Cool, let's do it!

I'd once again like to emphasize that this device is certainly not to be compared to a commercial system, but if you're looking for a fun project that will enable you to learn something more about the workings of a spectrophotometer, this project is for you!

Step 1: Sourcing the Parts

Most parts are fairly easy to obtain.

You will need:

For the stepper circuit:
  • A stepper motor
  • an Arduino (or a stepper driver circuit)
  • 2x 10k resistor
  • 2x 1k resistor
  • L293D H-Bridge
  • 2x NPN transistor (I used the BC547A)
  • A power supply

For the detection and amplification circuit:
  • an op-amp (e.g. TL081)
  • LDR
  • 1x 2k2 resistor
  • 1x 4k7 resistor
  • 1x LED

General parts
  • A base (some kind of board such as a cutting board to mount everything on)
  • Cuvette
  • Diffraction grating, CD or DVD
  • Lightbulb and / or white LED
  • Metal or cardboard plaques
  • Some connectors
  • Some pushbuttons

Step 2: Bring on the Photons!

Light source

First of all, we need a light source. Some possibilities include a small lightbulb or white LED. I installed both, so I could experimentally decide which one was best suited for my purposes.

To construct the light source assembly, find some piece of plastic (or any other material, for that matter) and glue a bulb socket to it.

For the LED, find some kind of connector (I cut off part of and old IDE-connector) and solder some wires to it. Also include a 2k2 resistor in series with the LED to limit the current.
Glue the LED-connector somewhere near the bulb, and put in a LED.

Step 3: Diffraction

Splitting the light

To be able to select a certain wavelength (the color of light depends on its wavelength) we first need to split the light into a spectrum.

This can be accomplished by a diffraction grating. Since most people don't have diffraction gratings lying around the house, a CD can be used as well.
Take a look here for some background information. 

Note that a CD does not exactly produce an even spectrum, so it'll give nowhere near as accurate results as with a "real" diffraction grating.

Selecting the wavelength

Since we want to measure the absorbance of the sample at a certain wavelength (or in this case, range of wavelengths) we need to be able to select a certain part of  the spectrum.

This can be accomplished with a "slit", i.e. a sheet of cardboard or metal with a narrow slit in it. 

To choose which part of the spectrum passes through the slit we can vary the angle with which the light hits the CD.

I chose to use a stepper motor because it can be turned in discrete steps.

Driving the stepper

The stepper motor can easily be driven with an Arduino board. Construct the bipolar stepper driving circuit found here and use the included Arduino-code "spectrostepper.pde", the motor can be controlled by two pushbuttons.

Construct the driver circuit. Then, add pushbuttons by connecting one leg of a 2k2 resistor (pull-down resistor) to ground, connect the other leg to one leg of the pushbutton AND to a digital input on the Arduino.
Then, connect the other leg of the pushbutton to +5V from the Arduino.

Connect the motor itself to a power source, load the sketch in the Arduino and drive the stepper!

If everything went right, the motor should turn 1 step when you push a button; direction depending on which button you press.

Bringing it together

Once you got the stepper going, connect the CD to the motor. (I, once again, used hot glue) 

Step 4: Selecting the Wavelength

The slit

To accurately select a very small section of the spectrum, one would have to make an extremely narrow slit. Since this is very hard to do at home, I chose to make two slits instead that are not 100% aligned, so only a very narrow band of light can pass through.

Make a small slit in a piece of metal or cardboard. (I used the grinding wheel attachment of my trusty Dremel 4000)  
Then, with the light source and CD in place, project a spectrum onto the board and make sure that all parts of the spectrum can be aligned with the slit, depending on the CD's angle.
Now glue the board to the base.

Make a slit in a second piece of material, and align it with the first slit, so that only the narrowest band of light can pass through.

Also it's best to shield the light source from the rest of the device using a piece of metal or cardboard, so that only the diffracted light will hit the slit.

Step 5: Detecting the Light

Amplification circuit

To detect the light that passes through the sample, we're going to use an LDR, or Light-Dependent Resistor.
Though it would be possible to obtain readings by connecting an ohm-meter straight to the LDR, it probably is a better idea to construct a basic amplifier allowing us to use a voltmeter since this will provide bigger differences between slight changes in detected light intensity.

Assemble the amplifier according to the circuit. I used a TL081 opamp. Then measure the voltage between 0V and Output; this will vary depending on the light falling onto the LDR.

Putting the "L"in LDR

Place a cuvette or test tube just behind the slit. Now, glue the LDR in place so that the light passing through the cuvette will hit the LDR.

Step 6: Let's Measure!

Working in the dark

Because the LDR reacts to light, you'll have to make sure to work in as dark an environment as possible to prevent any stray light from hitting the detector.
You could put the whole device in a dark box, or darken the room you're working in.

Blank measurements

Since the LDR reacts differently to different wavelengths of light, we need to make blank measurements before we can go any further.
To do this, fill the cuvette with distilled water (or any other solvent you plan to use) and note the voltage reading for each wavelength or light color you pass through the cuvette.

Real measurements

After the blanks have been measured, fill the cuvette with the solution you want to measure. Then, for each wavelength or light color, note the voltage reading. Be sure to use the same light color as you did during the blank measurements. (i.e. make sure that the CD is in the same angle and / or that the color of the light passing through the cuvette is the same as during the blank measurements)

Now you can calculate the absorbance, according to the Lambert-Beer law. A = log (I0 / I) where I0 is the intensity of the light falling into the cuvette (i.e. the blank) and I is the light passing through the sample.

(the attentive reader will notice that the multimeter always reads 8.16 on the pictures; this is because the photographs were taken in daylight rather than a pitch black room)

Step 7: Some Results

Measuring dyes

As a first test, I decided to measure some samples of food coloring and methylene blue. I don't have a lot of data points because the stepper motor I'm using takes rather big steps, resulting in rather big wavelength-jumps.

Also, because the unit is not calibrated in any way, I have no way of telling exactly which wavelength I'm measuring at any point.
The only cue I have is the color of light, which can roughly be matched to an approximate wavelength.

As you can see, the results aren't all that bad, considering the very low number of measurements taken.
It's clear that the yellow dye does not absorb much light in the green/yellow wavelength region. The blue dye seems to absorb anything but blue, and the green dye has an affinity for blue and red light, letting green pass through.

Step 8: Afterthoughts / Possible Improvements

Although I'm quite pleased with the results so far, some steps can be taken to improve the device.
  • Using a stepper motor with very small steps (to increase control over the wavelength)
  • Using a real diffraction grating instead of a CD (to improve the spectrum)
  • Calibrating the device by sending light of known wavelengths through the detector
  • ...

All in all, it's been a very worthwhile project and I will probably continue to work on it to try and improve the device as much as possible!



bobschafer made it!(author)2010-12-26

I would suggest that you use a dc motor rather than a stepper for a more continuous rendering of the test samples spectrum. Limit switches can be used to control its min and max movements.
Also running the motor at a slow speed may help better detect narrow peaks.
May be adding another amplifier stage would also increase the instruments sensitivity.
One can use the sun as a light source to get certain known spectral lines ie.,ne, na, h, for calibration. Or use the sodium lines from phoresece lights, or those from neon lights. Thanks for you constructable.   bob

AlfonsVH made it!(author)2011-01-10

You make some very good points, thanks! I'll look into it.

TayyabaT made it!(author)2017-05-04

can i measure nitrite and nitrate levels using this spectrophotometer?

SHOE0007 made it!(author)2016-09-01

I have to do more testing but this is quite simple too.

SHOE0007 made it!(author)2016-09-01

I have built a simple sample passive spectrometer. Using a camper cooler, light meter, lamp with aluminum foil with pinhole. Here are some pictures.

Case for spectrometer.jpgspectro lamp and light meter. Better model..jpgCrude spectrometer..jpg
satchelfrost made it!(author)2016-02-25

Check out my version! I referenced you in the intro and the closing paragraphs of my instructable called "Shoe Box Spectrophotometer".

AlfonsVH made it!(author)2016-02-26

Nice work! Glad I was able to inspire you :)

MattD65 made it!(author)2016-01-20

Could white light be shone through the sample, and then split into the individual wavelengths? Wouldn't the absorption be the same? This would make the testing much faster and eliminate the need for a motor. Or would it be too hard to calibrate a baseline for each wavelength?

MattD65 made it!(author)2016-01-20

This design would require a photodiode array or linear CCD. Is that the reason why it is not used here?

MattD65 made it!(author)2016-01-17

Why would you not use an RGB LED instead of the stepper motor and diffraction grating? It would be solid state and more controllable.

Ian01 made it!(author)2016-01-19

No LED is a suitable light source for spectrophotometry. LEDs don't have continuous and flat emission spectra. Furthermore, your spectral resolution would only be three.

sehrgut made it!(author)2015-06-15

Couldn't you calibrate with known dye standards?

Sofia4th made it!(author)2015-04-14

Hi & hello i am need your help for my project
My project is quite simple cause its no need of arduino, but im using op-amp to produce output.
1.Is it my circuit for amplification is same as you? And please give me some tips!
2. How to measure absorbance (uric acid) using multimeter. If u had any links for my reference, thank you very much

prprashant made it!(author)2013-09-19

Any suggestion for dark and thick liquids? (if light has problem to pass through the cuevette)

mmiles12 made it!(author)2013-11-24

Not all samples are suitable for this type of analysis. But, you can try diluting your liquid by a specific volume. You'll need to take into account solvent miscibility if you don't have or know what the liquid is, probably make a calibration curve, and make an appropriate blank. These are pretty basic techniques of spectrophotometry, so search any unfamiliar terms.

ChemicalLoveStory19 made it!(author)2015-02-08

The good thing about dark liquids is you can still use beer's law to calculate concentration and molality and molarity from a sample with dilution.

prprashant made it!(author)2013-12-17

Thanks a ton. It helped a lot :)

marcelopedrocz made it!(author)2014-10-10

good afternoon;

Wanted to know if you could help me get me some material type article, slides, application to more site to compare spectra and gives something theoretical. Em spectrophotometer in cell

Thank you for your attention

marcelopedrocz made it!(author)2014-10-10

good afternoon;

Wanted to know if you could help me get me some material type article, slides, application to more site to compare spectra and gives something theoretical.

Thank you for your attention

prprashant made it!(author)2013-12-17

Can you please explain in detail about TL081??
How will the it affect the output in that case? Is the output amplified by the 5V to 6 or 7 volts??
Kindly Reply

AlfonsVH made it!(author)2014-08-05

Sorry for the late reply. Simply put, yes. Take a look at for more info.

Experiment7 made it!(author)2014-08-05

I studied Near-IR spectroscopy years ago, and this project is near and dear to my heart. I am a proponent of using the stepper motor. It moves in discrete, reproducible angle steps. If those angles are too great, you would have to use gears to reduce the angles of the steps to the desired amount. Also, clear plastic transmission grating would be good for this project. For very dark liquids, either dilute or decrease the optical path length through the sample (use a thinner cuvette). For calibration would need neon, sodium, or other types of discharge lamps with known wavelengths - or tube type HeNe laser, or some combination thereof. The more standard wavelengths you have, the better you can tweak your calibration.

AlfonsVH made it!(author)2014-08-05

Thanks for the comment :)
I thought the stepper motor would be the simplest way of achieving wavelength reproducibility.

Unfortunately due to lack of time I never completely finished the project. Maybe somewhere in the far future...

Eldonstanley made it!(author)2013-10-07

How do I measure the wavelength ?

mmiles12 made it!(author)2013-11-24

You'll need to find an absorbance maximum at more than one angle of rotation for known samples that have only one absorbance peak, and use those values of theta to determine the relationship between degree of rotation and wavelength of light.

prprashant made it!(author)2013-09-18

i want to download the pdf for the same. I tried to register. Not happening.
Any suggestion?

hakk3r made it!(author)2013-08-18

how do you calibrate the stepper motor to the wavelength?

vignesh961 made it!(author)2013-08-04

Great!!! Simply amazing

crudders made it!(author)2012-03-20

Love this project, but why not read the ldr with the arduino, and get it to send the data back to the pc ? That would make it fully automated.

AlfonsVH made it!(author)2012-03-20

Very good point!

I haven't had the time so far to improve this project but I'll put it on my to-do list for the (far) future!

Eurober made it!(author)2011-08-22

You could explore the possibility of using a RGB led as light source (Cost ~ $2.00). By digitally selecting the combination and the strenght of the three fundamental colors you could generate almost a continuous spectrum without the complication of a mechanical device like the motor.

hanley made it!(author)2011-01-09

great project!

AlfonsVH made it!(author)2011-01-10


Master+Forge made it!(author)2010-12-29

Great instructable. There are inexpensive diffraction grattings at Edmund Scientific. Not like the ones we use in the laboratory instrumsntation, but quite fair for this kind of project.

jam+BD made it!(author)2010-12-22

Very nice idea.
But is a piece of CD the best way of diffusing the light, because the spectrum created isn't perfect...

AlfonsVH made it!(author)2010-12-23

No, like I mention in step 3 / "splitting the light" a CD isn't ideal. A proper diffraction grating would be better, but is harder to find and much more expensive.

About This Instructable




More by AlfonsVH:A simple DIY spectrophotometerDisposable camera coilgun
Add instructable to: