CCD Spectrometer on a Budget

WinSpec is a project to develop a spectrometer using low cost materials that are easy to obtain. The basic parts are a computer, camera, grating, enclosure with pin hole, sample holder and lamp. The hard part is the software, and we provide that for you here (download  Also, be sure to visit Professor Sheeline's page at

Here is a detailed list of the components used to build the spectrometer shown in the picture at the top of the page.

Caution: If you power your light from a USB cable it is recommended that you (a) use a charging adapter or a powered hub rather than connect the cable to your computer, and (b) be very careful not to cause a short circuit.


The tube is mounted to a piece of wood, and a second small piece of wood is attached to provide a place to mount the camera. The transmission grating is taped to the end of the tube.  The camera is mounted and centered behind the grating.  Heavy duty double stick tape works well to attach the tube and to mount the camera.

The other end of the tube is covered with a foil. A pin hole is poked in the foil on thru the center of the tube. A piece of wood with a hole for the light bulb and socket is attached opposite the pin hole. A USB cable is hacked to expose the 5V line (usually the red wire) and ground which are connect to the light bulb through the 100 ohm variable resistor. If you are careful to avoid any short circuts, you can use the USB light source with a charging adapter or a powered hub.  If you plug it into a computer, it is at your own risk.

After some experimenting, a holder for the cuvette was rigged from aluminum foil and some items found in the desk drawer. Clay works well as a holder also, but be careful to avoid colored clay.


All of the above is just one way to build the spectrometer.  The following is a picture of the first WinSpec spectrometer.  The tube is shorter, but the pin hole is smaller also. It still manages a few nm resolution.



If you want to use the software as is, you can copy and run the executable image from the debug directory.  If you want to change the code, you will need to download and install the Microsoft Visual C development tools (available here)

The controls in the spectrometer software are arranged from left to right in the order that you would normally use them; (i) select and setup the camera, (ii) align and calibrate the instrument, (iii) save the instrument setup to a .cfg file, or reload the .cfg file, (iv) collect and display a blank or raw data, (v) collect and display reflection or absorption data, (vi) save the data to a text file. After you save some data, there is a bash file that works with cygwin and gnuplot to replot data to a graphics file.

First Light 

The following spectra were from a halogen desk lamp.


And here is a 650 nm laser.  The label on the laser says 650 +/- 10 nm.

A sharper line can be produced using a second grating between the laser and the pin hole. In the following figure, the +/-2 or 3 nm line is a close match to the grating and camera.  It can be worthwhile to try this with a longer distance from the second grating or a smaller pin hole, and a higher resolution camera.