LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW does not recognize Thorlabs Power Meter

Dear all,

 

I have a similar problem in Python connecting a Thorlabs PM100 Powermeter.

When I import the pyvisa module and connect to the ResourceManager and want to list the devices he just gives me an empty tuple.

NI MAX doesn't list te device either. I recognized that I have installed the Thorlabs drivers and the device is listed in the device manager as PM100.

 

So I tried following your proposal to reinstall the device as an USB Test and Measurement Device. The problem is (as usual when I have problems with device drivers on Windows 10) that Windows just happens to install a driver called "PM100" by itself when I just deleted the old driver just when I reconnect the device to the PC via USB.

 

That happens with or without internet connection. Now I know that I can disable this function via booting in a special modus but right now I guess that there is an easier way.

 

Now when I just ignore that and try to install the USB Test and Measurement Device driver over this Windows-default driver then the second problem is that I basically have two options when I right-click the driver and try to update it:

 

1.) Automatically search for a driver online (which is not what I want and not what you proposed either I think)

2.) Search for driver software on my disk.

 

When choosing 2.) then I choose "choose driver from a list" (freely translated from german to english, sorry for that). Then a list appears in which "USB Test and Measurement Device" is also listed (yeah!).

But when I choose that I obviously have to give him the driver path since Windows doesn't list any available drivers for this option in the white box in the dialog that opens up.

Now what drive should I give him? The original USB stick that came with the device? I mean, then I could just reinstall the Thorlabs driver right away (which is not recommended). Also, sadly, I lack the original USB drive.

 

I am sorry for my disability to resolve such an easy problem and I would really appreciate your help.

 

Best wishes

0 Kudos
Message 11 of 19
(4,550 Views)

There is a small application Thorlabs.PMDriverSwitch which comes with the powermeter software.

 

Message 12 of 19
(4,522 Views)

A quick glance at the manual found this:

 

7. Instrument Driver for Thorlabs Power Meters


The Thorlabs Optical Power Monitor (OPM) uses a new driver for the connected power meters. · Formerly used driver: NI-VISA™-based driver PM100D.dll. · OPM software power meter driver: TLPM.dll. The new driver TLPM.dll is automatically installed with the OPM installation. We recommend using this driver as it is easier to install, uses less disk space and has a more robust algorithm for recognizing devices than the previously used NI-VISA™-based driver PM100D.dll.

 

Attention Custom Made Software
Be aware that the driver assignment of the power meters is changed upon installation of the OPM. If you created your own software for remote operation of Thorlabs power meters based on the PM100D.dll driver, the software needs to be modified to use the new TLPM.dll driver. Please read the chapters Adaptation of Customer Software and Write Your Own Application (WYOA) for instructions.

 

Alternatively, you can use the tool Power Meter Driver Switcher to switch between the two drivers, the PM100D.dll driver and the new TLPM.dll driver, according to your needs.

 

The Power Meter Driver Switcher , is installed together with the Optical Power Monitor.

 

Attention: Power Meter Monitor, Optical Power Meter Utility and Multi Power Meter


To keep using the software packages Power Meter Monitor, Optical Power Meter Utility or Multi Power Meter software after installing the Optical Power Monitor with the TLPM.dll driver, the user needs to revert to the driver PM100D.dll. To switch between the old PM100D.dll driver and the new TLPM.dll driver, a software tool, the Power Meter Driver Switcher , is installed together with the Optical Power Monitor.

 

7.1 Power Meter Driver Switcher
The Power Meter Driver Switcher is a tool to switch between the NI-VISA™-based PM100D.dll driver and the TLPM.dll driver installed with the Optical Power Monitor in cases listed above .

 

That sounds like where you need to start looking

========================
=== Engineer Ambiguously ===
========================
Message 13 of 19
(4,511 Views)

Did you find a solution to this problem? Because I am also facing the same problem

0 Kudos
Message 14 of 19
(4,348 Views)

@MVJ99 wrote:

Did you find a solution to this problem? Because I am also facing the same problem


Hi Vijay, unfortunately the original poster created their account and last visited on July 11, 2018. If none of the above suggestions have worked for you, try starting your own thread with a detailed explanation of your problem and what you have tried.

By the way, this page will help you if you're not sure what is usually required to troubleshoot these problems:  Unofficial Forum Rules and Guidelines

0 Kudos
Message 15 of 19
(4,330 Views)

Hi,

 

I did indeed find a solution, but I honestly don't remember it right now.

I think it had something to do with the driver, I switched from the new one to an older one or vice versa... sorry.

May be it also had to do something with looking up the connector in the device manager and update driver software manually using the old driver file... may be give it a try.

 

My system is Windows 10 btw, just to let you know.

 

 

Here is the code I used in Python (sorry for the mess without proper formatting/tabs).

Just saying: I am not an expert programmer and some stuff added to this code is not necessary... I built this for training and played a little bit around, also.

Hope it helps:

 

import pyvisa

import time

import sys

 

class powermeter():

def __main__():


# =============================================================================
# Here the instrument is added to the program via the NI-VISA driver.
# =============================================================================

__main__()

def connect(self, beamdiameter = 5):
rm = pyvisa.ResourceManager()

if len(rm.list_resources()) > 0 and rm.open_resource(rm.list_resources()[0]).query:
try:
tlpm = rm.open_resource(rm.list_resources()[0])
tlpm.read_termination = '\n'
tlpm.write_termination = '\n'
except:
print('''\nError occured while trying to add the instrument.
Restart the python kernel (ctrl + .) and restart the powermeter to retry.''')

# =============================================================================
# Setting up the device
# =============================================================================

print(f"""The instrument was successfully added:\n
Manufacturer: \t\t{tlpm.query('*IDN?').split(',')[0]}
Sensor Type: \t\t{tlpm.query('*IDN?').split(',')[1]}
Serial Number: \t\t{tlpm.query('*IDN?').split(',')[2]}
Firmware Version: \t{tlpm.query('*IDN?').split(',')[3]}\n""")

else:
sys.exit("No instrument found!")
return(print(f"No instrument found!"))
tlpm.write('Initiate:Power') # Sets measurement mode to power [W]

tlpm.write('Sense:Average:Count 3000') # Averages 3000 measurements per measurement
input("""======================================================================
Please deactivate all lasers for zero-adjustment measurement.
Press Return to procceed.
======================================================================\n""")

tlpm.write('Sense:Correction:Collect:Zero') # Performs Zero adjustment
time.sleep(1)
print("======================================================================\n"
"\tZero adjumstent successfully performed")

tlpm.write(f'Sense:Correction:Beamdiameter {beamdiameter}') # Sets beamdiameter
if beamdiameter != 5:
print(f"\tBeamdiameter is set to {beamdiameter} mm.\n"
"======================================================================")
else:
print(f"\tBeamdiameter was set to default: {beamdiameter} mm.\n"
"======================================================================")

return(tlpm)

0 Kudos
Message 16 of 19
(4,320 Views)

Hello,

 

I appreciate your suggestion.

I am experiencing technical difficulties with your python code while trying to connect to a Thorlabs power meter. Do I have all of the necessary software to communicate with this instrument? Remember: Although I am aware of python not in connecting instruments. This is the first I am trying to communicate power meter with python.

 

If you can explain the complete procedure especially the required commincation between LabVIEW and python would be grateful.

Thanks in advance

0 Kudos
Message 17 of 19
(4,302 Views)

Hi,

 

I use Python only, no labview software needed so far in my eyes (I have no LabView licsence on my PC anymore)

Connect the Powermeter via USB to the PC (drivers need to be installed for the Powermeter).

Then I run the code... (I deleted some lines that are not necessary, I hope I didn't delete a necessary line in the process but I am not aware of any right now...)

 

I just wanted to stress that the tabs got lost during copying the code to this forum.

For the start may be just take the few first lines and adapt your code as how it is described more in depth here:

 

https://pyvisa.readthedocs.io/en/latest/         Especially the four first parts of the "User Guide" List down on the page are useful and go a little deeper into how to configure the NI stuff involved when using this pyvisa package in Python.

 

If this doesn't work then it is as I said likely, that driver issues may be involved. Further googeling might get you to the exact solution then (also check this thread here from the beginning).

 

Best wishes

 

0 Kudos
Message 18 of 19
(4,299 Views)

Hi! Found an easy solution here.

First, open "Optical Power Monitor" software from Throlabs. Then open Help menu>Tools>DriverSwitcher. In DriverSwitcher menu choose your powermeter and press "Switch all to PM100D". Easy as it is.

 

Cheers

 

Message 19 of 19
(3,248 Views)