Interfacing with 4200A-scs with python

Hi All,

Just wondering iff you could help me out.

I’m trying to control the Keithley 4200 with python using the pylptlib-4200SCS* server connected via ethernet, running on the Keithley 4200. I can control the system with sweep me on another computer, however i would like to control it using python instead on that computer (i simply have code already i would like to use). Im assuming this is possible but i can’t seem to get this too work using pysweepme, Im assuming what I’m trying to do is possible?

I have tried the example given but i cant even seem to get that to work correctly, is this the correct example to be working from**?

Any help would be greatly appreciated
Thanks,
Craig

*GitHub - SweepMe/pylptlib-4200SCS: A Python library for remote control of the Keithley 4200-SCS parameter analyzer via lptlib.dll
**GitHub - SweepMe/pysweepme: Load SweepMe! instrument drivers in your own python projects.

1 Like

Hi Craig,

thanks for you posting your issue!

The SweepMe! 4200-SCS driver has some kind of special status. To establish a remote control via Ethernet, we decided to use the LPTlib approach. For that reason, we have a written a Server application that translates request via Ethernet into LPTlib calls. If you have used SweepMe! with 4200-SCS, I am sure that you already successfully installed this server application. For talking with the Server Application, we also created a library called pylpltib that you already linked in your issue. This library is also used by our SweepMe! driver for the Keithley 4200-SCS.

You now have two options:

  1. You can either just use the pylptlib directly without using pysweepme and the SweepMe! driver by adding this library to your project and follow the examples in pylptlib
    https://github.com/SweepMe/pylptlib-4200SCS/tree/main/examples

  2. It should be also possible, to load the SweepMe! driver for the 4200-SCS with pysweepme and handover the port being the IP address (or localhost) when running the python script on the 4200-SCS. We did not test this, but it should basically be supported as well. Once you have created a device instance of the driver with pysweepme.get_driver(…) e.g. as ‘my_device’ and also called the ‘connect’ method of the driver, it should be possible to call function like

    my_device.lpt.initialize()
    

    for example.

    The object lpt gives you access to the underlying pylptlib library and lpt is
    defined during ‘connect’ method
    https://github.com/SweepMe/instrument-
    drivers/blob/b9158dd2c80c86d4778c57fb3864600d228dd4be/src/LCRmeter- Keithley_4200-SCS/main.py#L199

    which is why it is important to call ‘connect’ after creating the driver instance to be ready to call the lpt commands.

If you have any further questions, feel free to add them here to this issue. If you need any professional support, we can also help you by testing and setting up a working example for you.

Thanks and best,
Axel