Friday, 23 December 2011

Homemade Spectrometer/Spectrophotometer

Last year I started designing the spectrometer/spectrophotometer. It is not really too related with nanotechnology it could be used however to do some characterization of nano particles.  It can be used to find the absorption spectrum of different liquids and find absorption spectrums. I am hoping to use it as a teaching aid to do some simple color changing reactions to teach kinetics and basics of spectroscopy.



As light passes through a liquid it can be absorbed by chemicals found in the liquid. Different molecules will absorb at different wavelengths.

Figure 1 | Diagram for absorbance in a cuvette of solution by CarlosRC

As the light travels through the liquid it drops off exponentially with distance. The intensity of light out I1 is then dependent exponentially with the width of the cuvette. The transmittance is then given by the intensity in, over the intensity out.

In order to get a linear relationship absorbance is defined as the logarithm of the transmittance. This gives a linear relationship.

The absorbance has been found to be related to the number of molecules and their cross sectional area. This can then be found The relationship between absorbance, concentration, pathlength and molar absorptivity is called the Beer-Lambert Law.

Using this equation if you know the molar absorptivity e, path length of the cuvette l you can work out the concentration c from the absorbance of light A. This is used by almost all chemistry and biology laboratories to work out concentration of solutions.


A spectrometer works by splitting light made of many wavelengths (e.g. white light) into individual rays that can be detected. This allows the spectrometer to be able to find the absorbance of different wavelengths and determine what molecules are in the solution.

The basic idea of splitting light is to change the angle of the light in order to spread the colors over a large area so they can be detected separate from each other. In this project a CD was used as a grating. A grating works at separating out colors by the different path lengths between different rays reflecting and interfering like water waves can constructively and destructively interfere. This leads to different wavelengths of light being reflected at different angles. This can be calculated from Snell's law and some simple optics leads to

The distance between the grooves is 1.6 micrometre. You can calculate the angle of refraction when;
d is the spacing between the grating
m is an integer and theta m is the angle
theta i is the incoming (incident) angle
and lambda is the wavelength of light


Many different designs were combined. The spectrometer was designed with the CD grating which has been used on many different DIY spectroscopes and often used with digital cameras. Also spectrophotometers have been made that use light dependent resistors (LDR) and LED's of different colours.

This design combines the spectrophotometer with a light dependent resistor and LED.As well as a spectrometer using a CD as a grating to split the light and a webcam. My thanks goes out to all the great spectrometer designs people have shared on the web.


There are two white LED's. The top LED is detected via the light dependent resistor LDR behind the cuvette. A PICAXE 08M micro controller was used as a simple data logger collecting the absorbance data through its inbuilt 10 bit (2^10 = 1024 different possible data values) analog to digital convertor. This is then sent to the computer as an ASCI string which can be collected using a simple serial terminal such as real term.
The code for the PICAXE is a simple basic like language which is incredibly easy to code.
    high C.4
    readadc10 C.2, w0
    sertxd (#w0)
    pause 500
    goto main

The data is then transferred via the download cable at 4800,n,8,1 baud rate to the computer and can be saved into a spreadsheet to do time resolved measurements.
Figure 2 | Spectrophotometer showing the battery pack and the two white LED light sources.


Another LED was placed at the base of the cuvette. The cuvette has a slit created by two pieces of black insulation tape. The light is then split using a CD grating and detected by a logitech webcam. The webcam has an adjustable focus that can focus almost up to the lens itself. However the optics are not ideal as only around 200 pixels are detecting the strip of color. I took the IR filter off of the lens so it should be capable of imaging the near IR part of the spectrum. 

Figure 3 | Spectrometer showing the webcam and CD diffraction grating.

Figure 4 and 5 | Spectrometer and prototyping board with cuvette holder.

I used a great program made by Alexander Scheeline and Kathleen Kelly from the University of Illinois who put together the Cell Phone Spectrometer website with a program that takes two pictures from a cell phone of a spectrum, a reference and a sample. Giving an absorbance reading that can be exported as comma separated values (.csv) file that can be imported into a plotting program.

Figure 6 | Cell phone spectrometer program using two pictures taken with the webcam.

To test the spectrometer a pink sample of Purpurin in methanol which is an anthraquinone was used. Anthraquinone's have been used as a dye in many paintings. In the lab were I am working a student is doing a PhD project trying to understand how these molecules break down in order to be able to aid in art restoration. The absorption spectrum was found using a halogen light source and an Ocean Optics USB-4000 mini spectrometer. Both spectrometers where referenced with methanol and compared in the following graph.

Figure 7 | Absorbance of Purpurin for the homemade spectrometer compared with a commercial spectrometer.

The homemade spectrometer doesn't have very good resolution at around ~3 nm the commercial spectrometer has a resolution of 0.3 nm. The homemade device seems to replicate the shape of the peak of the purpurin centered at ~500 nm. However the noise is quite bad which can be seen to be overlaid on the curve which is the main source of error in the absorbance. This could possibly be reduced by taking many pictures and collecting an average which is what the commercial unit does to reduce noise.

The spectrophotometer with the LDR and LED was not tested but I plan to test it with an oscillating reaction as well as some simple color changing reaction to teach basic kinetics. I am also thinking of adding multiple LED's in order to measure absorbance at various wavelengths.

I am also planning to make up a proper pcb board that can be used to mount the electronics in a more reliable way. I also need to improve the optics to fill the camera with the spectrum as currently only a small fraction of the CCD is receiving the spectrum.

But for around 50 dollars NZ the spectrometer performed pretty well compared with the 3,000 dollar NZ, Ocean Optics commercial spectrometer.


To find out more about the science have a look at these links which give you a good summary and good links as well to other websites.


  1. Dear Jacob,

    Hopefully you can get my email. I read your article about your DIY spectrometer and in the mean time I am also constructed a spectrometer by using transmission grating for my project. I got the same problem which is the absorption of my spectrometer is lower than the ideal value taken from a proper spectrometer by 20%. The quality of the spectra are good, so I think that is not the reason of the inaccurate absorption. I am wondering if you have solved this problem and could you please kindly give me some advice about that?


    Dr Bo Li

    1. Dear Dr Li,

      By the way where did you source the transmission grating these designs seem very useful and simple to make as opposed to using a CD.

      By the absorption being lower do you mean the signal itself is lower (intensity) or the actual absorption is low in some areas (Peak shape). To answer the first each optical element the light passed through will lose intensity from back reflections ~5%. So the transmission grating is likely to reduce your intensity and unless you are using an exposed CCD this will also contribute to losses.
      Secondly if you are talking about quality of spectral shape reproduction I am unsure why I am not picking up the peak shape properly as it tapers off at low wavelength. This could be due to aberrations in the imaging optics I am using and also the grating itself. It is hard to tell.

      If you were to send through a picture of the spectra you had acquired I would be able to help further.


  2. Hey Jacob,

    Do you think the CD grating would happily split all the way down to 330-340 nm ?

    There is a little module, the UVM-30A which is sensitive in the 200-380nm range. I was hoping to tune the grating and the UV module so I can measure just a narrow(ish) band around the 340nm mark. I am thinking how to make a digital UV light integrator based on an Arduino for a self-made exposure unit for screen printing. A band-pass UV filter to put on top of the UV module is rather expensive.

    A light integrator measure light over time so you can estimate that enough energy has fallen on the thing you are exposing to light.

    Thanks for any suggestions!

    1. Dear Aris,

      It depends on the resolution you want to attain. Also the plastic may absorb the UV, the polycarb is slightly better than acrylic at letting UV through but still not good in that range.

      I could recommend maybe removing the label on the top of the CD using HCl to reveal the silvered surface. Otherwise you will have to go through 1-2mm of polycarb with will attenuate the power a lot. Otherwise you could pry open a DVD disc getting a knife in, which will allow you to separate the two halves. Otherwise try a blu-ray disc. However efficiency goes down for low wavelengths when you have a densely packed grating surface. You will also be spreading out the power even more.

      Please email me with any more questions and with the finished design if you can.

      Jake Martin

    2. Thanks for the reply Jake!