---

Friday, March 24, 2017

Logging Multimeter Readings with a Digitek DT-4000ZC on a Mac

I bought one of these multimeters a few months ago on eBay, to be able to automate the timed taking of readings using a multimeter.


Given the price, I wasn't expecting much, but it works pretty well.

Being a Mac user, I am used to either using software in a Windows XP virtual machine, or searching out alternative software for a device. I this case, I found that a Python library has already been written to decode the multimeter's strange display-based protocol. The protocol actually transmits the state of each of the segments on the display - an interesting problem to code.

To get this going, you will need to:


  1. Install Python on my Mac 
  2. Download the TP4000ZC library
  3. Unzip it and then in the directory containing the library python files you just downloaded, create a new file called 'dmm.py' and paste the following code into it:

import tp4000zc
import time
    
port = '/dev/tty.wch ch341 USB=>RS232 1420'

dmm = tp4000zc.Dmm(port)

last_time = 0
period = 1.0

try:
  while True:
    val = dmm.read()
    t = time.time()
    if t > last_time + period:
      last_time = t
      value = val.numericVal
      print(value) 
  
except:
  dmm.close()

The multimeter is supplied with an RS232 interface, so I bought a cheap USB to RS232 adapter. You may need to install drivers for this, and then you have to work out what the device name is and modify the line of dmm.py that starts 'port =' to match the device name for your USB adapter.

Run the program, and readings will start to appear.

MacBook:tp4000_dmm si$ sudo python dmm.py 
Password:
-0.0
-0.0
-0.0
0.086
0.136
0.141
0.146
0.182
0.284
0.235
0.33

0.329

To draw charts and analyze the data, just select the readings from the terminal and then paste them into a spreadsheet.


1 comment:

Unknown said...

https://afu.ac.ae/en/news/2015/al-falah-university-is-now-an-official-ielts-test-venue-in-dubai
https://afu.ac.ae/en/news/2015/new-student-orientation-in-al-falah-university
https://afu.ac.ae/en/news/2015/the-adddrop-period-for-the-academic-year-2015-16
https://afu.ac.ae/en/news/2015/al-falah-university-welcomes-you-to-the-academic-year-2015-16