How to automate measurements with Python

April 19, 2016 // By Fabrizio Guerrieri
Fabrizio Guerrieri, Sr. System/Application Engineer at Maxim Integrated, considers ways of automating measurements with Python.

As a system and application engineer, I've saved countless hours by automating measurements with software such as LabVIEW. Although I've used it to build measurement applications, I've started to replace LabVIEW with Python for basic lab measurements where I don’t need develop an easy-to-use GUI for others to use. When I just need to quickly take some measurements, Python lets me save them in an easy-to-read format and plot them.

To understand why, let's look at the main advantages of Python and discuss a working example of a Python application. The best way to convey the convenience and power of Python is to describe a complete, working Python automation script, such as the one I used to automate the measurement of a VR's (voltage regulator’s) load-regulation curve (load regulation is the variation of the output voltage as the output current - the load - increases).

VRs are divided into two categories: zero-droop regulators and droop regulators. Zero-droop regulators have zero output resistance; the output-voltage setpoint shouldn't change with increasing output currents. On the contrary, droop regulators are said to have a 'loadline', which means they're designed to have a specific equivalent output resistance. The regulator used for this example has a zero-current output voltage of 1 V and a programmed loadline of 2.5 mΩ. Figure 1 shows the test setup.

Figure 1. The VR under test connects to an electronic load while a DAQ system measures the output current through a shunt resistor.

The load current (the VR output current) is applied using a Chroma 63201 electronic load. The output current is measured by acquiring the voltage across a calibrated 4-mΩ shunt resistor. Both voltage and current are acquired using a Keysight 34970A DAQ (data-acquisition system), and both the DAQ and the electronic load communicate to a computer over a GPIB link. The goal of our measurement is to verify that the output voltage is within specification across a range of output currents; Figure 2 shows the application's flowchart.

Figure 2. The application sets the electronic load, measures the VR output voltage and current, and saves the results.

The next pages describe the code I used to make these measurements. There, you'll find links to download the code as a text file.

Design category: