Close
0%
0%

Universal software for DIY spectrometers

Hooking up a DIY spectrometer to professional spectroscopy software

Similar projects worth following
There are many DIY attempts for creating all kinds of spectrometers, intending to measure absorbance, reflectance, fluorescence and even Raman signals. Hardware setup might be quite diverse, but the software requirements are more or less the same.
Since 15 years I provide the optical spectroscopy software SPEKWIN32 for free to all non-commercial & private users. Until now, it was limited to plot, process, analyze and convert spectral data from all kind of spectrometers. Recognizing 35+ file formats, is easy to use, rock solid, lean and used all around the world.
Now, I try to expand it's capability to driving spectrometer hardware, acquire live spectra and combine this with the already existing processing power in a single package. This initial demonstration is limited for use with USB webcams as detector.
To make this fully functional & compatible with more kind of spectrometer hardware, a fundraising campaign is currently running:

Today (Hackaday, April 23), I've invested the bigger part of the day into a quick hack, to demonstrate the potential use of my optical spectroscopy software SPEKWIN32 together with webcam-based DIY spectrometers. It is not perfect, but it works:-)

What it does:

  • Connect to any webcam, that is recognized by Windows system
  • show a webcam live view
  • show a live horizontal cross section as a spectrum within a Spekwin32 plot window
  • identify each measured spectrum with live time stamp
  • for emission spectra: save a dark spectrum + automated live subtraction of dark
  • for transmittance/absorbance: save a reference spectrum + automated live calculation of absorbance/ transmitttance
  • use automated peak labeling during live view
  • optionally flip the spectrum, to adjust to the original image orientation
  • clipping warning for blue, green red channel
  • visually define the spectrum ROI, that is used for cross-section calculation
  • assign the spectrum's linear wavelength range
  • access webcam settings via Windows webcam interface. Depending on webcam type: also control exposure time, white balance & the like
  • Disconnect the webcam
  • Keep last measured spectrum. Process with all available functions. Save data and export into different file formats (spc, dx, csv, ...). Direct copy&paste via clipboard into Excel and the like. Create plot image files. Print. ...
  • Analyze spectrum images without being connected to a webcam spectrometer. Use "Load spectrum Image" from the "File" menu.

Optical setup of spectrometer:

For diffraction of light + focusing I used a concave reflective grating. The slit image is much bigger than the little CMOS chip inside the USB camera. Therefore I used the grating for spectrum projection onto a white piece of paper within the slit plane beneath the entry slit. Used the USB camera with lens to image the projected spectrum image. Works astonishingly well:-)


Application example: measuring absorbance of coloured decals:

  1. yellow coloured:
  2. red coloured:
  3. green coloured:

  4. blue coloured:


Limitations of the current version => to be improved:

  • linear attribution of wavelength information is possible, but w/o calibration.
  • => Implement wavelength calibration procedure
  • For emission type spectra: wavelength-dependent sensitivity of detector not corrected.
  • => Implement sensitivity correction procedure (function already there, not connected to live spectra)
  • Not working for Raman measurement type
  • => Implement live view for "Raman shift" as x axis + live baseline correction (this function is also already there, but not yet connected to live view)
  • Using dark spectrum + reference spectrum at once does not work reliably (actually also not neccessary). "Save reference spectrum" only work reliable in "Intensity" mode.
  • => Bug fixing. Make it more stable.
  • Needed: Turn off white balance. Control gain + exposure time. Since p4: access to webcam settings, should be possible to control these parameters (depending on webcam type). Could not try with my webcam, these options were not accessible:-((


What annoyed me most:

The webcam had a habit, which is normally useful, but very annoying for spectroscopy: the automated auto-exposure always makes sure to get images with medium intensity. Which means that spectral measurements are severly hampered. It tends to produce partly overexposed data, at least for some of the three color channels. For measuring transmittance or absorbance spectra, it is crucial that the reference spectrum is still applicable when measuring the sample. Which is only the case, if a) the light intensity is still the same and b) the exposure time didn't change. However, as soon as you put the (light-absorbing) sample into the light path, the cam does increase the exposure time, in order to compensate the decreased light level. Which basically means, that only the first one or two frames after putting the sample into the light path give something near to the real sample absorbance. Due to this behaviour,...

Read more »

spekwin32_install_en_1.72.2p8.exe

new version, expiry date: April. 16 2017

octet-stream - 1.94 MB - 01/16/2017 at 10:49

Download

View file

  • 1 × white LED flashlight (3W)
  • 1 × spectrometer slit, made with knife from cardboard
  • 1 × concave holographic reflectance grating 42x42mm, f/2.5, 1200lines/mm , made by Richardson
  • 1 × USB webcam 640x480 pixels
  • 1 × software: Spekwin32 initial prototype v1.72.2p for webcam spectrometers

  • Need your support!

    Friedrich Menges11/29/2016 at 08:16 0 comments

    Hi folks,

    as you might already know, I provide my spectroscopy software Spekwin32 for free since 15 years. This year has seen a great improvement: I was able to create a brand-new, top-modern successor software for Spekwin32, called Spectragryph (http://spectragryph.com). This work was also enabled by a fundraising campaign.

    Now, I want to go further and implement new functionality and further enhance the software and also include what you know from this prototype project: driving webcam-based spectrometers!
    Please donate via Paypal or from my website!

    Thank you so much!
    Friedrich


  • 7th update, extension of running period

    Friedrich Menges11/02/2016 at 09:39 0 comments

    will run until mid january. Hopefully, I have the new software then...

  • what's going on currently?

    Friedrich Menges09/15/2016 at 10:59 0 comments

    Since about mid of June, I am working on the Spekwin32 successor software, called "SpectraGryph". There were some weeks of working on other projects plus moving from Berchtesgaden to Oberstdorf in August.

    Overall, a lot of progress has been made and the new software will be greater and better than Spekwin32, modernized all around with new features and better interactivity. Still, it will be easy to use and robust, as you know it from Spekwin32. Eventually, driving a webcam-based DIY spectrometer functionality will find it's way also into the new software.

    Some preliminary information with screenshots can be found from the new SpectraGryph website: http://spectragryph.com

    This work was partly enabled by a fundraising campaign (first unsuccessful onKickstarter, then with a second, direct attempt on my website: http://www.effemm2.de/nextgen/index_en.html)

    I am very grateful to all the supporters giving their share and encouraging me to go forward. Thank you for putting your trust into me. You will not be disappointed.

    Cheers,

    Friedrich


  • 6th version, update without new functions

    Friedrich Menges07/30/2016 at 11:30 2 comments

    just extending the working time range until October...

  • 5th improve version of prototype SW

    Friedrich Menges06/05/2016 at 13:48 0 comments

    Hi there, upon request of several users, I now introduced an easy to analyze spectrum pictures, without being live connected to a webcam. Just use the "Load Spectrum Image" function from the "File" menu to load *.bmp or *.jpg files. It will use the same window as the spectrometer control function, with live acquisition deactivated.

  • further improvement: update no. 4

    Friedrich Menges05/07/2016 at 21:59 0 comments

    Now I introduced online access to the webcam settings. This should enable control of white balance and exposure time. However, the range of accessible settings seems to depend on the webcam type, I couldn't try out much with mine:-)

    Also: introduced a clipping indicator for blue, green & red channel. Whenever the intensity goes >254 for at least one spectrum point , it is indicated for the respective colour channel.

    Now, the interface looks already cluttered and not so well-thought... But hey, it is just a prototype with sub-standard UI :-)

    IMPORTANT TIP: If you want to analyze an arbitray spectrum picture: replace the cam.bmp file in the program folder with your image, and try to connect to a webcam. If none present, it takes the cam.bmp file anyways for analysis...

  • update description & isntructions

    Friedrich Menges05/01/2016 at 20:31 0 comments

    according to the functionality of the new software version...

  • now with visual definition of spectrum ROI

    Friedrich Menges05/01/2016 at 19:52 0 comments

      Created new version today. This one allows the definition of the part of picture, that shall be used for calculating the spectrum cross section.

      With three more features, this software will be quite useful:

      1. turning off white-balance
      2. controlling camera gain + keeping stable during measurement
      3. controlling camera exposure time + keeping stable during measurement

      Try it out!

  • last update for today...

    Friedrich Menges04/24/2016 at 19:58 0 comments

    • added some robustness
    • rearranged controls within live image window (to make room for ROI definition controls)
    • introduced a [GRAB!] button to allow grabbing of single spectra on command

  • further improvement: flipping + wl scale

    Friedrich Menges04/24/2016 at 15:31 0 comments

    now it starts to get really useful, new features added:

    • horizontally flip the calculated spectrum, to adapt ot the direction of the spectrum image
    • set start + end wavelength boundaries for the full image cross-section. This leads to a "real" spectrum with wavelength scale as x axis. Of course, this is not yet a wavelength calibration, and linear behaviour is assumed.

View all 11 project logs

  • 1

    Using the software, step by step

    1. Install software. Make sure there is write access to the program folder! Start Software. Plug in your USB camera. Make sure it is recognized by Windows as USB device.
    2. Connect Spekwin32 with webcam by using "Connect Webcam" from the "Spectrometer" menu. You might additionally by asked by Windows to select the webcam. A new window will pop up, with the webcam image plus some controls. A first image cross-section will be displayed in the spectral plot window.
    3. Start live data acquisition by using "Run Acquisition" from the "Spectrometer" menu. You will now see the spectrum plot continously updating.
    4. For measuring emission spectra, it might be useful to subtract a background, in order to get rid of ambient lighting and/or detector offset. For this, switch off your light source and press the [Save dark spectrum] button from the webcam image window. Afterwards, activate "Use Dark Spectrum" from the "Spectrometer" menu.
    5. For measuring transmittance/ absorbance, you have to first acquire a reference spectrum. Do so by removing any sample from the light path, have the light source turned on and press the [Save reference spectrum] button from the webcam image window. Afterwards, the two measurement modes become acessible. By choosing them, the spectral display changes accordingly. Without a sample inserted, the transmittance curve will sit at 100%, while the absorbance curve will sit around zero. Having a look into this helps to learn about the longer-term stability of your measurement.
    6. For single frame pictures, use the [GRAB] button instead of Live Acquisition.
    7. To invert your spectrum picture, activate the "flip horizontally". Needed for all setups, where there is red on the left side of the picture.
    8. If the spectrum part does not fill the webcam image completely, use the white frame to define the region for calculating the cross-secting. It can be shifted around with left mouse and also resized, by grabbing the corner handles.
    9. As last step, after setting the ROI, use the "set wavelength range" to create a linear wavelength scale... Try with live acquisition and "Show Peak Labels" activated and a spectrum with some known peaks, to get reasonable results.

View all instructions

Enjoy this project?

Share      

Discussions

Neo wrote 12/22/2016 at 21:22 point

Dr. Menges,

it is great to see a committed researcher, who aspires and aspiring to continuously work independenly these days... however, i came to know about you so late... me unfortunate.

since i have started working in NIR-AOTF spectrometers with little pre-knowledge in statistical mechanics, and chemistry (yeah i am much of an instrumentation/communication engineer)... it kind of grasped my very passion for the subject. 

at the same time, i have contributed to something for spectroscopy in a DIY way, but such contributions even licensed openly, were specific to the specific spectrometer me and my colleague were developing in the laboratory.

then in find fl@c@t, who does diy raman spectrometer, with whom i got in touch, but have never contributed to the project..... :).... and other spectroscopy based projects at smaller scale... it became kind of interesting to see a raise in momentum for DIY/open spectrometers.

me had stressful deliberations with my seniors, to access spectral DB, calibration etc.. stuff... with too much centralization and control in the industry, for such a wonderful subject of science. I believe that william herschel or other pioneers like you would not hold control over the tools and instruments that were created.

in that sense, i see your contribution and continuing it for 15+ years actively... as a great one.

i would like to add some more suggestions.... i honestly do not know, being a novice relatively, whether i am eligible to do so... but endure me... pls... :D..

Ii wonder, why you have not intended the project to be a free(as in speech) software / open source software model. afa i see, the great tool, so far is restricted to only one particular platform, losing the incredible power of portability. Furthermore, people working in diy-raman spectrometer, and at public lab could contribute collaboratively. 

  Are you sure? yes | no

Friedrich Menges wrote 08/01/2016 at 20:13 point

Hi there, 

I have to admit that I didn't think so much of reflectance measurements in the first run. Often a white and a black standard is measured before measuring the actual sample. With the current prototype software, the automated calculation is designed for only two measurements (white standard/reference and sample). Actually, the "dark spectrum" function works together with the reference spectrum function, but there is still a bug preventing to run both together smoothly. So, currently you have to live without a blacks standard measurement, it will depend on your setup how much deviation will come from this.
Of course, you could measure the three spectra separately and do the maths manually with Spekwin32, but who wants to work in such a tedious way...

In about 2-3 months from now, there will be a fully blown solution with all you need. I am currently working full-time on the proposed modernization step for my software: http://www.effemm2.de/nextgen/direct_support_en.html

Hope that helped...

Friedrich



  Are you sure? yes | no

Jong KIM wrote 07/31/2016 at 13:10 point

Hi, Dr. Menges.

  Thanks for your contributions and efforts for the spectrometry people in the world.

I have enjoyed your Spekwin32 for my DIY spectrometer, mostly used for diffuse reflectance measurement as you demonstrated in your " Application example: measuring absorbance of coloured decals" at this site.

I would like to know what would be normal procedure for the diffuse reflectance calibration/measurement of printed specimens.

Do I simply acquire, first, white paper/standard with known spectrum, second, black standard with known spectrum, and third, specimen of interest, all under illumination, e.g., white LED ?

Is there any additional need for dark current measurement without the white LED as an illumination?

Thanks for your interest in this regard.

  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