Using Raspberry Pi for collecting measurements from a multimeter

Keysight U1401B is a process calibrator and multimeter in one device. It can source currents ±25 mA and voltages till ±15 V. And at the same time measure as a multimeter. We can use also Escort 2030 with the same behavior. See device description.

We want to follow measured values of voltage an current also on display of a notebook. It is possible, however, also evaluate the data and make some decisions, or write them in a file.

Communication schema used in this application


U1401B              U5481B           Raspberry Pi 2B                        Notebook
IR <---------------infrared-------------->USB 1          USB                  Win 8
multimeter        serial-USB              USB 2<--- >WiFi dongle   ((()))     Wifi
calibrator      cable adapter        Raspbian, SSH       <->                  PuTTY (+WinSCP)
SCPI commands        <->             SCPI, Python                        display, keyboard

U1401B returns lines ended with CRLF ('\r\n') (hex:0D,0A). Therefore reading with readline().
Rpi measure arrangement                   (  (  (   )  )  )                   Rpi measure arrangement

Python2 dm1.py display output current & input voltage in given intervals

# dm1.py
# read voltage and gives also current
# used SCPI commands: CONF?, READ?, CURR?.
import serial
import time
dmm=serial.Serial(port='/dev/ttyUSB0', baudrate=9600, bytesize=7,
parity=serial.PARITY_EVEN)
try:
  dmm.open()
except Exception as e:
    print ('problem opening port: ' + str(e))
    exit()
print ("--------------------------------------------------")
print ('dm1: read voltage and gives also current')
dmm.write('CONF?\r')
dmm.flushInput()
conf = dmm.readline()
print ('Configuration: ' + conf[:-2])
print ("--------------------------------------------------")
sec = input('time interval between meas.(sec): ')
while True:
  dmm.write('READ?\r')
  dmm.flushInput()
  data1 = dmm.readline()
  n1 = str(round(float(data1),5))
  print 'inp: ' + n1 + ' V',
  dmm.write('CURR?\r')
  dmm.flushInput()
  data2 = dmm.readline()
  n2 = str(round(float(data2)*1000,5))
  print ('   out: ' + n2 + ' mA')
  time.sleep(sec)