This case study shows the advantages and the ease of instrument automation using Python when testing the efficiency of a DC/DC converter with different input voltage and load current settings. Since this would require a lot of single measurements, we illustrate the time savings offered by automating the task.
Time savings intensify quickly as soon as we repeat the test several times with different DC/DC converters or with different output voltages. Repetitive testing can be helpful while optimizing your DC/DC converter design or during evaluation under different conditions – for example at different temperatures. Now that we know what benefits we can get from automating this kind of test we take a LM2596 based DC/DC converter module with the output adjusted to 5V.
See the test setup of our instruments here.
Write Python Code!
To improve useability and to have an immediate graphical representation of our test results we want a simple GUI to enter the input voltage and output current ranges and a start button as seen below in Fig 2.
As a result, we want to get a graphic plot of the efficiency curves for every input voltage. From there we can export the results to a .csv File for further processing or more beautiful plots.
To create the GUI we have many choices in Python, this time we go with PyQT5. Here is a partial code snippet on how we set up the GUI and add the needed Widgets to it:
The function that is called with a click on the “Start Measurement” button is very straight forward.
We iterate through the input voltage range in 1V steps and for every input voltage level we iterate through the output current range in 100mA steps.
For every step we measure input voltage and current as well as output voltage and current which allows us to easily calculate the efficiency of the DC/DC converter for this point of operation.
We store the efficiency we have calculated (as you can see in the code-snippet above) as well as the output current in a list that we can use to plot the efficiency vs. output current curve for each input voltage setting.
Get Test Results
Running our Python-Script with the shown settings takes 560 measurements (7 voltages x 20 output current levels x 2 voltage measurements x 2 current measurements) and yields the following result:
The pyqtgraph plot allows us to export the data into a .csv – file, which is a nice “free” feature since we have not had to write a single line of code for this.
Now we can run or repeat the test with different DC/DC converters, different output voltage settings and different voltage and current settings in our GUI.
Coding is fun!
Using Python to automate tedious or repeating testing tasks is an easy way to increase your productivity in education-, R&D- and production-environments. At Computer Controls AG we offer a one-day Python workshop to get you started with your own Python automation projects. We have the expertise and a carefully selected product portfolio available to fulfill your requirements and support your visions with power supplies, E-Loads, Instruments and more. Our expertise of instrument automation is just one click away.
Leave a Reply