DIY Optical spectrometer / spectrograph

The apparatus allows to take spectra of light sources in range from ~400 to ~1000 nm

Public Chat
Similar projects worth following
The device is made from cardboard and glue, retractable knife blades forming a slit, holographic diffraction grating film and modified p&s camera (removed ir-block filter).

There are two main parts for this spectrograph: the hand-made optics and means of capturing spectra, in this case a photo camera. Also there is little addon for calibrating by wavelength -- the neon glow lamp.

The optics is just a box lined with black cardboard, and several apertures inside, made of the same black cardboard. The apertures are made for reducing stray light. Entrance slit is made from two blades used for retractable knife. The dispersive element is 600 lines/mm Chinese transmission diffraction grating on PET substrate. There is no collimating optics inside, so light incoming on the grating is slightly divergent, angle of divergence is ~5 degrees from center line. This is probably the cause of slight distortion of the spectrum. In the end, this geometric distortion is readily dealt with software.

Here is spectrum of Neon, captured with this spectrograph:

It took 512 seconds of exposure, and there are many lines visible. Almost all lines in the left half are infrared.

The camera I use is modified Canon A490, bought second-hand for just about 10 USD. The modification - removing the IR-blocking filter - was made by me after buying it. The camera is loaded with CHDK "alternative firmware" which allows to shoot raw and have total manual control. Also through the use of related software chdkptp one can remotely control the camera from PC. 

After capturing, raw files are "developed" with dcraw so that resulting tiff has 16 bits per channel, bad pixels are removed and pixel values are not distorted by gamma transformation, so these values are linearly scaled with the number of photons captured. Afterwards, the tiffs are further processed with Fiji software, by the use of unwarping plugin. The same software has another plugin which enables one to make graphs from pixel values. For rectangle selection it averages values of pixel column, which comes handy for capturing spectra - it makes one photo to have some thousand samples of the spectrum.

Above is the spectrum of Mercury lamp (aka germicide lamp) as captured by the spectrometer. At the bottom is the light of little Neon glow lamp which is an etalon of spectral calibration.

And this is the same spectrum but straightened, so averaging along vertical axis is possible.

The resulting data was exported to Excel, pixel coordinates correlated to wavelength, and presented as graph:

Vertical scale is arbitrary units, relative vertical scale varies with wavelength as camera sensor has not been calibrated for brightness vs wavelength. The highest peaks at 405 and 437 nm are also oversaturated, their real height should be several times bigger. The horizontal scale is nanometers.

An interactive model of spectrometer.

x-zip-compressed - 7.21 MB - 12/17/2020 at 09:20


  • Spectrometer completion

    Pavel01/09/2021 at 14:25 0 comments

    The spectrometer structure is mostly complete now. 

    The grating is made to be perpendicular to camera's line of sight, by affixing them both to the same turning base. Distance between camera and grating is 9 cm. The grating itself is cheap Chinese plastic 600 lines/mm from AliExpress, like this one. I made a frame for it from black cardboard for easier handling. 

    As for collimating lens, I had one achromat doublet lying around, 50 mm diameter, and with focus distance of 200 mm, so I used it in this spectrometer.

    The slit is made of two retractable knife blades. Its width is something between 80 and 100 micrometers, slightly varies along its length due to imperfections of blades themselves and in aligning them by hand. For controlling width single slit laser interferometry was used.

    Below are snapshots of spectrometer building process:

    1. The box was built using PVC foam sheet of 4 mm thickness; base made of 2 such sheets alongside the third one of hard polystyrene plastic sheet of 3 mm thickness, to make it stiffer. The turning base is made of the same polystyrene sheet. The collimating lens has very convenient metal shroud which helps with its handling.

    2. Camera glued to turning base, with the grating. Alongside it is the schematic depiction from the software model.

    3. Between the slit and collimating lens a conduit for light is made from black cardboard, with several internal apertures to cut down on stray light. Below is the test with bright white LED placed at slit:

    3.1. The same test, just with the camera and grating, viewed from camera side:

    4. Making the slit, controlling its width with laser:

    4.1. Comparing diffraction pattern against pre-calculated ones for set slit widths:

    5. This is how the completed spectrometer looks like (while recording spectra, all covers are closed):

    The camera compartment is lined with black cardboard, or painted black in some places to reduce stray light. Camera itself is covered by the same cardboard to hide the screen (as camera accessed remotely, there is no need for it anyway). In the lower right there is a hole through base, which is used for access to camera SD card, so I can insert or remove it, as camera now is permanently integrated into the spectrometer structure.

    6. A couple of test spectra acquired by the setup:

    6.1. Compact fluorescent lamp:

    6.2. The sky:

    Currently other work is going on software for data processing.

    As is evident from above spectra examples, there is a distortion (the "smile" distortion as I learned recently, which is real term) that causes spectral lines to arch. Also the slit is slightly tilted, as well as the grating, in its own way. It is possible to try to perfectly align the grating and the slit, but the distortion won't go away, as it is inherent to how the spectrometer works. It afflicts professional spectrometers as well, and the solution is in processing in software (unwarping, rotating, etc.).

    I am in process of writing a program which will process this data, and now I try to devise a way to (semi-)automatically remove distortions, so the resulting spectrum would look cleaner and with spectral lines almost perfectly vertical. This way I would be able to integrate along the vertical axis over more than 1000 rows which will lead to acquiring spectra with very high signal to noise ratio.

  • The computational model

    Pavel12/17/2020 at 09:18 0 comments

    Recently, I have my interest in spectrometry relighted, and started to think about improving the spectrometer.

    Now I plan to build a new version using plastic sheets instead of cardboard, and do it with better precision. Also collimating lens would be added so the spectrum can be focused sharp over wider wavelength range.

    To better plan the layout the new version of spectrometer, and simply to better understand peculiarities of its operation, I created an interactive model, where many parameters can be adjusted, and results are seen right away.

    The model is written in Javascript/html/css, works in web browser. Just download it to your desktop, unzip, and open included html file; best to view it at 50% scale.

    It shows positions of main elements, and traces rays coming through slit, and also diffracted ones. It also shows the spectrum focused on camera sensor.

    Here is the screenshot:

    On the bottom is the image of spectrum. It is modelled as a series of spectral lines at regular intervals, ranging from 350 to 1050 nm, maximal range of camera sensor sensitivity.

    For camera lens focal distance, the 21.6mm is used as it stated maximum zoom focal distance for Canon A490 camera.

    In this model, to see how spectrum is formed without collimating lens, one should move it to the left of grating, so it has no effect on rays hitting it. This way one can see how my cardboard spectrometer works.

    I hope to build actual new version in less than a month, and post progress here in further logs.

View all 2 project logs

Enjoy this project?



Riley Brok wrote 07/18/2023 at 06:59 point

Nice project. What kind of glue you use? Is it from here::

  Are you sure? yes | no

Mitsuru Yamada wrote 05/08/2022 at 11:46 point

Nice project! Thank you for sharing your work. 30 years ago, I attached a prism to the objective lens of an astronomical telescope with a 50mm aperture and took spectra of stars as my hobby. Gratings were not popular available at that time. Since the object was a point source, a slit was not necessary. I enjoyed detecting Balmer series absorption lines, and TiO absorption lines of cool stars.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates