MATLAB Answers

Connecting to ThorLabs PAX1000 Polarimeter using Test & Measurement Tool

11 views (last 30 days)
Ryan on 20 Jun 2018
Commented: Ryan on 20 Nov 2020
I have a ThorLabs PAX1000 polarimeter connected via USB to a 64 bit Windows 7 machine running Matlab R2015a 64bit. I am attempting to use Matlab to automate some measurements. The vendor software is working fine which implies that the drivers are installed correctly. However, I don't see any drivers for the device listed in the Test & Measurement Tool.
I have attached the section of the device manual which discusses the driver files, and a screen shot from the Test & Measurement Tool where you can see that the device is detected under USB, but no PAX drivers are listed.
Is it possible to use the VXI drivers with Matlab for this device, if so, how do I proceed?
Thanks, Ryan


Ryan on 21 Jun 2018
This is what I see using instrhwinfo:
HardwareInfo with properties:
InstalledAdaptors: {'ni'}
JarFileVersion: 'Version 3.7'
HardwareInfo with properties:
InstalledDrivers: {'niFgen' 'niRFSA' 'niScope'}
VXIPnPRootPath: 'C:\Program Files\IVI Foundation\VISA\Win64'

Sign in to comment.

Answers (1)

Kien Phan Huy Kien Phan Huy
Here is my code
clear all
close all
% Check VISA object (Uncomment and run the first time to get your device ID)
%out4 = instrhwinfo('visa','agilent')
% Create VISA Object given the device ID
tlpax=visa('agilent', 'USB0::0x1313::0x8031::M00547469::0::INSTR');
% Connect PAX 1000
% Identify Thorlabs PAX 1000
fprintf(tlpax, '*IDN?');
data = fscanf(tlpax) % Expected return is 'THORLABS,PAX1000IR2/M,M00547469,1.0.3'
% Measurement in mode 9
fprintf(tlpax,'SENS:CALC 9;:INP:ROT:STAT 1');
% get measurement
messagetxt = fscanf(tlpax);
% Convert data to conventional units
az=message(10)*180/pi % in °
ellip=message(11)*180/pi % in °
DOP=message(12)*100 % in %
P=message(13)*1e3 % in mW
% Compute normalized Stokes parameters
S1=cos(2*Psi)*cos(2*Chi) % normalized S1
S2=sin(2*Psi)*cos(2*Chi) % normalized S2
S3=sin(2*Chi) % normalized S3
% Disconnect PAX 1000
clear tlpax


Show 5 older comments
Sam on 19 Nov 2020
The timestamp is not updating. It just keeps pulling the same char matrix from the hardware buffer apparently. It's difficult to troubleshoot because I cannot see what's going on really so I kind of just took a lot of shots in the dark with only one real solution (clrdevice) that creates a separte issue with another piece of hardware. I am not really familar with how information is stored when fprintf(tlpax,'SENS:DATA:LAT?'); is called and how it's retrieved by fscanf(tlpax); It just seems to be pulling the same information. I am not sure if somehow there are multiple lines of information being stored every time frpint and I am just not accessing the consecutive line, or if calling fprintf consecutive times is not overwriting the previous data.
Whatever it is, I wouldn't expect you would have to clear the hardware buffer to take a second measurement, so I am sure I am just doing something incorrectly.
Sam on 19 Nov 2020
Just to give a potential solution:
I remvoved this line :fprintf(tlpax,'SENS:CALC 9;:INP:ROT:STAT 1');
from the loop and that seemd to solve the problem I was having. Although, I have to add in pause(.04) between fprintf(tlpax,'SENS:DATA:LAT?'); and storing it in a matrix, which leads to my secondary problem occasionaly.
Ryan on 20 Nov 2020
I had a similar issue with the data not updating. I found that it was an intermittent problem and potentially hardware / driver related. Sometimes the data would read fine and then it would suddenly stop updating. The solution was usually some combination of unplugging and replugging the polarimeter, and adjusting the polarimeter settings using the ThorLabs provided software gui. Disabling and enabling the auto power ranging feature also sometimes fixed the problem. Using the pause() function defintely improved reliability.
Unfortunately my best solution was to write a script that would repeatedly connect/disconnect and attempt to read data until it started working.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!