Programming the 9103 With Python – Part 1: Standard Speed

Print Friendly, PDF & Email

New sample Python code for the 9103 is now available on RBD’s website. The 9103’s API is easy to program with any language and documented fully, but as always with any device programming, a few examples always help. We chose Python because it’s well supported, easy to understand even if you’re using another language and compatible with a number of popular lab control and analysis environments.

The sample code we provide is open-source and free for you to use and distribute as you see fit.

(If you haven’t taken a look at the 9103 USB auto-ranging picoammeter, everything you need to know can be found here. Measure bi-polar DC current from picoamps to milliamps, with optional built-in bias and 5 kV isolation.)

Programming the 9103 with Python

A Quick Look at the Standard Speed Sampling Code

Python’s pySerial module abstracts the calls to class-compliant USB serial COM port drivers, so setting up communications with the 9103 is a matter of a few simple calls:

port=serial.Serial(
    'com' + port_number,
    baudrate=57600,
    bytesize=serial.EIGHTBITS,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    xonxoff=False,
    timeout=1)

With the addition of a few helper functions for handling ASCII, it’s simple to write functions to send individual commands to the 9103. The following sets the auto-range and filter settings:

def message(message_string):
return bytes('&'+ message_string + '\n','utf-8')

def command_range_auto():
port.write(message('R0')) # put in autorange

def command_default_filter_32():
port.write(message('F032'))

Similarly, with the addition of a few helper functions, the 9103 samples can be read with a simple loop that reads lines from the port buffer: In this case, we’ve setup the 9103 to read in interval mode, and poll the port for incoming samples, with a simple keyboard interrupt. This code also writes the sample information to a text file.

try:
while True:
msg=port.readline().decode('utf-8').rstrip()
print(msg)
parsed = parse_message_for_sample(msg)
if parsed:
samplefile.write( parsed + '\n')

except KeyboardInterrupt:
pass

All of the code is commented and documented in the Python file.

Using Python with LabView and MATLAB

The Python code samples can be helpful to both LabView and MATLAB users.
LabVIEW now supports Python through the Python Node, which features low-latency calls from a LabVIEW Block Diagram using LabVIEW primitives.

The MATLAB Engine API for Python allows you to call MATLAB as a computational engine from Python, and you can call functions and objects in Python from MATLAB.

More to Come…

Next up we’ll be posting some sample code to write and read using the high-speed version of the 9103. Since high-speed data from the 9103 arrives in packets, there are some minor differences in parsing the message samples.

5 kV floating Picoammeter Video

Print Friendly, PDF & Email

This post has been updated to include a video that shows how the High Voltage 9103  (PN 91035K) picoammeter can float up to +/- 5 kV.

RBD Instruments has released a new version of its 9103 USB Picoammeter which incorporates faster reads per second as well as 5000 DC volts of isolation to chassis ground.

9103 HV

9103 HV

Increasing the DC voltage isolation from chassis ground to 5000 volts (5kV) opens up new possibilities for researchers such as direct DC current measurement of very small electron and photo multiplier signals. Electron and ion beam measurements can be biased to reduce secondary electrons or to retard the beam as needed for experiments.

Designed to provide accurate bipolar DC current measurements in noisy environments such as synchrotron beam lines, the 9103 can measure bi-polar DC currents from low picoamps to milliamps.

The drawing below shows how the 9103 is floated on your HV power supply. The high voltage is referenced to chassis ground, and the signal ground is referenced to the high voltage. To help keep the supply and signal connections clear, the HV connection is a MHV connector and the signal input is a SHV connector.

Floating picoammeter

Floating picoammeter

There are a number of manufacturers of programmable DC power supplies that can be used to float the 9103 up to whatever voltage is needed (as long as you do not exceed +/- 5 kV).

For example, TDK-Lambda provides a programmable 0 to 6.5kV supply that can be voltage limited to 5 kV and can drive up to 2 mA of current.

The model number for a 120 VAC line input is PHV6.5P2-USB-1P115.  The base model has a ripple of 700mV which is somewhat high, but TDK-Lambda does offer a low ripple option that gets the ripple down to 75mV.  You can also easily make a simple RC filter to do the same thing. A number of interface options are available including USB, Ethernet, Serial and analog.

TDK Lambda supply

TDK Lambda supply

PHV series

PHV series

The new high speed option for the 9103 increases the reads per second from 40 to over 500, which is fast enough to perform optical chopper experiments. And, by taking more reads in the same amount of time as the first generation 9103 could, the accuracy is improved.

The Actuel software included with the 9103 provides new features for high speed acquisitions and display, but you can also write your own software to control the 9103 using the simple ASCII commands or in LabVIEW.

Since 9103s can be synced, it is now possible to configure a multichannel DC Picoammeter with up to 256 channels that has high speed, high voltage, or both options.

And if you do not need the high speed or high voltage options, the standard 9103 USB Picoammeter is still available as well.

For more information visit the RBD Instruments website at http://www.rbdinstruments.com

High-speed Support Improved in Latest Actuel Release (1.7) for the 9103 Picoammeter

Print Friendly, PDF & Email

RBD has released Actuel version 1.7 for the 9103 Picoammeter, with improvements for high-speed data acquisition and (especially) data logging and graphing.

The latest version can be found here.

If you do not have a high-speed 9103 Picoammeter and are already running Actuel version 1.6, there no reason to download the latest version. However, high-speed users will find a number of improvements.


Oscilloscope emulation


Although Actuel was not designed to have an oscilloscope emulation (with features such as triggering), at higher speeds you can come close to emulating scope current monitoring.

In the Data Window, click the Show Options button and select “Last” from the Graph Options. You can scroll in increments as low as 0.1 second, but you can type in a smaller increment, such as “0.05” in order to display at higher resolution.

Last time option in Actuel
Using the “Last” time option in Actuel


(Note: The graph display options can get out of sync with data collection if you change and option when recording or after stopping and clearing data – it may be necessary to re-enter the value or reset recording. We’re working to make this smoother in the next version.)

For smoother real-time graphing, use standard-speed at 25 mS unless faster rates are needed

The 9103 can run as fast as 25 mS per sample in standard-speed mode, and 2 mS per sample in high-speed. In order to optimize faster data acquisition in high-speed mode, the 9103 collects 10 samples per message, as opposed to 1.

However, note that if you are collecting data at 25 mS in Standard-speed, your PC will be updated with new data every 25 mS. In High-speed, you’ll be updated every 250 mS.

For that reason, the Acutel software always collects data in standard-speed mode at 25 mS and above, regardless of the high-speed mode settings. It is recommended you do the same if you are writing your own software to control the 9103.

That also means that for real-time graphing, you may not want to sample at a rate of, for example, 24 mS, if you can achieve the same results at 25 mS. At faster rates, the delay in caused by receiving 10 samples per message is less noticeable, but it’s visible at rates of 20 mS- 25 mS if you are graphing only the latest points in relatively high resolution:

Actuel 25 mS Standard Speed

Actuel – 25 mS Standard Speed

Actuel 25 mS High Speed

Actuel – 24 mS High Speed