Python, open-source programming

- October 4, 2012

Python is a high-level, open-source and one of the largest animals in the jungle of programming languages. Python is also highly flexible, in that you can program in a variety of different programming paradigms. If you want to use Python to write an object-oriented program for the computer side of a test, Python can do that. If you also want to use Python to write the (non-object-oriented) procedural firmware, Python can do that too.

This flexibility has given Python a big advantage over other languages as firmware programmers can use Python for firmware, and then use the same language for the computer software as well. Efforts to get that level of flexibility and continuity out of LabVIEW, Visual Basic, Java or others have not had much success.

Beyond just the language, you'll want to connect your software to the physical world to do your tests. One way to do that would be to run your Python programs on a single-board computer, such as BeagleBoard or Raspberry Pi. Python has emerged as the most common language for both of these platforms, so you'll find a lot of example code and help out there.

Python can also communicate via the ports on your computer. PyVISA is an open-source library that allows Python to communicate over RS232 (Serial), GPIB and USB. RS232 and GPIB are test and measurement communication standards.

With a large user community and the ability to meet embedded and OS programming needs Python is a powerful option for test and measurement. For your next test, particularly one involving embedded computing, see if Python grabs you. For more on Python, see www.python.org.

See "Control test instruments with Python" for a real test application. This summary article contains a link to the complete paper "Use Python to perform swept-sine analysis" that shows how an engineer used Python to control an oscilloscope, vibrometer, and current sensor. The full paper includes source code on how to generate a swept-sine signal.

Loading comments...

Share your thoughts.

To comment please Log In.