Skip to content

Connecting to Keysight N5767A by Keysight in Python

Instrument Card

The single output, 1500 W N5767A, provides universal AC input, GPIB, LAN, USB, LXI compliance, and analog/resistance control of output voltage and current. It delivers reliable performance and enhanced capabilities in a compact 1U package.

Keysight N5767A

Device Specification: here

Manufacturer card: KEYSIGHT

KEYSIGHT

Keysight Technologies, or Keysight, is an American company that manufactures electronics test and measurement equipment and software

  • Headquarters: USA
  • Yearly Revenue (millions, USD): 5420
  • Vendor Website: here

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

Connect to the Keysight N5767A in Python

PROTOCOLS > SCPI

Here is a Python script that uses Pymeasure to connect to a Keysight N5767A Power Supply:

from pymeasure.instruments import Instrument
from pymeasure.adapters import VISAAdapter
class KeysightN5767A(Instrument):
# Current (A)
current_range = Instrument.control(
":CURR?", ":CURR %g",
""" A floating point property that controls the DC current range in
Amps, which can take values from 0 to 25 A.
Auto-range is disabled when this property is set. """,
validator=truncated_range,
values=[0, 25],
)
current = Instrument.measurement(":MEAS:CURR?",
""" Reads a setting current in Amps. """
)
# Voltage (V)
voltage_range = Instrument.control(
":VOLT?", ":VOLT %g V",
""" A floating point property that controls the DC voltage range in
Volts, which can take values from 0 to 60 V.
Auto-range is disabled when this property is set. """,
validator=truncated_range,
values=[0, 60]
)
voltage = Instrument.measurement("MEAS:VOLT?",
""" Reads a DC voltage measurement in Volts. """
)
# _status (0/1)
_status = Instrument.measurement(":OUTP?",
""" Read power supply current output status. """
)
def enable(self):
""" Enables the flow of current. """
self.write(":OUTP 1")
def disable(self):
""" Disables the flow of current. """
self.write(":OUTP 0")
def is_enabled(self):
""" Returns True if the current supply is enabled. """
return bool(self._status)
# Create a VISA adapter for communication
adapter = VISAAdapter("GPIB0::22::INSTR")
# Create an instance of the KeysightN5767A power supply
power_supply = KeysightN5767A(adapter)
# Connect to the power supply
power_supply.open()
# Example usage
print("Current Range:", power_supply.current_range)
print("Voltage Range:", power_supply.voltage_range)
power_supply.enable()
print("Is Enabled:", power_supply.is_enabled())
power_supply.disable()
print("Is Enabled:", power_supply.is_enabled())
# Close the connection
power_supply.close()

This script creates a class KeysightN5767A that represents the Keysight N5767A Power Supply. It defines properties and methods to control and measure the current and voltage of the power supply.

The script then creates a VISA adapter using VISAAdapter("GPIB0::22::INSTR"), where "GPIB0::22::INSTR" is the address of the power supply. You may need to change this address to match your setup.

An instance of the KeysightN5767A class is created using the adapter, and the power supply is opened with power_supply.open().

You can then use the properties and methods of the KeysightN5767A class to interact with the power supply. In the example usage section, it prints the current range, voltage range, enables and disables the power supply, and checks if it is enabled.

Finally, the connection is closed with power_supply.close().