Remote Control of Rohde & Schwarz Oscilloscopes Using the RsInstrument Python Module

Rohde & Schwarz offers a powerful tool for remote control of their oscilloscopes - the RsInstrument Python module. This module enables users to control and automate their Rohde & Schwarz test & measurement instruments, including oscilloscopes, through Python scripts or interactive console communication.

Installation

To get started, it is recommended to use Python version 3.8 and the PyCharm IDE, Community Edition. The RsInstrument Python module (version 1.55 or higher) is required for this setup, as well as the R&S VISA.

The RsInstrument Python module can be installed or updated via PyPI, the Python Package Index. Once installed, users can leverage the power of Python to control their Rohde & Schwarz oscilloscopes. The ready-to-use examples for oscilloscopes and other R&S instruments are available in our GitHub repository.

Furthermore it is recommended to use the R&S Instrument Control Pycharm plugin (RsIC). It is targeted for users of Pycharm to write python instrument remote-control scripts. It is optimized, although not exclusive to be used with our RsInstrument Python package.

One of the key benefits of using the RsInstrument Python module is the reduction in time spent on testing correct SCPI (Standard Commands for Programmable Instruments) sequences. The module ensures that parameters not explicitly specified use correct default values compliant with the specification. In case of invalid parameters, an error handling procedure is triggered, providing a detailed exception message.

The RsInstrument Python module also comes with a 'Getting Started' remote control example using Python in PyCharm: https://rsinstrument.readthedocs.io

By downloading the Python package, users agree to the Terms and Conditions for royalty free software. This allows Rohde & Schwarz to provide a robust and reliable solution for remote control of their oscilloscopes.

Connecting to the instrument

To connect to the Rohde & Schwarz oscilloscope using the RsInstrument Python module, you will first need to know the IP address or hostname of the oscilloscope. This can be found in the oscilloscope's network settings. Once you have the IP address or hostname, you can establish a connection using the RsInstrument Python module. The connection is established by creating new RsInstrument' object, which takes the IP address or hostname of the oscilloscope as a parameter.

Here is a simple example script that connects to the oscilloscope and retrieves the instrument's identification string:

from RsInstrument import *
# Replace '192.168.1.100' with the IP address of your oscilloscope
instr = RsInstrument('TCPIP::192.168.1.100::INSTR')
# Retrieve the instrument's identification string
idn_string = instr.query('*IDN?')
print(f'Connected to: {idn_string}')

In this script, we first import the RsInstrument module. We then create an instance of the RsInstrument class, passing the IP address of the oscilloscope to the constructor. Finally, we use the 'query()' method to send the '*IDN?' command to the oscilloscope, which returns the instrument's identification string.
Remember to replace '192.168.1.100' with the actual IP address or hostname of your oscilloscope. The IP address and hostname can be found in the oscilloscope's network settings.

Examples

A multitude of elementary examples demonstrating the use of Rohde & Schwarz oscilloscopes via Python remote programming are readily accessible on the renowned open-source platform, GitHub. Furthermore, a comprehensive catalogue of SCPI commands tailored for individual user scripts can be found in the corresponding manual of each oscilloscope.

Powerful Python remote programming of R&S oscilloscopes

In conclusion, the RsInstrument Python module offers a powerful and efficient way to remotely control Rohde & Schwarz oscilloscopes. With its easy setup and comprehensive support, it is an invaluable tool for any user looking to automate and streamline their test and measurement processes. It enables straightforward test automation for end-of-line production testing and other applications.

Using software pyhthon with rohde & schwarz oscilloscopes