Тёмный

Live Data Acquisition Tutorial Using Python and a Keithley 2700 Multimeter 

Jesse Adamczyk
Подписаться 221
Просмотров 28 тыс.
50% 1

In this video, I demonstrate how to use python to collect data from a Keithley 2700 Multimeter. The python libraries I used are pyvisa and pyvisa-py.
The GPIB to USB converter cable is a Keysight 82357B USB/GPIB Interface Cable. www.keysight.c...
Link to code: github.com/jes...

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 78   
@pauloshikoy5068
@pauloshikoy5068 20 дней назад
Would it be possible to use the same idea for the 3458A multimeter? Could you make a tutorial about it? Thanks, keep up the videos.
@Cannabic
@Cannabic 3 года назад
Awesome! well done man
@RonMatthews-q6h
@RonMatthews-q6h Час назад
Hall Edward Thompson Sharon Walker Laura
@KhietPham-xh2sq
@KhietPham-xh2sq Год назад
Hi Jesse, Can you able send me the tutorial code, I am unable to get the link to work on my computer. Thank you very much
@jesseadamczyk1745
@jesseadamczyk1745 Год назад
I will paste the code below. It is organized by file. There are 3 files, find_device.py, one_shot.py, and keithley_plotter.py. I apologize, this is the easiest way for me to get the code to you. find_device.py file import pyvisa print(pyvisa.ResourceManager().list_resources()) one_shot.py file import pyvisa multimeter = pyvisa.ResourceManager().open_resource('GPIB0::1::INSTR') # Connect to the keithley and set it to a variable named multimeter. #multimeter.write(":ROUTe:CLOSe (@101)") # Set the keithley to measure channel 1 of card 1 multimeter.write(":SENSe:FUNCtion 'TEMPerature'") # Set the keithley to measure temperature #print(multimeter.query(':SENSe:DATA:FRESh?')) # Collect the most recently measured data multimeter.write(":ROUTe:OPEN:ALL") # Open all card channels and thereby set the keithley to measure the front panel inputs. print(multimeter.query(':SENSe:DATA:FRESh?')) # Collect the most recently measured data keithley_plotter.py file import pyvisa import time import matplotlib.pyplot as plt # Initialize the keithley and create some useful variables multimeter = pyvisa.ResourceManager().open_resource('GPIB0::1::INSTR')# Connect to the keithley and set it to a variable named multimeter. multimeter.write(":ROUTe:CLOSe (@101)") # Set the keithley to measure channel 1 of card 1 multimeter.write(":SENSe:FUNCtion 'TEMPerature'") # Set the keithley to measure temperature. timeList = [] # Create an empty list to store time values in. temperatureList = [] # Create an empty list to store temperature values in. startTime = time.time() # Create a variable that holds the starting timestamp. # Setup the plot plt.figure(figsize=(10,10)) # Initialize a matplotlib figure plt.xlabel('Elapsed Time (s)', fontsize=24) # Create a label for the x axis and set the font size to 24pt plt.xticks(fontsize=18) # Set the font size of the x tick numbers to 18pt plt.ylabel('Temperature ($^\circ$C)', fontsize=24) # Create a label for the y axis and set the font size to 24pt plt.yticks(fontsize=18) # Set the font size of the y tick numbers to 18pt # Create a while loop that continuously measures and plots data from the keithley forever. while True: temperatureReading = float(multimeter.query(':SENSe:DATA:FRESh?').split(',')[0][:-2]) # Read and process data from the keithley. temperatureList.append(temperatureReading) # Append processed data to the temperature list timeList.append(float(time.time() - startTime)) # Append time values to the time list time.sleep(0.5) # Interval to wait between collecting data points. plt.plot(timeList, temperatureList, color='blue', linewidth=10) # Plot the collected data with time on the x axis and temperature on the y axis. plt.pause(0.01) # This command is required for live plotting. This allows the code to keep running while the plot is shown.
@elwafi2001
@elwafi2001 Год назад
Very informative
@arnaudvanlian2411
@arnaudvanlian2411 Год назад
Hi jesse, wich softfare do you use for programming?
@jesseadamczyk1745
@jesseadamczyk1745 Год назад
I use notepad++ and then I made a hotkey to run the code in Python (Anaconda)
@aliciaalejandramierjimenez7559
@aliciaalejandramierjimenez7559 2 года назад
Hello, I am trying to communicate the 2701 to the RS-232 but I can not communicate the computer with the system. Do I need to configure it manually before?
@jesseadamczyk1745
@jesseadamczyk1745 2 года назад
I unfortunately don't have experience with RS-232 communications with the Keithleys. Any chance you can get ahold of a GPIB-USB cable?
@joshbrown5138
@joshbrown5138 2 года назад
Keithley/Tektronix has examples of controlling RS232 instruments via PyVisa. You should be able to find something in the examples for the DAQ6510, which is the successor to the 2700 and 2701.
@unamusedwatermelon
@unamusedwatermelon 3 года назад
Hi Jesse, awesome work. Does the same apply with a SourceMeter vs a MultiMeter??
@jesseadamczyk1745
@jesseadamczyk1745 3 года назад
The Keithley 2400 Sourcemeter uses some different SCPI commands. The overall python code structure will be the same but the commands you send over pyvisa will likely be a bit different. Take a look at the manual for the Keithley 2400 and look for the "one shot" measurement examples.
@unamusedwatermelon
@unamusedwatermelon 3 года назад
@@jesseadamczyk1745 Thanks so much for the reply man.
@ahmadattar1
@ahmadattar1 3 года назад
I am using Keithley_2750_DMM to measure the 4 wire resistance with 6 channels ,with 6 sample count when i am trying to read the values ,but it is showing errors did you wrote code in python to measure the 4 wire resistance ? how can I contact you ?
@jesseadamczyk1745
@jesseadamczyk1745 3 года назад
Hi Ahmad, are you using a special card in the back of the 2750 DMM? Perhaps the 7709 matrix card?
@LewisHughes-d2o
@LewisHughes-d2o 12 дней назад
Taylor Mark Thompson Jessica Lopez Gary
@ShannonSmith-b7v
@ShannonSmith-b7v 12 дней назад
Anderson Ronald Wilson Christopher Martinez Anna
@BarbaraLovejoy-u6s
@BarbaraLovejoy-u6s 16 дней назад
Lopez Anthony Jackson Susan Jones Donna
@PalmerAbel-h9f
@PalmerAbel-h9f 14 дней назад
Miller Jessica Moore Amy Perez Michelle
@user-sp1mi6dt7i
@user-sp1mi6dt7i 13 дней назад
Williams Karen Hall Paul Taylor Susan
@RushBoys-e6v
@RushBoys-e6v Месяц назад
Wilson Helen Hall Betty Jones Karen
@avral4148
@avral4148 Год назад
I would really appreciate if you could embed that plot into tkinter...
@robbyviklivingston1997
@robbyviklivingston1997 17 дней назад
Rodriguez Christopher Taylor Patricia Jones Edward
@RushBoys-e6v
@RushBoys-e6v 14 дней назад
Martinez Christopher Lewis Michelle Thompson Susan
@BarbaraLovejoy-u6s
@BarbaraLovejoy-u6s 7 дней назад
Taylor Deborah Garcia Jeffrey Young Mark
@lovermonkey
@lovermonkey 2 года назад
Nice! Do you have any tutorials on the Keithley 2230 power supply? Or something close.
@CandyBarnes-t8g
@CandyBarnes-t8g 12 дней назад
Garcia Cynthia Lopez Jessica Brown Barbara
@BusterMayers
@BusterMayers 14 дней назад
Perez Steven Thompson Jason Jackson Amy
@AntonioMartin-w1e
@AntonioMartin-w1e 17 дней назад
Johnson Mary White Barbara Lopez Susan
@OccupationFun-m9d
@OccupationFun-m9d 15 дней назад
Hernandez Jose Gonzalez Karen White Frank
@kyliegubenson1936
@kyliegubenson1936 11 дней назад
White Sarah Thomas Ruth Robinson William
@RoseLerman-d6c
@RoseLerman-d6c 13 дней назад
Martin Melissa Harris Sandra Walker Dorothy
@elwafi2001
@elwafi2001 Год назад
Could you please explain how could we modify the python code in case we acquire data from 4 probes instead of 1, thanks in advance
@kathrynmolligan1045
@kathrynmolligan1045 17 дней назад
Lewis Melissa Taylor Laura Harris Richard
@user-qw4zq2wq9r
@user-qw4zq2wq9r Месяц назад
It's really helpful!!Thank you
@MartinBicknell-k1g
@MartinBicknell-k1g 26 дней назад
Martinez Sharon Davis Steven Martin Betty
@FuomaMall-b7z
@FuomaMall-b7z 25 дней назад
Davis Michelle Davis Sandra Miller Steven
@xiangyuhong9581
@xiangyuhong9581 2 года назад
Hi Jesse, thanks for the hard work. I applied your method when I tried to get data from Keithley 2182A, which looks very similar to your Keithley 2700. But I always get an "Error 113" on the front panel of Keithley 2182A. I'm sure the GPIB address is correct. Do you have any suggestions for this problem? Thank you so much.
@jesseadamczyk1745
@jesseadamczyk1745 2 года назад
For Error 113, it says "Undefined Header". I am not quite sure what this means. 2182A is a little bit different for some reason. Try this code below but change the GPIB address to whatever is on your 2182A. If this does not work, send me a DM and I'll send you a python class I wrote for the 2182a. You'll be able to figure it out from there. import time import visa # Setup the instrument instrument = visa.ResourceManager().open_resource('GPIB ADDRESS GOES HERE') time.sleep(0.05) instrument.timeout = 30000 time.sleep(0.05) # Setup voltage measurement instrument.write(':SENSe:CHANnel 1') instrument.write(':SENSe:FUNCtion "VOLTage:DC"') instrument.write(':SENSe:VOLTage:DC:RANGe:AUTO ON') instrument.write(':SENSe:VOLTage:DC:NPLC 1') instrument.write('TRIGger:COUNt 1') # Take the voltage measurement voltage = self.instrument.query(':SENSe:DATA:FRESh?')
@xiangyuhong9581
@xiangyuhong9581 2 года назад
@@jesseadamczyk1745 Thank you so much! This fixed that error code.
@zhyfn9773
@zhyfn9773 Год назад
would k2000 be controlled the same way?
@jesseadamczyk1745
@jesseadamczyk1745 Год назад
Yes, the same commands or very similar should work.
@cessromer7078
@cessromer7078 2 года назад
Is it possible to integrate readings for temperataure and output voltage using the same dmm with two channels in order to see an output graph of temperature and voltage output ?
@jesseadamczyk1745
@jesseadamczyk1745 Год назад
Yes, that is possible. You will need to some extra setup though. I pasted some code from a python class I wrote specifically for collecting temperature and voltage at the same time (Seebeck measurements). I'm sorry for the poor formatting. Please paste the code into your IDE or notepad++ so it doesn't look so awful. If you want to run this code, you will have to remove the "self" in front of everything. If you were able to follow along with the video, you'll be able to edit the below code and get it working. You can see from the commented code that I'm setting channels 111 to 120 along with 211 and 212 to measure voltage. Channels 101 through 110 along with 201 and 202 are set to measure temperature. def continuousScanSetup(self): self.instrument.write("*RST") # Reset to defaults for this time.sleep(0.05) self.instrument.write(':SYSTem:BEEPer:STATe OFF') # Turn off the beeper. This has to be done again here because of *RST time.sleep(0.05) self.instrument.write(":TRACe:CLEar") # Clear the buffer time.sleep(0.05) #self.instrument.write(":FORMat:ELEMents CHANnel, READing, UNITs, RNUMber, TSTamp") # Format the output. These are not in order unfortunately because Keithley is setup that way. self.instrument.write(":FORMat:ELEMents CHANnel, READing, UNITs") # Format the output to include channel, reading, and units time.sleep(0.05) self.instrument.write(":INITiate:CONTinuous OFF") # Turn off continuous initiation time.sleep(0.05) self.instrument.write(":TRIGger:SOURce IMMediate") # Start scanning immediately after triggering occurs. No delays. time.sleep(0.05) self.instrument.write(":TRIGger:COUNt 1") # This is the number of times that triggering will occur. time.sleep(0.05) self.instrument.write(":SAMPle:COUNt 110000") # time.sleep(0.05) self.instrument.write(":FUNCtion 'VOLT', (@111:120,211,212)") # Set channels to measure voltage. time.sleep(0.05) self.instrument.write("VOLTage:NPLC 1, (@111:120,211,212)") time.sleep(0.05) self.instrument.write(":FUNCtion 'TEMP', (@101:110,201,202)") # Set channels to measure temperature. time.sleep(0.05) self.instrument.write("TEMPerature:NPLC 1, (@101:110,201,202)") time.sleep(0.05) self.instrument.write(":ROUTe:SCAN (@101:120,201,202,211,212)") # Set channels to be scanned. time.sleep(0.05) self.instrument.write(":ROUTe:SCAN:TSO IMM") # Scan source immediately? time.sleep(0.05) self.instrument.write(":ROUTe:SCAN:LSEL INT") time.sleep(0.05) return "Scan setup complete" Here are the other functions I used with the above function: def initiateContinuousScan(self): self.instrument.write(":INITiate:Immediate") # Start scanning immediately. return 'scan initiated' def readBuffer(self): data = self.instrument.query("TRACe:DATA?") return data
@82wambo
@82wambo Год назад
@@jesseadamczyk1745 Hi Jesse, thank you for your tutorial and your code. I am, unfortunately, a beginner in this and I have problems reading multiple channels. I want to read the VDC of several channels continuously. However, if I do instrument.write(":ROUTe:MULTiple:CLOSe (@101:102)"), it never is able to scan both channels seperately. DO you have any idea how I can fix that and how the output will be? Do I need to do a "for" with the string and seperate the two channels as output. The handbook is not that clear how the output is given for several channels.
@brucetouzel6484
@brucetouzel6484 Год назад
if I wanted to display the Keithley instrument screen on a large monitor, is there a way to do that with the USB port on instrument ? Thanks
@reprobite
@reprobite Год назад
Can I calibrate the 2700 with the GPIB cable, or at least get rid of invalid cal warning?
@johnvicagena9914
@johnvicagena9914 Год назад
Do you have code of in in python to program?
@jesseadamczyk1745
@jesseadamczyk1745 Год назад
Please see the link in the description!
@MarkusBurrer
@MarkusBurrer 3 года назад
I have a 2701 connected over Ethernet. Does this work too?
@omunoz
@omunoz 3 года назад
No, the video is only for GPIB protocol
@MarkusBurrer
@MarkusBurrer 3 года назад
@@omunoz meanwhile I tried it myself and it is working. GPIB is not a protocol. It is a hardware interface. The protocol is called SCPI. You can replace the interface easily with Ethernet, serial or whatever the device supports
@NiteshKumar-ss4gg
@NiteshKumar-ss4gg 2 года назад
@@MarkusBurrer Are you using Ethernet cable instead of GPIB cable to the PC
@MarkusBurrer
@MarkusBurrer 2 года назад
@@NiteshKumar-ss4gg yes.
@NiteshKumar-ss4gg
@NiteshKumar-ss4gg 2 года назад
@@MarkusBurrer If i use USB to send the commands will it work?
@shakirshaikh173
@shakirshaikh173 2 года назад
Hi jesse I am using 2750 Dmm for 2 wire resistance measurement. can u please share detailed video of how to get the readings on excelinx - 1a software using gpib connection
@alimcold
@alimcold 3 года назад
You save my experiment!! Thank you so much!!
@fizzytuto9415
@fizzytuto9415 3 года назад
Hi, what if we wanna display the frequency on the x axis ranging from 10 Hz to 10kHz for example, how do we do that ?
@jesseadamczyk1745
@jesseadamczyk1745 3 года назад
I have never done this sort of measurement before, so I will only be so much help. If you can get python to read a frequency from the Keithley 2700, then you should be able to append the frequency value to a list of frequency values. Then using matplotlib, you would need to plot the frequency values on the x-axis and your other values on the y-axis. It would be something like: plt.plot(frequencyList, otherList)
@cNeverHide
@cNeverHide 2 года назад
HI Jesse, thank you for your video :) I have the connector KUSB 488B which came with the sourcemeter. I have installed the driver of this connector and followed you advices, but I had this error : "VI_ERROR_LIBRARY_NFOUND (-1073807202): A code library required by VISA could not be located or loaded." If you have any suggestion :/
@jesseadamczyk1745
@jesseadamczyk1745 2 года назад
I have not used this exact model of connector before. This seems like a Python issue, but here are a few things I would try: 1) If there are lights on the connector, check to make sure that they are the correct colors (i.e. connected vs fail etc) 2) Restart your computer. Sometimes the driver installation/USB connections magically get fixed after you do this. 3) Make sure PyVisa is installed correctly with "pyvisa-info" in the command prompt/terminal. 4) Try another GPIB-USB connector if you have one lying around. I have had these connectors die randomly once in a while. 5) Try installing pyvisa-py (pip install pyvisa-py) and use that instead of pyvisa. Sometimes this works but I'm not quite sure why. Best of luck!
@cNeverHide
@cNeverHide 2 года назад
@@jesseadamczyk1745 Thank you for your awesome support !!! :) In the meantime, I have changed connector with a 9 pin to USB and it worked ! But I will definitely try again the first connector with your guidance ! Thank you Jesse
@dgaborus
@dgaborus 2 года назад
What driver are you using for 82357B?
@jesseadamczyk1745
@jesseadamczyk1745 2 года назад
I used the Keysight Instrument Control Bundle here: www.keysight.com/us/en/lib/software-detail/computer-software/keysight-instrument-control-bundle-download-1184883.html
@rvizarreta
@rvizarreta 2 года назад
Hello! Thanks for this tutorial. Why do you need to set up the GPIB address to 01? Is this like a default value that PyVISA reads? I tried to read other channels without success, for some reason it can only read measurements from channel 1.
@jesseadamczyk1745
@jesseadamczyk1745 2 года назад
The GPIB address is set to 01 on the multimeter because it is also set to 1 in the python code address: "GPIB0::1::INSTR"
@rvizarreta
@rvizarreta 2 года назад
@@jesseadamczyk1745 Thanks for replying!
@eishachauhan975
@eishachauhan975 2 года назад
Thank you for making this video. I have to acquire continuous data from Keithley 2001 through gpib. Is it possible by using this idea..???
@jesseadamczyk1745
@jesseadamczyk1745 2 года назад
Yes, this should work almost the same. You may have to play with the channels commands as I don't think the 2001 has the same style of card to install in the back.
@eishachauhan975
@eishachauhan975 2 года назад
@@jesseadamczyk1745 Thank you so much for your reply dear Jesse. I have no idea about it's input channels card, but I want to record from its panel inputs only.
@eishachauhan975
@eishachauhan975 2 года назад
@@jesseadamczyk1745 Dear Jesse, I have Keithley 2001. I want to set up a Data logging system using python and keysight gpib adapter. How code should be written in python in order to acquire data at specified intervals ? I don't want plot I need only saved readings.
@josephschaadt5325
@josephschaadt5325 3 года назад
Hi Jesse, awesome video! This is really helpful. I am trying to do something very similar with the same Keithley model and a 7700 20 channel card but I got stuck and have a few questions. Where in the code is the type of thermocouple (K, T, J, etc. ) inputted? Is there a way to set the scan rate? I am trying to scan seven thermocouples. Is that fairly simple to implement? For the plotting, for temperature scans which are long (>2 hrs) I have been trying to figure out a way to have an additional plot that just shows the temperature measurements over the last 2-5 minutes in case there are temperature changes which may be difficult to see in a longer scan. I have looked into seeing if this is possible in Labview but haven't found much. I was wondering if you have any suggestions on how to implement this. I would be very interested to hear your thoughts. Would it be possible to reach out to you over email if you think that would be easier?
@jesseadamczyk1745
@jesseadamczyk1745 3 года назад
Hi Joseph, For the thermocouple type, I have never set this via the code. I have only ever set this by the front panel controls of the Keithley. Page 3-50, table 3-7 of the Keithley 2700 manual shows the commands you would use to change the different thermocouple types. I am working on a new video that will cover scanning multiple thermocouples and sources at once. Here is a python script that will help you with your long/short plotting. I'll comment this up for the new video soon, but right now you can see how it works. Let me know if it does not work. import matplotlib.pyplot as plt import time import numpy as np fig, (ax1, ax2) = plt.subplots(1,2, figsize=(8,4)) ax1.set_xlabel('Total elapsed time (s)') time_list = [] sin_list = [] start_time = time.time() while True: current_time = time.time() - start_time time_list.append(current_time) sin_list.append(np.sin(current_time)) ax1.plot(time_list, sin_list, color='blue') if len(time_list) >= 10: plt.cla() ax2.plot(time_list[-10:], sin_list[-10:], color='red') ax2.set_xlabel('Last 10 measurements') if len(time_list) < 10: ax2.plot(time_list, sin_list, color='red') ax2.set_xlabel('Last 10 measurements') plt.pause(0.1) if time_list[-1] >=20: break
@jesseadamczyk1745
@jesseadamczyk1745 3 года назад
Link to Keithley 2700 Manual: download.tek.com/manual/2700-900-01K_Feb_2016.pdf
@josephschaadt5325
@josephschaadt5325 3 года назад
@@jesseadamczyk1745 Hi Jesse, Thank you! I really appreciate you taking the time to respond in detail. This information is very helpful. I am playing around with the thermocouple type. The one issue I see is I am having trouble figuring out if I can set different channels to different thermocouple types. What do you mean by setting the specific thermocouple type for the channels on the front panel? Thank you for including the manual. That would be awesome! I really look forward to seeing your new video on this. Do you know if it's possible to set the scan rate? If the default is the fastest possible then that is fine. Thank you for sharing your python script, I really appreciate you doing that. I am going to try it today and I will make sure to let you know if it works. Thank you for all of your help Jesse!
@josephschaadt5325
@josephschaadt5325 3 года назад
Hi Jesse, I just wanted to follow up. No worries if you are too busy!
Далее
Lab Instrument Automation with Python
10:10
Просмотров 12 тыс.
Watermelon magic box! #shorts by Leisi Crazy
00:20
Просмотров 14 млн
С какого года вы со мной?
00:13
Просмотров 199 тыс.
Python for DAQ
5:58
Просмотров 12 тыс.
Modern Graphical User Interfaces in Python
11:12
Просмотров 1,5 млн
KEITHLEY 2700
6:09
Просмотров 455
Keithley DMM6500 Review & Scripting Tutorial (Python)
10:41
Remote GPIB control of instruments
10:36
Просмотров 1 тыс.
Acquiring Data and Controlling Instruments in LabVIEW
4:56
6 Horribly Common PCB Design Mistakes
10:40
Просмотров 202 тыс.
DAQ with Python
39:19
Просмотров 21 тыс.
EEVblog #1232 - Add Web Access To Old Instruments!
19:59