top of page
Search

Week of 10/16/2017 - Progress Report 2

  • Ezequiel Partida
  • Oct 21, 2017
  • 3 min read

Topics Covered: AQ6370D Device Interface w/ Matlab, Remote Control of AQ6370D thru Matlab, Data Acquisition from AQ6370D, Spectrum Line Processing w/ Matlab

Materials: AQ6370D Yokogawa OSA, Matlab (v. 2014b), GPIB Driver (Agilent 82357B), USB Drive, AQ6370D Viewer

Summary: Last week, VISA identification of the AQ6370D was possible, but remote control and data acquisition was not. For this week, I picked up from last week’s progress and continued to successfully open a remote connection to the Spectrometer using the following Matlab code:

delete(instrfindall)

g1 = visa('agilent','GPIB0::1::INSTR');

set(g1,'InputBufferSize',1000000);

set(g1,'OutputBufferSize',1000000);

set(g1,'Timeout',30);

fopen(g1)

When the Spectrometer is in normal operation, the ‘REMOTE’ LED is turned off, as seen on the following picture.

However, once the code is ran, the ‘REMOTE’ LED signifies successful connection between the Spectrometer and the GPIB driver.

Once remote connection is enabled, AQ6370D-specific commands can then be sent using the ‘fprintf’ Matlab function to control various properties of the Spectrometer (e.g. Resolution, sweep characteristics, ranges, etc.) All possible commands for the AQ6370D can be found it the corresponding Programmer’s Manual. In order to prove that remote control was successful this week, manual operation of the Spectrometer was performed to generate the following Acetylene Gas Absorption Spectrum (50 pm resolution, 1500-1580 nm wl).

Then, the following code was ran, remotely setting the resolution at 20 pm, and the start and stop wavelengths at 1510-1550 nm. The second picture shows the result, verifying that it is possible to remotely control the Spectrometer.

delete(instrfindall)

g1 = visa('agilent','GPIB0::1::INSTR');

set(g1,'InputBufferSize',1000000);

set(g1,'OutputBufferSize',1000000);

set(g1,'Timeout',30);

fopen(g1)

% fprintf(g1, ':CALibration:ZERO off'); % Turn off AUTO offset

% fprintf(g1, ':CALibration:ZERO once'); % Perform single offset

fprintf(g1,':SENSe:BANDwidth 0.02NM');

fprintf(g1,':SENSe:SWEep:STEP 0.004NM');

fprintf(g1,'SENSe:WAVelength:STARt 1510NM;STOP 1550NM');

fprintf(g1, '*CLS');

fprintf(g1,':INITiate');

fclose(g1)

Unfortunately, commands sent to the Spectrometer only work when data is sent out. Whenever Matlab functions are used to receive data, ‘fscanf’, a VISA Timeout occurs. Multiple things were implemented to try to fix the Timeout error, such as increasing the Timeout time to 30 seconds, 60 seconds, and 120 seconds, but none worked. Also, a pause of multiple seconds was placed after performing a sweep in order to allow the Spectrometer’s data registers to settle, however that did not work either. Therefore, in order to import the trace data of the Spectrometer into Matlab, a USB drive was used, as shown in the following picture.

Once the .csv file was acquired, the following Matlab code was implmeneted in order to generate a plot of the Spectrometer Spectrum. Also, a Savitzky-Golay Filter was applied to the data in order to perform a moving aberage analysis on the y-axis. This generated a Gaussian curve, erasing all the absorption lines, which acted as error points on the otherwise smooth plot. Finally, the Gaussian was divided by the original plot in order to generate clear absorption lines of the spectrum. The results are shown on the figure below.

vec = csvread('W0000.csv',35,0);

ypoints = vec(:,2);

sgolay = sgolayfilt(ypoints, 3, 3333);

subplot(3,1,1)

plot(vec(:,1),vec(:,2))

title('Absoprtion Spectrum Acetylene Gas')

ylabel('Absorption (nW/Div)')

subplot(3,1,2)

plot(vec(:,1),sgolay)

title('Gaussian')

ylabel('Absorption (nW/Div)')

subplot(3,1,3)

plot(vec(:,1),sgolay ./ vec(:,2))

title('Lines')

ylabel('Absorption Strength')

xlabel('Wavelength (nm)')

Also, Jonathan implemented a base GUI code to interface with the data previously mentioned. Buttons were added to control initialization of GPIB connection and execution of a Spectrometer sweep. Also, pull-down menus were implemented to set the various characteristics of the spectrometer. Once the GUI is ran, the GPIB connection is able to generate a Spectrum, and the resulting data is processed in figures, as shown below.

Problems: VISA Timeout Error when trying to retrieve data from Spectrometer using remote connection. GUI pop-up menus send 'subsindex' is not defined for values of class 'cell' errors.

Progress Worth Noting: We can now easily get Matlab plots of Spectra from Spectrometer and generate clear absorption lines using Savitzky-Golay Filtering. Therefore, we can begin reading different types of absorption spectra in order to analyze differences in solutions, substances, concentrations, etc.

Plan for next week:

1) Fix visa timeout errors on GPIB connection.

2) Complete GUI remote connectivity.

3) Analyze absorption lines for different absorption spectra.

4) Set up Ethernet connectivity to compare/contrast with GPIB.


 
 
 

Comments


© 2017 Designed by Tamara Jovanovic, Ezequiel Partida & Jonathan DeRouen. 

bottom of page