# Keithley¶

## Keithley195 Digital Multimeter¶

class instruments.keithley.Keithley195(filelike)[source]

The Keithley 195 is a 5 1/2 digit auto-ranging digital multimeter. You can find the full specifications list in the Keithley 195 user’s guide.

Example usage:

>>> import instruments as ik
>>> import instruments.units as u
>>> dmm = ik.keithley.Keithley195.open_gpibusb('/dev/ttyUSB0', 12)
>>> print dmm.measure(dmm.Mode.resistance)

class Mode[source]

Enum containing valid measurement modes for the Keithley 195

current_ac = 4
current_dc = 3
resistance = 2
voltage_ac = 1
voltage_dc = 0
class TriggerMode[source]

Enum containing valid trigger modes for the Keithley 195

ext_continuous = 6
ext_one_shot = 7
get_continuous = 2
get_one_shot = 3
talk_continuous = 0
talk_one_shot = 1
x_continuous = 4
x_one_shot = 5
class ValidRange[source]

Enum containing valid range settings for the Keithley 195

current_ac = (2e-05, 0.0002, 0.002, 0.02, 0.2, 2, 2)
current_dc = (2e-05, 0.0002, 0.002, 0.02, 0.2, 2)
resistance = (20, 200, 2000, 20000.0, 200000.0, 2000000.0, 20000000.0)
voltage_ac = (0.02, 0.2, 2, 20, 200, 700)
voltage_dc = (0.02, 0.2, 2, 20, 200, 1000)
auto_range()[source]

Turn on auto range for the Keithley 195.

This is the same as calling Keithley195.input_range = 'auto'

get_status_word()[source]

Retreive the status word from the instrument. This contains information regarding the various settings of the instrument.

The function parse_status_word is designed to parse the return string from this function.

Returns: String containing setting information of the instrument str
measure(mode=None)[source]

Instruct the Keithley 195 to perform a one time measurement. The instrument will use default parameters for the requested measurement. The measurement will immediately take place, and the results are directly sent to the instrument’s output buffer.

Method returns a Python quantity consisting of a numpy array with the instrument value and appropriate units.

With the 195, it is HIGHLY recommended that you seperately set the mode and let the instrument settle into the new mode. This can sometimes take longer than the 2 second delay added in this method. In our testing the 2 seconds seems to be sufficient but we offer no guarentee.

Example usage:

>>> import instruments as ik
>>> import instruments.units as u
>>> dmm = ik.keithley.Keithley195.open_gpibusb('/dev/ttyUSB0', 12)
>>> print(dmm.measure(dmm.Mode.resistance))

Parameters: mode (Keithley195.Mode) – Desired measurement mode. This must always be specified in order to provide the correct return units. A measurement from the multimeter. Quantity
static parse_status_word(statusword)[source]

Parse the status word returned by the function get_status_word.

Returns a dict with the following keys: {trigger,mode,range,eoi,buffer,rate,srqmode,relative,delay,multiplex, selftest,dataformat,datacontrol,filter,terminator}

Parameters: statusword – Byte string to be unpacked and parsed str A parsed version of the status word as a Python dictionary dict
trigger()[source]

Tell the Keithley 195 to execute all commands that it has received.

Do note that this is different from the standard SCPI *TRG command (which is not supported by the 195 anyways).

input_range

Gets/sets the range of the Keithley 195 input terminals. The valid range settings depends on the current mode of the instrument. They are listed as follows:

1. voltage_dc = (20e-3, 200e-3, 2, 20, 200, 1000)
2. voltage_ac = (20e-3, 200e-3, 2, 20, 200, 700)
3. current_dc = (20e-6, 200e-6, 2e-3, 20e-3, 200e-3, 2)
4. current_ac = (20e-6, 200e-6, 2e-3, 20e-3, 200e-3, 2)
5. resistance = (20, 200, 2000, 20e3, 200e3, 2e6, 20e6)

All modes will also accept the string auto which will set the 195 into auto ranging mode.

Return type: Quantity or str
mode

Gets/sets the measurement mode for the Keithley 195. The base model only has DC voltage and resistance measurements. In order to use AC voltage, DC current, and AC current measurements your unit must be equiped with option 1950.

Example use:

>>> import instruments as ik
>>> dmm = ik.keithley.Keithley195.open_gpibusb('/dev/ttyUSB0', 12)
>>> dmm.mode = dmm.Mode.resistance

relative

Gets/sets the zero command (relative measurement) mode of the Keithley 195.

As stated in the manual: The zero mode serves as a means for a baseline suppression. When the correct zero command is send over the bus, the instrument will enter the zero mode, as indicated by the front panel ZERO indicator light. All reading displayed or send over the bus while zero is enabled are the difference between the stored baseline adn the actual voltage level. For example, if a 100mV baseline is stored, 100mV will be subtracted from all subsequent readings as long as the zero mode is enabled. The value of the stored baseline can be as little as a few microvolts or as large as the selected range will permit.

Type: bool
trigger_mode

Gets/sets the trigger mode of the Keithley 195.

There are two different trigger settings for four different sources. This means there are eight different settings for the trigger mode.

The two types are continuous and one-shot. Continuous has the instrument continuously sample the resistance. One-shot performs a single resistance measurement.

The three trigger sources are on talk, on GET, and on “X”. On talk refers to addressing the instrument to talk over GPIB. On GET is when the instrument receives the GPIB command byte for “group execute trigger”. On “X” is when one sends the ASCII character “X” to the instrument. This character is used as a general execute to confirm commands send to the instrument. In InstrumentKit, “X” is sent after each command so it is not suggested that one uses on “X” triggering. Last, is external triggering. This is the port on the rear of the instrument. Refer to the manual for electrical characteristics of this port.

## Keithley485 Picoammeter¶

class instruments.keithley.Keithley485(filelike)[source]

The Keithley Model 485 is a 4 1/2 digit resolution autoranging picoammeter with a +- 20000 count LCD. It is designed for low current measurement requirements from 0.1pA to 2mA.

The device needs some processing time (manual reports 300-500ms) after a command has been transmitted.

Example usage:

>>> import instruments as ik
>>> inst = ik.keithley.Keithley485.open_gpibusb("/dev/ttyUSB0", 22)
>>> inst.measure()  # Measures the current
array(-1.278e-10) * A

class SRQDataMask[source]

Enum containing valid SRQ data masks for the Keithley 485

busy = 16

Device busy

busy_read_done = 24

busy_read_done_ovf = 25

busy_read_ovf = 17

read_done = 8

read_done_ovf = 9

read_ovf = 1

srq_disabled = 0

Service request (SRQ) disabled

class SRQErrorMask[source]

Enum containing valid SRQ error masks for the Keithley 485

idcc = 2

Illegal Device-Dependent Command (IDDC)

idcco = 1

Illegal Device-Dependent Command Option (IDDCO)

idcco_idcc = 3

IDDCO or IDDC

not_remote = 4

Device not in remote

not_remote_idcc = 6

Device not in remote or IDDC

not_remote_idcco = 5

Device not in remote or IDDCO

not_remote_idcco_idcc = 7

Device not in remote, IDDCO or IDDC

srq_disabled = 0

Service request (SRQ) disabled

class Status[source]

Enum containing valid status keys in the measurement string

normal = b'N'

Measurement normal

overflow = b'O'

Measurement overflow

relative = b'Z'

Measurement relative

zerocheck = b'C'

Measurement zero-check

class TriggerMode[source]

Enum containing valid trigger modes for the Keithley 485

continuous_onget = 2

Continuously measures current, returns on GET

continuous_ontalk = 0

Continuously measures current, returns on talk

continuous_onx = 4

Continuously measures current, returns on X

oneshot_onget = 3

Measures current once and returns on GET

oneshot_ontalk = 1

Measures current once and returns on talk

oneshot_onx = 5

Measures current once and returns on X

auto_range()[source]

Turn on auto range for the Keithley 485.

This is the same as calling the Keithley485.set_current_range method and setting the parameter to “AUTO”.

get_status()[source]

Gets and parses the status word.

Returns a dict with the following keys: {zerocheck,log,range,relative,eoi,relative, trigger,datamask,errormask,terminator}

Return type: dict
measure()[source]

Perform a current measurement with the Keithley 485.

Return type: Quantity
eoi_mode

Gets/sets the ‘eoi’ mode (K) of the Keithley 485.

The model 485 will normally send an end of interrupt (EOI) during the last byte of its data string or status word. The EOI reponse of the instrument may be included or omitted. Warning: the default setting (K0) includes it.

Type: bool
input_range

Gets/sets the range (R) of the Keithley 485 input terminals. The valid ranges are one of {auto|2e-9|2e-8|2e-7|2e-6|2e-5|2e-4|2e-3}

Type: Quantity or str
log

Gets/sets the ‘log’ mode (D) of the Keithley 485.

Once log is enabled (D1 sent), the device will return the logarithm of the current readings.

Type: bool
relative

Gets/sets the relative measurement mode (Z) of the Keithley 485.

As stated in the manual: The relative function is used to establish a baseline reading. This reading is subtracted from all subsequent readings. The purpose of making relative measurements is to cancel test lead and offset currents or to store an input as a reference level.

Once a relative level is established, it remains in effect until another relative level is set. The relative value is only good for the range the value was taken on and higher ranges. If a lower range is selected than that on which the relative was taken, inaccurate results may occur. Relative cannot be activated when “OL” is displayed.

Type: bool
trigger_mode

Gets/sets the trigger mode (T) of the Keithley 485.

There are two different trigger settings for three different sources. This means there are six different settings for the trigger mode.

The two types are continuous and one-shot. Continuous has the instrument continuously sample the current. One-shot performs a single current measurement when requested to do so.

The three trigger sources are on talk, on GET, and on “X”. On talk refers to addressing the instrument to talk over GPIB. On GET is when the instrument receives the GPIB command byte for “group execute trigger”. Last, on “X” is when one sends the ASCII character “X” to the instrument.

It is recommended to leave it in the default mode (T0, continuous on talk), and simply ignore the output when other commands are called.

zero_check

Gets/sets the ‘zero check’ mode (C) of the Keithley 485.

Once zero check is enabled (C1 sent), the display can be zeroed with the REL feature or the front panel pot.

Type: bool

## Keithley580 Microohm Meter¶

class instruments.keithley.Keithley580(filelike)[source]

The Keithley Model 580 is a 4 1/2 digit resolution autoranging micro-ohmmeter with a +- 20,000 count LCD. It is designed for low resistance measurement requirements from 10uΩ to 200kΩ.

The device needs some processing time (manual reports 300-500ms) after a command has been transmitted.

class Drive[source]

Enum containing valid drive modes for the Keithley 580

dc = 1
pulsed = 0
class Polarity[source]

Enum containing valid polarity modes for the Keithley 580

negative = 1
positive = 0
class TriggerMode[source]

Enum containing valid trigger modes for the Keithley 580

get_continuous = 2
get_one_shot = 3
talk_continuous = 0
talk_one_shot = 1
trigger_continuous = 4
trigger_one_shot = 5
auto_range()[source]

Turn on auto range for the Keithley 580.

This is the same as calling the Keithley580.set_resistance_range method and setting the parameter to “AUTO”.

get_status_word()[source]

The keithley will not always respond with the statusword when asked. We use a simple heuristic here: request it up to 5 times, using a 1s delay to allow the keithley some thinking time.

Return type: str
measure()[source]

Perform a measurement with the Keithley 580.

The usual mode parameter is ignored for the Keithley 580 as the only valid mode is resistance.

Return type: Quantity
static parse_measurement(measurement)[source]

Parse the measurement string returned by the instrument.

Returns a dict with the following keys: {status,polarity,drycircuit,drive,resistance}

Parameters: measurement – String to be unpacked and parsed str dict
parse_status_word(statusword)[source]

Parse the status word returned by the function get_status_word.

Returns a dict with the following keys: {drive,polarity,drycircuit,operate,range,relative,eoi,trigger, sqrondata,sqronerror,linefreq,terminator}

Parameters: statusword – Byte string to be unpacked and parsed str dict
query(cmd, size=-1)[source]

Executes the given query.

Parameters: cmd (str) – String containing the query to execute. size (int) – Number of bytes to be read. Default is read until termination character is found. The result of the query as returned by the connected instrument. str
sendcmd(cmd)[source]

Sends a command without waiting for a response.

Parameters: cmd (str) – String containing the command to be sent.
set_calibration_value(value)[source]

Sets the calibration value. This is not currently implemented.

Parameters: value – Calibration value to write
store_calibration_constants()[source]

Instructs the instrument to store the calibration constants. This is not currently implemented.

trigger()[source]

Tell the Keithley 580 to execute all commands that it has received.

Do note that this is different from the standard SCPI *TRG command (which is not supported by the 580 anyways).

drive

Gets/sets the instrument drive to either pulsed or DC.

Example use:

>>> import instruments as ik
>>> keithley = ik.keithley.Keithley580.open_gpibusb('/dev/ttyUSB0', 1)
>>> keithley.drive = keithley.Drive.pulsed

dry_circuit_test

Gets/sets the ‘dry circuit test’ mode of the Keithley 580.

This mode is used to minimize any physical and electrical changes in the contact junction by limiting the maximum source voltage to 20mV. By limiting the voltage, the measuring circuit will leave the resistive surface films built up on the contacts undisturbed. This allows for measurement of the resistance of these films.

Type: bool
input_range

Gets/sets the range of the Keithley 580 input terminals. The valid ranges are one of {AUTO|2e-1|2|20|200|2000|2e4|2e5}

Type: Quantity or str
operate

Gets/sets the operating mode of the Keithley 580. If set to true, the instrument will be in operate mode, while false sets the instruments into standby mode.

Type: bool
polarity

Gets/sets instrument polarity.

Example use:

>>> import instruments as ik
>>> keithley = ik.keithley.Keithley580.open_gpibusb('/dev/ttyUSB0', 1)
>>> keithley.polarity = keithley.Polarity.positive

relative

Gets/sets the relative measurement mode of the Keithley 580.

As stated in the manual: The relative function is used to establish a baseline reading. This reading is subtracted from all subsequent readings. The purpose of making relative measurements is to cancel test lead and offset resistances or to store an input as a reference level.

Once a relative level is established, it remains in effect until another relative level is set. The relative value is only good for the range the value was taken on and higher ranges. If a lower range is selected than that on which the relative was taken, inaccurate results may occur. Relative cannot be activated when “OL” is displayed.

Type: bool
trigger_mode

Gets/sets the trigger mode of the Keithley 580.

There are two different trigger settings for three different sources. This means there are six different settings for the trigger mode.

The two types are continuous and one-shot. Continuous has the instrument continuously sample the resistance. One-shot performs a single resistance measurement.

The three trigger sources are on talk, on GET, and on “X”. On talk refers to addressing the instrument to talk over GPIB. On GET is when the instrument receives the GPIB command byte for “group execute trigger”. Last, on “X” is when one sends the ASCII character “X” to the instrument. This character is used as a general execute to confirm commands send to the instrument. In InstrumentKit, “X” is sent after each command so it is not suggested that one uses on “X” triggering.

## Keithley2182 Nano-voltmeter¶

class instruments.keithley.Keithley2182(filelike)[source]

The Keithley 2182 is a nano-voltmeter. You can find the full specifications list in the user’s guide.

Example usage:

>>> import instruments as ik
>>> meter = ik.keithley.Keithley2182.open_gpibusb("/dev/ttyUSB0", 10)
>>> print(meter.measure(meter.Mode.voltage_dc))

class Channel(parent, idx)[source]

Class representing a channel on the Keithley 2182 nano-voltmeter.

Warning

This class should NOT be manually created by the user. It is designed to be initialized by the Keithley2182 class.

measure(mode=None)[source]

Performs a measurement of the specified channel. If no mode parameter is specified then the current mode is used.

Parameters: mode (Keithley2182.Mode) – Mode that the measurement will be performed in The value of the measurement Quantity
input_range

Gets/sets the current input range setting of the multimeter. This is an abstract method.

Type: Quantity or Enum
mode

Gets/sets the measurement mode for the multimeter. This is an abstract method.

Type: Enum
relative

Gets/sets the status of relative measuring mode for the multimeter. This is an abstract method.

Type: bool
trigger_mode

Gets/sets the trigger mode for the multimeter. This is an abstract method.

Type: Enum
class Mode[source]

Enum containing valid measurement modes for the Keithley 2182

temperature = 'TEMP'
voltage_dc = 'VOLT'
class TriggerMode[source]

Enum containing valid trigger modes for the Keithley 2182

bus = 'BUS'
external = 'EXT'
immediate = 'IMM'
manual = 'MAN'
timer = 'TIM'
fetch()[source]

Transfer readings from instrument memory to the output buffer, and thus to the computer. If currently taking a reading, the instrument will wait until it is complete before executing this command. Readings are NOT erased from memory when using fetch. Use the R? command to read and erase data. Note that the data is transfered as ASCII, and thus it is not recommended to transfer a large number of data points using GPIB.

Returns: Measurement readings from the instrument output buffer. tuple[~pint.Quantity, …] or if numpy is installed, Quantity with numpy.array data
measure(mode=None)[source]

Perform and transfer a measurement of the desired type.

Parameters: mode – Desired measurement mode. If left at default the measurement will occur with the current mode. Keithley2182.Mode Returns a single shot measurement of the specified mode. Quantity Volts, Celsius, Kelvin, or Fahrenheit
channel

Gets a specific Keithley 2182 channel object. The desired channel is specified like one would access a list.

Although not default, the 2182 has up to two channels.

For example, the following would print the measurement from channel 1:

>>> meter = ik.keithley.Keithley2182.open_gpibusb("/dev/ttyUSB0", 10)
>>> print meter.channel[0].measure()

Return type: Keithley2182.Channel
input_range

Gets/sets the device input range for the device range for the currently set multimeter mode.

Example usages:

>>> dmm.input_range = dmm.InputRange.automatic
>>> dmm.input_range = 1 * u.millivolt

Units: As appropriate for the current mode setting. Quantity, or InputRange
relative

Gets/sets the relative measurement function of the Keithley 2182.

This is used to enable or disable the relative function for the currently set mode. When enabling, the current reading is used as a baseline which is subtracted from future measurements.

If relative is already on, the stored value is refreshed with the currently read value.

Type: bool
units

Gets the current measurement units of the instrument.

Return type: Unit

## Keithley6220 Constant Current Supply¶

class instruments.keithley.Keithley6220(filelike)[source]

The Keithley 6220 is a single channel constant current supply.

Because this is a constant current supply, most features that a regular power supply have are not present on the 6220.

Example usage:

>>> import instruments.units as u
>>> import instruments as ik
>>> ccs = ik.keithley.Keithley6220.open_gpibusb("/dev/ttyUSB0", 10)
>>> ccs.current = 10 * u.milliamp # Sets current to 10mA
>>> ccs.disable() # Turns off the output and sets the current to 0A

disable()[source]

Set the output current to zero and disable the output.

channel

For most power supplies, this would return a channel specific object. However, the 6220 only has a single channel, so this function simply returns a tuple containing itself. This is for compatibility reasons if a multichannel supply is replaced with the single-channel 6220.

For example, the following commands are the same and both set the current to 10mA:

>>> ccs.channel[0].current = 0.01
>>> ccs.current = 0.01

current

Gets/sets the output current of the source. Value must be between -105mA and +105mA.

Units: As specified, or assumed to be $$\text{A}$$ otherwise. float or Quantity
current_max
current_min
voltage

This property is not supported by the Keithley 6220.

## Keithley6514 Electrometer¶

class instruments.keithley.Keithley6514(filelike)[source]

The Keithley 6514 is an electrometer capable of doing sensitive current, charge, voltage and resistance measurements.

Example usage:

>>> import instruments as ik
>>> import instruments.units as u
>>> dmm = ik.keithley.Keithley6514.open_gpibusb('/dev/ttyUSB0', 12)

class ArmSource[source]

Enum containing valid trigger arming sources for the Keithley 6514

bus = 'BUS'
immediate = 'IMM'
manual = 'MAN'
nstest = 'NST'
pstest = 'PST'
stest = 'STES'
timer = 'TIM'
class Mode[source]

Enum containing valid measurement modes for the Keithley 6514

charge = 'CHAR'
current = 'CURR:DC'
resistance = 'RES'
voltage = 'VOLT:DC'
class TriggerMode[source]

Enum containing valid trigger modes for the Keithley 6514

immediate = 'IMM'
class ValidRange[source]

Enum containing valid measurement ranges for the Keithley 6514

charge = (2e-08, 2e-07, 2e-06, 2e-05)
current = (2e-11, 2e-10, 2e-09, 2e-08, 2e-07, 2e-06, 2e-05, 0.0002, 0.002, 0.02)
resistance = (2000.0, 20000.0, 200000.0, 2000000.0, 20000000.0, 200000000.0, 2000000000.0, 20000000000.0, 200000000000.0)
voltage = (2, 20, 200)
auto_config(mode)[source]
This command causes the device to do the following:
• Switch to the specified mode
• Reset all related controls to default values
• Set trigger and arm to the ‘immediate’ setting
• Set arm and trigger counts to 1
• Set trigger delays to 0
• Place unit in idle state
• Disable all math calculations
• Disable buffer operation
• Enable autozero
fetch()[source]

Request the latest post-processed readings using the current mode. (So does not issue a trigger) Returns a tuple of the form (reading, timestamp)

read_measurements()[source]

Trigger and acquire readings using the current mode. Returns a tuple of the form (reading, timestamp)

arm_source

Gets/sets the arm source of the Keithley 6514.

auto_range

Gets/sets the auto range setting

Type: bool
input_range

Gets/sets the upper limit of the current range.

Type: Quantity
mode

Gets/sets the measurement mode of the Keithley 6514.

trigger_mode

Gets/sets the trigger mode of the Keithley 6514.

unit

Gets/sets the measurement mode for the electrometer. This is an abstract method.

Type: Unit
zero_check

Gets/sets the zero checking status of the Keithley 6514.

zero_correct

Gets/sets the zero correcting status of the Keithley 6514.