Skip to content

Connecting to Keysight J7211/A/B/C-Series by Keysight in Python

Instrument Card

Keysight J7211/A/B/C-Series

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

Connect to the Keysight J7211/A/B/C-Series in Python

PROTOCOLS > SCPI

To connect to a Keysight J7211/A/B/C-Series Lockin Amplifier using Qcodes, you can use the following Python script:

from qcodes.instrument.visa import VisaInstrument
from qcodes.utils.validators import Ints
from typing import Optional
class Keysight_J7211(VisaInstrument):
r"""
Qcodes driver for the Keysight J7211 Attenuation Control Unit.
Tested with J7211B.
Args:
name: Instrument name
address: Address or VISA alias of instrument
attenuation: Optional attenuation level (in dB) to set on startup
terminator: Termination character in VISA communication.
"""
def __init__(self, name: str, address: str,
attenuation: Optional[int] = None,
terminator="\r", **kwargs):
super().__init__(name=name, address=address,
terminator=terminator, **kwargs)
model = self.IDN()['model']
if model in ["J7211A", "J7211B"]:
vals = Ints(0, 120)
elif model in ["J7211C"]:
vals = Ints(0, 100)
else:
raise RuntimeError(f"Model {model} is not supported.")
self.add_parameter('attenuation', unit='dB',
set_cmd='ATT {:03.0f}',
get_cmd='ATT?',
get_parser=int,
vals=vals,
initial_value=attenuation)
self.connect_message()

This script defines a class Keysight_J7211 that inherits from VisaInstrument in the qcodes.instrument.visa module. The class represents the Keysight J7211 Attenuation Control Unit.

To connect to the instrument, you can create an instance of the Keysight_J7211 class by providing the necessary arguments:

instrument = Keysight_J7211(name='my_instrument', address='GPIB0::1::INSTR', attenuation=50)

Here, name is the name of the instrument, address is the address or VISA alias of the instrument, and attenuation is an optional parameter to set the attenuation level in dB on startup.

Once the instrument is created, you can access and control its parameters. For example, to get the current attenuation level, you can use:

attenuation = instrument.attenuation()

To set a new attenuation level, you can use:

instrument.attenuation(60)

Remember to replace 'GPIB0::1::INSTR' with the actual address of your instrument.