Skip to content

Connecting to HMP 2020 by Rohdes&Schwarz in Python

Instrument Card

The R&S HMP2020 two-channel power supply deliver up to 188 W total output power

HMP 2020

Device Specification: here

Manufacturer card: ROHDES&SCHWARZ

ROHDES&SCHWARZ

Rohde & Schwarz GmbH & Co KG is an international electronics group specializing in the fields of electronic test equipment, broadcast & media, cybersecurity, radiomonitoring and radiolocation, and radiocommunication.

  • Headquarters: Munich, Germany
  • Yearly Revenue (millions, USD): 2500
  • Vendor Website: here

Demo: Measure a solar panel IV curve with a Keithley 2400

Connect to the HMP 2020 in Python

PROTOCOLS > SCPI

import qcodes as qc
from qcodes.instrument_drivers.rohde_schwarz.HMP2020 import HMP2020
# Connect to the power supply
power_supply = HMP2020('power_supply', 'TCPIP0::192.168.0.1::inst0::INSTR')
# Print the power supply IDN
print(power_supply.IDN())
# Set the output voltage to 5V
power_supply.voltage(5)
# Enable the output
power_supply.output('on')
# Disable the output after 2 seconds
qc.sleep(2)
power_supply.output('off')
# Close the connection to the power supply
power_supply.close()

In this script, we first import the necessary modules: qcodes and the HMP2020 driver from the rohde_schwarz package.

Then, we create an instance of the HMP2020 driver, passing the instrument’s connection string as the second argument. The connection string specifies the communication protocol (TCPIP0), IP address (192.168.0.1), and instrument name (inst0).

We can then use the power_supply object to interact with the power supply. In this example, we print the power supply’s identification (IDN) string, set the output voltage to 5V, enable the output, wait for 2 seconds using qc.sleep(), and then disable the output.

Finally, we close the connection to the power supply using power_supply.close().