21 June 2017

UNI-T UT61E DMM with serial interface - Python code

The UT61E is a pretty nice meter for the money.  It has 22000 count resolution (4.5 digit) and a nice selection of ranges.  But the selling point for me was the computer interface.  The point of this post is to show an example of how to reliably get data from the computer interface.  As seemingly simple as it is, there are few tricks to it.

AC and DC Volts - 0.01 mV to 1000V
AC and DC Amps - 0.01 µA to 10A
Frequency - 0.01 Hz to at least 50 MHz
Capacitance - 1 pF to 0.22 F
Resistance - 0.01 Ω to 220 MΩ

The interface is optically isolated, and comes with a cable that ends with a DB9 RS-232 connector. The meter transmits data once every 0.5 seconds.  It accepts no commands. The data that it outputs is a little obscure, but thankfully someone else has created a Python module (es51922.py) to convert the responses from the meter to usable data. I'm using this module without modifications.

To connect to the meter, I'm using a very cheap USB to RS-232 cable purchased from Amazon. I'm using the default Windows (Win10) driver. I believe that really any USB to RS-232 converter should work with this code. The only trick to working with this meter is properly managing the RS-232 control signals.

I'm using PySerial to manage the Com port. You will need to obtain and install this module to use this code.  I've linked to a copy of ES51922.py file for reference.

The UT61E code is simple to use.  Call the init_comm() function with a string that represents the name of the comm port that the meter is connected to ("Com5:" for instance).  Call get_one_reading() to return a numeric result.  There is considerably more data that is available (range, overload, etc.).  This code was primarily meant to show how to manage the serial port.

To try the example code, first download and install PySerial.  Then, create a project for the UT61E module.  Drop the ES51922.py file in the same folder as UT61E.py.  Run it.

UT61E Example Serial Comm Python Code
ES51922 Data Parsing Python Code


No comments:

Post a Comment