Xtralien Scientific Python: Taking Measurements Using The X100

 

There are several ways of performing measurements using the the Xtralien X100 Source Measure Unit. In Xtralien Scientific Python, we use four basic commands: measurei, measurev,measure and oneshot.

Example Code

This example code demonstrates the use of all four measurement commands:

### 1. Connect  ###
with X100.USB('COM12') as Dev1: # Connect to the Device via USB
    
    ### 2. Measure Current ###
    measuredi = Dev1.smu1.measurei()[0] # Take a current measurement
    print('Measured Current is ',measuredi,' A')
    
    ### 3. Measure Voltage ###
    measuredv = Dev1.smu1.measurev()[0] # Take a Voltage measurement
    print('Measured Voltage is ',measuredv,' V')
    
    ### 4. Measure Voltage and Current ###
    vandi = Dev1.smu1.measure()[0] # Take a measurement of both voltage and current
    print('Measured Voltage and Current are ',vandi[0], ' and ',vandi[1])    
    
    ### 5. Set Voltage, Measure Voltage and Current ###
    vandi = Dev1.smu1.oneshot(2)[0] # Take a measurement of both voltage and current
    print('Measured Voltage and Current are ',vandi[0], ' and ',vandi[1])

This code prints the result:

Measured Current is  1.57e-06  A
Measured Voltage is  0.00  V
Measured Voltage and Current are  0.00  and  1.64e-06
Measured Voltage and Current are  2.00  and  1.49e-06

Code Breakdown

1. Connect

with X100.USB('COM1') as Dev1: # Connect to the Device via USB

Here we connect to an Xtralien X100 over USB, using COM port 1. This process is covered in our tutorial on Communicating With The X100.

2. measurei (Measure Current)

    current = Dev1.smu1.measurei()[0] # Take a current measurement
    print('Measured Current is ',current,' A')

The measure command can broken down into several parts:

  • Dev1 is the name that we gave to the X100 in section 1.
  • smu1 determines which of the two on-board source measure units (SMUs) we want to measure.
  • measurei tells the board to take a current measurement and return a string in the scientific notation format. This string is within a list with only one entry.
  • We use [0] to change the number from a list format to a double.

We create a variable named current and assign the measured value to it. We then use the print command to display it along with some text

3. measurev (Measure Voltage)

    voltage = Dev1.smu1.measurev()[0] # Take a Voltage measurement
    print('Measured Voltage is ',voltage,' V')

This is similar process to the measurei command, only this time we are measuring voltage using the measurev command.

4. measure (Measure Voltage and Current)

    vandi = Dev1.smu1.measure()[0] # Take a measurement of both current and voltage
    print('Measured Voltage and Current are ',vandi[0], ' and ',vandi[1])

Here we use the measure command without specifying i or v. This will take a measurement of both and return them in a list. To split the voltage and current values, we index the list using [0] for the first value and [1] for the second. For more information on lists, see our python list tutorial.

5. oneshot (Set Voltage, Measure Voltage and Current)

    vandi = Dev1.smu1.oneshot(2)[0] # Take a measurement of both voltage and current
    print('Measured Voltage and Current are ',vandi[0], ' and ',vandi[1])

The oneshot command works in a similar way to the measure command, wherein both the voltage and current are returned. This command allows you to set a voltage at which to perform a measurement. The oneshot(2) command tells the X100 to output 2 V and measure the voltage and current. We then split these values from the returned list as explained in the section above.