Realtime data visualizer - Daily chart HP3458A+K2001

Realtime datalog test from Raspberry Pi. Compare 10V from 3245A with faulty 3458A to K2001


Only last 24 hour data is shown
Download CSV file for full datalog details
Days PPM-Deviation available here (Link will open in new window)

Workflow:

* RPI accesses DMMs via NI USB-GPIB-HS and reads data.
* Data is formatted by python script into DSV string and written/append to file on FTP
* DSV-file is visible publicly on https://xdevs.com/static/data/10v_keihp_nplc100.csv
* Page http://xdevs.com/datalog/ runs D3.js javascript library to read DSV file test.log to input data
* D3.js plots SVG graph online :)



# xDevs.com Python test GPIB app.
# https://xdevs.com/guide/ni_gpib_rpi/
# https://xdevs.com/article/hp3458a_gpib/
# https://xdevs.com/fix/hp3458a/
import sys
import Gpib
import time
import ftplib

port = 21
ip = "192.168.1.102"
password = "datashort"
user = "datashort"

gen = Gpib.Gpib(0,2, timeout=20) # 3245A GPIB Address = 2
inst = Gpib.Gpib(0,3, timeout=20) # 3458A GPIB Address = 3
kei = Gpib.Gpib(0,16, timeout=20) # K2001 GPIB Address = 16
inst.clear()
kei.clear()
gen.clear()
#Setup HP 3245A
#...
#Setup HP 3458A
#...
# Setup Keithley 2001
#...

cnt = 0
tread = 0
temp = 41.0
level = 10.000000                           # Reference level for 3458A data
klevel = 10.0000000                         # Reference level for K2001 data
ppm = 0                                     # deviation from ref level, in ppm

with open('10v_keihp_nplc100.csv', 'a') as o:
#    o.write("date;hp3458a;level;kei2001;temp;ppm_level;kppm;\r\n")
    o.close()

ftp = ftplib.FTP(ip)                        # Use ftplib
ftp.login(user,password)                    # Login to FTP

while cnt <= 10000000:                      # Main loop, take 10M samples
    cnt+=1
    tread = tread - 1
    with open('10v_keihp_nplc100.csv', 'a') as o:   # Open file to addition
        if (tread == 0):
            tread = 25                      # Send TEMP? to 3458A every 25th measurement
            inst.write("TARM SGL,1")
            inst.write("TEMP?")
            temp = inst.read()
        inst.write("TARM SGL,1")            # Take single reading
        data = inst.read()
        ppm = ((float(data) / level)-1)*1E6  # Calculate ppm dev
        inst.write("DISP OFF, \" %8.4f ppm\"" % float(ppm))  # Display ppm dev on 3458A screen
        time.sleep(1)                       # Do nothing for 1 second
        kei.write("READ?")                  # Read Keithley's data
        keival = kei.read()
        kppm = ((float(keival) / klevel)-1)*1E6 
        kei.write(":DISP:WIND2:TEXT:DATA \"  %8.4f ppm\";STAT ON;" % float(kppm))
        khp = (((float(data) / float(keival))-1)*1E6)  # 3458A/K2001 deviation in PPM
        print time.strftime("%d/%m/%Y-%H:%M:%S;") + ("[%8d]: %2.8f , dev %4.4f ppm, K:%2.8f, dev %4.4f ppm, TEMP:%3.1f, K/H %4.2f" % (min, float(data),float(ppm),float(keival),float(kppm),float(temp),float(khp) ) )
        o.write (time.strftime("%d/%m/%Y-%H:%M:%S;") + ("%16.8f;%16.8f;%16.8f;%3.1f;%4.3f;%4.3f\r\n" % (float(data),float(level),float(keival),float(temp),float(ppm),float(kppm) ) ))
        o.close()                           # close file 
    file = open('10v_keihp_nplc100.csv','rb')  # link to datafile
    ftp.storbinary('STOR 10v_keihp_nplc100.csv', file) # send file to FTP
    file.close()                               # close file
ftp.quit()