Tutorial: An Xtralien J-V Sweep in LabVIEW


In this tutorial, we will build on the VI we made in the Basic Commands Tutorial to perform a current-voltage sweep using the Xtralien X100. The image below shows what the final VI will look like. We will only focus on the new components in this tutorial, as the START, WRITE, READ and STOP sub-VIs were all explained previously.

We have taken the Basic Commands program and combined it with two new sub-VIs to create a functional J-V sweep. The two new components are 'Sweep Command Builder' and 'String To Array'.

Sweep Command Builder

The Xtralien board accepts commands in the form of a string. When we know that we are going to be sending a particular command repeatedly, it is easier to automate this process rather than manually typing in every time. This program will be using the 'sweep' command, which works in the format below.

smu[1,2] sweep [start voltage] [voltage increment] [end voltage] [hysteresis]

Where hysteresis is set to 'd' to perform an extra sweep in reverse, or left blank for normal operation. This is useful when a J-V sweep in one direction gives a different result than a J-V sweep in the opposite direction, such as when characterising perovskite solar cells. 
 An example string would be:

'smu1 sweep -1 0.1 1'

which will use SMU 1 to measure current at specific voltages from -1V to 1V in increments of 0.1V. The important inputs in this program are therefore SMU number, start voltage, voltage increment and end voltage. As you can see in the image above, these are all wired in to the 'Sweep Command Builder' sub-VI.

Below shows the block diagram and front panel of this sub-VI.

The inputs for SMU number, start voltage, voltage increment, end voltage and hysteresis are all concatenated with the appropriate command strings into a full command.

String To Array

Upon completing a sweep measurement, the Xtralien board will return the results in the form of a long string. It will be enclosed by square brackets and use the format:


where current and voltage are separated by a comma, and each measurement is separated by a semi colon. We must be aware of the string's format before we can extract useful data from it. Below shows a the String To Array sub-VI, which we use to transform the returned string into two numerical arrays of voltage and current.

The program first uses a pattern recognition function to remove the square brackets from the string, leaving the numbers in the format:


The string then enters a while loop which separates the string in to individual current and voltage measurements by cutting it every time it encounters a semi colon. The pattern recognition function then separates this single measurement into current and voltage values by cutting it at the comma. 

The loop will run until the the end of the string, extracting current and voltage from a single measurement during each loop and storing  them in arrays. Once the arrays have been output by the Array to String sub-VI, they can be plotted on an XY graph.


In this tutorial we have modified the Basic Commands VI to perform a current-voltage sweep, extracted the current and voltage values and stored them in two separate arrays.