M0AGX / LB9MG

Amateur radio and embedded systems

Lab life hack - displaying messages with SCPI

Most modern lab instruments can be controlled remotely via SCPI commands. This allows building various automated setups where many instruments can work together under a command of a single script. SCPI works over USB, Ethernet, RS-232, IEEE-488, and other interfaces depending on the age of the instrument.

Different instruments have different command sets, a power supply does different things than an oscilloscope. This article is about a command I "discovered" quite recently that is supported by instruments with "large displays" (for example oscilloscopes), and how it can be used to improve the quality of life in the lab.

The command is called :DISPlay:ANNotation:TEXT and basically... puts any text on the display. This text is also present when saving the whole screen to a file.

A minimum pyvisa example looks like this:

1
2
def set_text(self, text):
    self.scope.write(':DISPlay:ANNotation:TEXT "%s"' % text)

Trivial. At least for Keysight. Other instruments may use slightly different commands.

How can putting any random text on an oscillogram or spectrum be useful?

The first thing that comes to my mind is of course to add a comment to the particular measurement. The oscilloscope only shows voltage versus time. What about other conditions of the experiment? Register settings? Other voltages, signals, and IOs not captured by the scope? If the list of swept variables is short they could fit into the filename but then they would have to be added manually if the picture is supposed to go into a report. Adding text directly onto the screen solves this issue.

Of course you could capture the traces in a numerical format and annotate out-of-band in some nice database but sometimes saving a hundred PNGs and eyeballing them in a slideshow hits the sweet spot.

Another very important scenario is cooperation in the lab. I use to deal with many setups of many people and I am not sure if some equipment is actually in use, how long it will be in use, and who is the owner of a particular setup. Displaying a simple message like "75% done" and some kind of progress indication helps a lot in running the lab smoothly. 😊

Don't be afraid to experiment with your instruments. Most manufacturers list the SCPI commands in documents titled "programming manual".

Example

The text in yellow comes from a script. annotate display