Home>Characterization Test Center>Test How-To

Control test instruments with Python

Martin Rowe, Senior Technical Editor- September 1, 2011

Many engineers write code to automate instruments and collect data. While you can use commercially available programming languages, you can also use open-source software tools to write your automation code.

Digest, Python figure

An input signal excites a transducer to cause vibration in a mechanical system, which the oscilloscope measures.
Sinay Goldberg, an engineer in Ra’anna, Israel, needed to measure the frequency response of a mechanical system. Using an oscilloscope, a function generator, a current sensor, a piezoelectric transducer, and a laser vibrometer, Goldberg designed a measurement system that generates a stimulus signal and captures the mechanical system’s response signals (figure). He controls the oscilloscope and function generator through a USB port and with software written in Python (www.python.org). A pyvisa application provides a link to the instruments through a common programming interface (sourceforge.net/projects/pyvisa).

The function generator excites the mechanical system using a swept-frequency sine wave. When the mechanical system vibrates, the vibrometer converts mechanical motion into an electrical signal that the oscilloscope captures. After transferring the data to a PC, Goldberg’s Python application software converts the signals to the frequency domain for analysis.

You can read about the application in more detail and obtain the Python source code in Use Python to perform swept-sine analysis.

Loading comments...

Share your thoughts.

To comment please Log In.