the poor mans DMM logger? I think I have posted this somewhere, but I actually forgotten where I saved those python files
example of python 2.7 + xlwt 1.3
used as a logger
(python 2.7 is used because I am going to use all ASCII only, no unicode)
import serial
#import syslog
import time
import random
import xlwt
from datetime import datetime
style0 = xlwt.easyxf('font: name Times New Roman, color-index red, bold on',
num_format_str='#,##0.00')
style1 = xlwt.easyxf(num_format_str='D-MMM-YY')
# style is here for show, it is not used
wb = xlwt.Workbook()
ws = wb.add_sheet('ADC01') # sheet name is .... ADC01
ser = serial.Serial(
port='COM9',
baudrate=9600,
parity='N',
stopbits=1,
bytesize=8,
xonxoff=0,
timeout=3,
rtscts=0,
dsrdtr=0,
writeTimeout=3
)
time.sleep(2) # wait for DUT bootup
ser.flush()
x = 0
t0 =0.0
t1 = 0.0
for x in range (0,5):
t0 = time.clock()
ser.write('1')
line = ser.readline()
f = float(line);
print (line)
ws.write(x, 0, t0)
ws.write(x, 1, f)
t1 = time.clock()
print (t1-t0)
print (x+1)
ser.flush()
# r = random.randint(2, 5)
# time.sleep(r)
ser.close()
wb.save('ADC01' + str(t0) + '.xls') #raw time as part of file name
picture of the sheet (see below pic)
the raw time is imprinted as a ref as xlwt col 0 = in sheet as col A, xlwt col 1 = in sheet as col B
loop can be applied to file names as well to create very long multi file spanning data collection routines.
this is actually what I used many years ago to read keithley K2015 data off RS232 (instead of GPIB)
with the pro-mini doing minimum printing of LCD writes
the to and fro data triggering is under 0.25s per fetch for a pro mini with 512 averages done on pro-mini itself
*edit changed string ADC read into float number to store into xls.
happy triggering !
(keep logging those DMM noise!)