07-03-2018 01:13 PM
Hi there,
I am a chemist with little to no experience with electronics/engineering and I am trying to build a low-cost LDR based spectrometer. The general setup can be described as follows:
-The diffraction grating "splits" the light into its different wavelengths.
-A small region of that light passes through a solution and reaches the LDR where a signal proportional to the incoming light is generated.
-The difraction grating is mounted on a potentiometer, by rotating the potentiometer the wavelength of the radiation reaching the solution can be selected, and therefore a UV-VIS spectrum of such solution can be taken.
(The spectrometer is driven through an Arduino UNO board interfaced with Labview)
I have managed to make a simple VI able to track the signal of the LDR as a function of the voltage of the potentiometer (which can be directly related with the wavelength).However I need the spectrometer to have the following additional features:
-To average several spectra (now when I scan back and forth, all the spectra stack on top of each other).
-To take a background spectrum (of the solvent) and to subtract it from the measured spectra.I thought that this could be roughly done by creating three XY graphs (1-takes the background spectrum, 2- takes the sample spectrum,3- makes the difference between both spectra), right?
The problem is that I don't know where to start from..
Can someone help me to modify my VI?
Thanks in advance!
07-03-2018 02:05 PM
If you save your VI for 2016 or earlier, I will be able to view it. (Maybe save for 2012 so even more people can chime in).
It sounds like you are conceptually on the right track. You don't need to create XY Graphs in LabVIEW for data to exist. Data exists on the wires, even if you don't display it in an indicator.
In order to average multiple scans, you can make use of a loop. Keep adding the new data onto the previous data and store in a shift register. Then, when you have taken your N scans you can divide by N to get the average at each wavelength bucket.
07-03-2018 02:07 PM - edited 07-03-2018 02:15 PM
07-03-2018 02:20 PM
Here you have the VI in an older version!
Best Regards
07-03-2018 02:23 PM - edited 07-03-2018 02:24 PM
Hi there,
Alright I will try that.
Thanks!
By the way, why do you not consider the LDR signal vs the voltage a spectrum?
07-03-2018 02:29 PM
What you were describing was a set of points for intensity vs. a set of points for voltage. In LabVIEW these would be represented by arrays. However, most of your data is represented as a scalar. Once you have these 2 arrays, you can easily make an XY graph using a single "bundle" node, no need for express VIs.
07-03-2018 02:38 PM
@Chemistry4all wrote:
By the way, why do you not consider the LDR signal vs the voltage a spectrum?
It is a spectrum but the data is only held inside the built xy graph express VI. You diagram only contains the last values as scalar.
In general, you cannot average spectra unless each point is aligned to the same voltage and since your arduino and this VI are not synchronized, this is not possible. Of course you could re-interpolate the xy data to a clean voltage ramp before averaging, but why do it the hard way. Us a single loop paved at a reasonable loop rate and with each iteration update the voltage and read a new sample.
07-03-2018 03:11 PM
Here is a very simple example that ramps a voltage and averages a noisy signal. Maybe it can give you some ideas.
07-04-2018 04:23 AM
Hi there,
Yeah, you are right, I didn't realize that each scan won't have exactly the same x values for a given measurement (and especially considering that the potentiometer is moved by hand and not by a stepper/servo motor). Anyway, the goal of averaging the spectra was to reduce the noise, but i think that using a simple smoothing filter might do the job.
Thanks!
Best Regards
07-04-2018 11:11 AM
If you have a reasonably sampled scan, you can always bring it into a regularly x-spaced form using interpolation. Do it on each scan and averaging is possible.