Close

Getting Close & Public Repo

A project log for LabAssistant - SCPI pyVISA

Falling down a lab automation rabbit hole.

jesse-farrellJesse Farrell 02/24/2025 at 05:380 Comments

A quick update on the current state of this homebrew python project. The project is still very much a work in progress, but it’s polished enough that I figured I’d make it public. My long-term goal is to incorporate all the equipment from the office, my colleagues, and my own lab. Also, I’d like to add the module to the Python Package Index (PyPI). I’m already part way there, all my equipment has been added at least! Here’s a demo of what the thing can do right now….

The general file structure for the project is shown below (excluding some directories that aren’t super important right now).

LABASSISTANT   

├── ABC     

│   ├── DMM.py     

│   ├── ELOAD.py     

│   ├── PSU.py     

│   └──SCOPE.py     

├── config     

│   ├── Digital_Multimeter

│    │  ├──siglent_sdm3055.py

│    │   └──fluke_8840a.py      

│   ├── Electronic_Load

│    │   └──siglent_sdl1020xe.py     

│   ├── Function_Generator     

│   ├── Oscilloscope     

│   └── Power_Supply     

├── enums     

│   ├── eload_enum.py     

│   ├── generic_enum.py     

│   └──  scope_enum.py     

├── errors.py     

├── generic_device.py     

├── lab_assistant.py     

└── registry.py

In terms of inheritance, starting from the children, we have devices (stored in the config folder... maybe I need to rename that -_- ). For example, fluke_8840A. This device inherits from the DMM class which itself inherits from GenericDevice. In general, any device that inherits from the DMM class is compatible, but may be missing certain features. For example, SDM3055 can measure capacitance but 8840A can’t. In cases like this you’d get an error if you try to call FlukeDMM.measure(MeasureType.Capacitance).

To setup a device you just call one of LabAssistants setup_xxx methods... for example.

my_scope = LabAssistant.setup_scope(resource="TCPIP::192.168.1.11::INSTR")
my___psu = LabAssistant.setup_psu(resource="TCPIP::192.168.1.12::INSTR")
my_eload = LabAssistant.setup_eload(resource="TCPIP::192.168.1.13::INSTR")
my___dmm = LabAssistant.setup_dmm(resource="GPIB0::1::INSTR")

The script will query the device at the specified port to determine the make and model, and dynamically load the relevant class. However, if you’d rather a more controlled approach you could use the “Forced_Driver” argument to tell the script exactly what device to expect. In the example below, if a fluke 8840a were not found at that resource, an error would be risen.

my___dmm = LabAssistant.setup_dmm(resource="GPIB0::1::INSTR", Forced_Driver = "fluke_8840a")

Once the connection is established, we can set the measurement type and read values from the dmm. Currently only single sample modes are supported, but I plan to add more configurable measurement methods in the future.

my___dmm.measure(MeasureType.VOLTAGE)

It's that easy!

I'll record some video demo's of the other classes later this week. If you're interested in learning more, you can poke around the public repo.

Discussions