ADALM1000 SMU with Fluke289 and Python - Page 1
Forum section: electronics / projects

author: View[+]Finder
author_rank: Unknown
timestamp: March 18, 2022, 08:42:05 pm
content: This combines the Fluke 289 DMM with the ADLAM1000 module SMU "M1k"The Fluke 289 is a large, expensive hand-held industrial DMM; the Analog Devices AALM1000 is a tiny, under $100US source-measure unit. What do they have in common? Quality components and microAmp precision. Add a Python script to get them talking, and you have a working SMU for hobby projects, whatever. What does the Python script accomplish?It shows how to connect Python to the Fluke 289 and get dataIt shows how to connect Python to the M1k (it took me a while to figure that out)It shows how to set the M1k to source voltage and measure currentIt shows how to get four-quadrant measurements (-5V to +5V; sink 200mA or source 200mA)It shows how to get useful data from the M1k on two channelsIt shows how to print the output dataIt shows how to open a CSV file and write data to it (that is the easy part)Code:import timeimport osfrom io import openimport pysmufrom pysmu import Modeimport serial''' SMU Voltage Range Settings 'from low to hi" USER can set in range from -5V to +5V'''lowVolt = -5hiVolt = 5precision = .1''' 1.0, 0.10 or 0.01 the number of decimal placees--will affect number of samples'''''' Setup serial USB to Fluke 289 DMM'''DMM = serial.Serial()DMM.port = '/dev/cu.usbserial-AC00FZQJ' # Serial port; change to suit your USB# Serial port setup and open for FLUKE 289 (don't change)DMM.baudrate = 115200DMM.bytesize = serial.EIGHTBITSDMM.parity = serial.PARITY_NONEDMM.stopbits = serial.STOPBITS_ONEDMM.xonxoff = FalseDMM.rtscts = FalseDMM.dsrdtr = FalseDMM.timeout = 0.1 # secondstry:DMM.open()except:print("Cannot open serial port...")exit()'''Setup output file for data, this will be from your PC path'''output_filename = 'dmm_out.csv'output_directory = "/Users/donal/documents/" #''' MacOS; PC users will know what to do'''os.chdir(output_directory)file = open(output_filename, 'w', newline='')file.write('Volt,Amps,V_a,I_a,V_b,I_b \n') #''' for the column headings (can be changed)'''''' this function will get current reading from DMM set on mAmp or uAmp as needed'''def QM():DMM.write(('qm' + '\r').encode('utf-8'))if DMM.read():data = (DMM.read(32).decode('utf-8'))return ((data.split(','))[1:]) # dont change this''' convert volt range for greater precision'''lowVolt = int((lowVolt)/precision)hiVolt = int((hiVolt)/precision+1)session = pysmu.Session(ignore_dataflow=True)#print (session) debugsmu = session.devices#smu = list_devices(session,0) more debug#print (smu.serial)#print (smu.fwver)''' Set both channels to SMU mode. (different settings, just FYI'''chan_a = smu.channels['A']chan_b = smu.channels['B']# CHAN_A source#chan_a.mode = Mode.HI_Zchan_a.mode = Mode.SVMI#chan_a.mode = Mode.SVMI_SPLIT#chan_a.mode = Mode.SIMV# CHAN_B source#chan_b.mode = Mode.HI_Zchan_b.mode = Mode.SVMI#chan_b.mode = Mode.SIMV#chan_b.mode = Mode.SIMV_SPLIT'''this sends settings to ADALM1000'''def out_file(v_a,v_b):#print (volt)session.start(0)chan_a.constant(v_a)chan_b.constant(v_b)#if v_b == 5: debugtime.sleep(2)amps = QM()time.sleep(0)volt = v_a - v_bdata = ()for x in smu.read(1):out_data = ((x, x, x, x))data = (str(out_data).replace('(',''))time.sleep(.1)if len(data) > 0:print (str(round(volt,2)) + ', ' + str(amps)+', '+ str(data.replace(')','')))file.write(str(round(volt,2)) +', ' + str(amps) +', ' + str(data).replace(')','')+'\n')# deal with negative voltageif lowVolt < 0 and hiVolt > 0:for vb in range(abs(lowVolt),0,-1):v_a = 0.0v_b = float(vb*precision)out_file(v_a,v_b)for va in range(0,hiVolt):v_a = float(va*precision)v_b = 0.0out_file(v_a,v_b)else:for va in range(lowVolt,hiVolt): # when both lowVolt and hiVolt > 0v_a = float(va*precision)v_b = 0.0out_file(v_a,v_b)# deal with both lowVolt and hiVolt negative voltageif lowVolt < 0 and hiVolt < 0:for vb in range((lowVolt),abs(hiVolt),-1):v_a = 0.0v_b = float(vb*precision)out_file(v_a,v_b)for va in range((hiVolt),(lowVolt)):v_a = float(va*precision)v_b = 0.0out_file(v_a,v_b)'''DONE, tidy up'''file.close()chan_a.mode = Mode.HI_Zchan_b.mode = Mode.HI_Zchan_a.constant(0)chan_b.constant(0)#print (All finished")OK, the M1k is designed for education and hobby use: a 5V 200mA SMU for demonstrating basic EE concepts. Right. And if you need 1000V or 10A, there are several SMU's from Keithley--starting at $5,000. Used on eBay go for $2,000 up. For many of my measurement tasks, a ten volt, four hundred mAmp range is more than enough.NOTE: this is a Python script--I run it in Thonny--not an "application." Thonny is about as entry-level as one can get in an IDE. Paste the script in the code window, press 'Run' and get the printout below.{see screenshot} You'll need to set up the output file, the USB to the Fluke 289, spend $100 for the M1k, configure a breadboard measurement, etc. OR, you can just comment out the stuff you don't need right away. I'm an old dog trying to learn some new tricks, so it took time to figure out the connections with things that arent meant to be connected. The M1k has some clever software (PixelPulse2) that does the UI for the kids--easy. Fluke has FormView for industrial documentation, rock-solid but about as locked-down as one would want in plant equipment.https://github.com/dbbotkin/ADALM1000_SMU_Fluke289

author: spec123
author_rank: Contributor
timestamp: November 07, 2022, 06:58:47 pm
content: Hello,Tried running the script in python. I get error message "pysmu not found!".I'm using Windows 10 (64 bit), latest python version (python-311.0-amd64) and have installed the "libsmu-1.0.2-setup-x64.exe" and"libsmu-1.0.2-setup-x86.exe".Any ideas on where/how the pysmu can be found? George

author: alm
author_rank: Super Contributor
timestamp: November 07, 2022, 09:37:58 pm
content: I don't own an ADALM1000 or anything else that uses the same software, but it looks like the Windows installerdoes not install the Python modules anymorefor some reason. It looks to me like thelibsmu-1.0.4-win32-win64.zipfile atthe release pagecontains the Python modules (.whl/wheel files) for Python 3.7, 3.8, 3.9 and 3.10. So I would uninstall Python 3.11, installPython 3.10and install the pysmu module from the zip file using the same command as theydocument for Linux/Mac, except the name of the wheel file will be a bit different. So something likepython3 -m pip install pysmu-1.0.4-cp310-cp310-win_amd64.whl. If that doesn't work, trypip install pysmu-1.0.4-cp310-cp310-win_amd64.whl.

author: spec123
author_rank: Contributor
timestamp: November 09, 2022, 03:41:08 am
content: Many thanks alm, I think you have the answer!You are right, the libsmu zip files only contain the Python modules for Python up to 3.10.Will try as you suggest. Should be working soon. Thanks!