Skip to content

plasmon360/python_newport_1918_powermeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Communicate with Newport 1918 power meter in Python 2.7

Introduction

This python module [newport_1918c.py] contains high level functions to communicate with Newport 1918 power meter on a Windows computer. It uses python ctypes to access methods in the Newport's usbdll.dll driver.

For connecting the hardware to the computer, see the reference manual

This module is written for Python 2.7. It should also work with Python 3+ with minor modifications

Installing the powermeter and usbdriver

Click here to download the newport powermeter Application and driver

  • On a 32 bit computer:

    1. Unzip the file
    2. Install the drivers and the power application found PowerMeter 3.0.2\win32
    3. run both PMSetup32.msi and USBDriverSetup32.msi (in sub folder). This should install drivers and the newport powermeter application at C:\Program Files\Newport
    4. LIBNAME (argument that is needed to intialize the instrument) in the case will be r'C:\Program Files\Newport\Newport USB Driver\Bin\usbdll.dll'
  • On a 64 bit computer:

    1. Unzip the file.
    2. Install the drivers and the power application found PowerMeter 3.0.2\x86Onx64
    3. run both PMSetup32on64.msi and USBDriverSetup32on64.msi (in sub folder). This should install drivers and the newport powermeter application at C:\Program Files (x86)\Newport
    4. LIBNAME (argument that is needed to intialize the instrument) in the case will be r'C:\Program Files (x86)\Newport\Newport USB Driver\Bin\usbdll.dll'

Before you run the python module, make sure that you can run the newport powermeter application. This will ensure that the drivers are installed properly and there is no problem communicating with the instrument.

Getting the Product ID

The variable "product_id" is needed to intialize the instrument. For my case, the product_id was 0xCEC7. I am not sure if this will change on another computer. To find the product_id or PID,

  1. Open the Windows Device Manager
  2. Expand the Human Interface Devices node
  3. Double-click the device of interest -- the USB Human Interface Device Properties window appears
  4. Click the Details tab.
  5. In the Property drop-down box, select Hardware Ids. The product id is some thinglike PID_ABC1, then use product_id = 0xABC1.

See Here fore more detailed explaination !

Additional notes

  • There are many methods in the usbdll.dll, you can see all the methods in NewPDll.h. The methods I use to connect/disconnection and read/write commands are:
  1. newp_usb_init_system - this function opens all USB instruments.
  2. newp_usb_get_device_info - this function retrieves the USB address of all open instruments.
  3. newp_usb_get_ascii - this function reads the response data from an instrument.
  4. newp_usb_send_ascii - this function sends the passed in command to an instrument.
  5. newp_usb_send_binary - this function sends the passed in binary data to an instrument.
  6. newp_usb_uninit_system - this function closes all USB instruments.
  • A full list of commands that can be sent to the instrument can be found in the reference manual

About

Python driver to communicate with Newport 1918 power meter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors