I have a Keithley 2700 which, according to
the datasheet table "DC MEASUREMENT SPEEDS", should be able to measure up to 2500 readings per second. However, I don't seem to get higher than about 200 readings per second. I would really appreciate some guidance to know what am I configuring wrong. These are the commands that I am sending to the instrument:
- from labinstruments.instruments import Keithley2700
- import numpy
- import sys
- from time import sleep
-
- def main():
- keithley = Keithley2700(
- Serial_kwargs = dict(
- port = '/dev/ttyUSB0',
- timeout = 1,
- xonxoff = True,
- baudrate = 9600,
- write_timeout = 1,
- ),
- reset_upon_connection = False,
- )
- print('Connected with', keithley.idn)
- keithley.reset() # Sends the `*RST` command.
-
- keithley.write('CONFIGURE:RESISTANCE')
- keithley.write('SENSE:RESISTANCE:RANGE:UPPER 99e3') # Fixed range, as suggested in the user manual, section "Optimizing measurement speed".
- keithley.write('SENSE:RESISTANCE:NPLCycles 0.01') # Value reported in the datasheet to reach 2500 readings per second.
- keithley.write('SENSE:RESISTANCE:DIGITS 4.5') # Value reported in the datasheet to reach 2500 readings per second.
- keithley.write('SENSE:RESISTANCE:AVERAGE:STATE off') # Disable the filter, as suggested in the user manual, section "Optimizing measurement speed".
- keithley.write('SYSTEM:AZERO:STATE off')
-
-
- keithley.write('INIT:CONTINUOUS off') # Stop the DMM.
- keithley.write('TRAC:CLEAR') # Clear the buffer.
- keithley.write('TRAC:CLE:AUTO on') # Enable buffer.
- keithley.write(f'TRAC:POINTS 1000') # Set number of samples to be stored.
- keithley.write('TRAC:FEED sense') # Set source of data to store in the buffer.
- keithley.write('TRAC:FEED:CONTROL next') # Set the buffer to store the next N incoming data samples, then stop storing.
- keithley.write('INIT:CONTINUOUS on') # Start the DMM, so it begins to fill the buffer, hopefully at 2500 readings per second.
-
- sleep(2) # Wait 2 seconds, should be more than enough for the buffer to be completely full, if the instrument were sampling at 2500 readings per second.
-
- keithley.write('FORMAT:ELEMENTS reading, tstamp') # Configure the instrument to return the value and timestamp of each sample.
-
- data = keithley.query('TRAC:DATA?') # Read the data from the instrument into the PC.
- data = [float(_) for _ in data.split(',')]
- t = data[1::2] # Odd elements are the timestamps.
- R = data[::2] # Even elements are the measured values.
-
- print(numpy.diff(t))
- print(f'Number of points received: {len(R)}')
- print(f'R = {numpy.mean(R)} ± {numpy.std(R)} Ohm')
- average_sampling_rate = numpy.mean(numpy.diff(t))
- print(f'Sampling frequency = {1/average_sampling_rate} Hz')
-
- if __name__ == '__main__':
- main()
and this code prints:
- [0.001 0.016 0.003 0.006 0.003 0.017 0.015 0.004 0.003 0.003 0.004 0.003
- 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004
- 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003
- 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004
- 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003
- 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003
- 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003
- 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003
- 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003
- 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003
- 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003
- 0.003 0.004 0.014 0.003 0.004 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003
- 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004
- 0.003 0.003 0.004 0.003 0.003 0.004 0.014 0.004 0.003 0.003 0.004 0.003
- 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004
- 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003
- 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004
- 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003
- 0.004 0.003 0.014 0.004 0.003 0.003 0.004 0.003 0.004 0.003 0.014 0.004
- 0.003 0.004 0.003 0.003 0.004 0.003 0.014 0.004 0.003 0.004 0.003 0.003
- 0.004 0.003 0.014 0.004 0.003 0.004 0.003 0.003 0.004 0.003 0.014 0.004
- 0.003 0.004 0.003 0.003 0.004 0.003 0.014 0.004 0.003 0.004 0.003 0.003
- 0.004 0.003 0.015 0.003 0.003 0.004 0.003 0.003 0.004 0.003 0.015 0.003
- 0.003 0.004 0.003 0.004 0.003 0.003 0.015 0.003 0.003 0.004 0.003 0.004
- 0.003 0.003 0.015 0.003 0.003 0.004 0.003 0.004 0.003 0.003 0.015 0.003
- 0.003 0.004 0.003 0.004 0.003 0.003 0.015 0.003 0.003 0.004 0.003 0.004
- 0.003 0.003 0.015 0.003 0.003 0.004 0.003 0.004 0.003 0.003 0.015 0.003
- 0.003 0.004 0.003 0.004 0.003 0.003 0.015 0.003 0.003 0.004 0.003 0.004
- 0.003 0.003 0.015 0.003 0.003 0.004 0.003 0.005 0.005 0.004 0.019 0.004
- 0.004 0.005 0.003 0.006 0.014 0.015 0.005 0.004 0.006]
- Number of points received: 442
- R = 74881.35412579186 ± 11.688024207233193 Ohm
- Sampling frequency = 205.11627906976744 Hz
If the sleep(2)
of line 37 is changed to sleep(6)
, then it prints:
- ...
- Number of points received: 1000
- R = 74863.632661 ± 11.792219736100387 Ohm
- Sampling frequency = 208.25515947467167 Hz
How can I reach 2500 readings per second?
Note: The class Keithley2700
is a simple wrapper around the serial port.