Uni-T UT60E RS-232 Data Logging - Capture data from your DMM
Description
The Uni-T UT60E is a true RMS digital multimeter available from Maplin (R.I.P.) and probably other places. It has an optically coupled RS-232 connection for data logging applications.
The UT60E appears to based on some variation of the FS9721_LP1 DMM chip from Fortune.
The Operating Manual has a sticker reading “N81CB IS SAME AS UT60E”, so perhaps N81CB is another name for the meter, or it may just be a Maplin reference.
Serial Comms
The meter comes with a special cable with a normal 9-pin D connector on one end for plugging into a computer.
The manual says serial communications should be set up as 2400 7O1. This is wrong. It should be 2400 8N1. 7 bits isn’t enough to hold sequence numbers above 7. (See Data Protocol below.)
For some reason, the presence of RTS on the serial line causes problems with data transmission, so this line should be cut, or monitoring software should make sure RTS is not asserted.
Data Protocol
The data from the meter is a frame of 14 bytes sent about three or four times a second.
The high nibble of each byte is a sequence number from 0x1 to 0xe. All-zero and all-one high bits should not occur.
The low nibble of each byte carries the state of each segment on the LCD display. There is a bit for every segment of the digits, as well as the negative sign, decimal points and units symbols.
This table shows the bits used for most of the non-digit symbols:
Frame Offset | Sequence Id | 0x8 | 0x4 | 0x2 | 0x1 |
---|---|---|---|---|---|
0 | 0x1 | AC | ? | Auto | RS232C |
9 | 0xa | µ | n | k | ->|-(diode) |
10 | 0xb | m | % | M | *))) (beep) |
11 | 0xc | F | Ω (ohm) | Δ (relative) | Hold |
12 | 0xd | A | V | Hz | (Low Battery) |
13 | 0xe | ? | ? | ? | °C |
Each segment of each digit is encoded in a similar way. There is a bit position for every segment. This can be spelled out, but it is easier to just use a lookup table. An encoded byte for a digit is assembled by taking the two low nibbles of adjacent data bytes, and shifting the lower-offset nibble left 4 bits.
encoded = (frame[1] << 4) | (frame[2] & 0xf)
The four digits begin at offsets 1, 3, 5 and 7 (sequences 0x2, 0x4, 0x6 and 0x8) within the frame.
The negative sign is encoded in the high bit of the first digit, and the decimal points are encoded in the high bits of the other three digits.
Encoded Byte (with 0x80 cleared) | Digit |
---|---|
0x7d | 0 |
0x05 | 1 |
0x5b | 2 |
0x1f | 3 |
0x27 | 4 |
0x3e | 5 |
0x7e | 6 |
0x15 | 7 |
0x7f | 8 |
0x3f | 9 |
0x00 | Space |
0x68 | L |
Logging Program
parse-ut60e.c is a unix program to parse and log data from a UT60E. -f
path specifies the input device or file. Input can be the attached meter, or it can be a file containing previously recorded binary data from a meter.
If the program input is a tty line, the line is configured for 2400 8N1 operation and RTS is cleared. (DTR is automatically asserted on open.)
Then input is read and scanned for legitimate frames. “Legitimate” simply means a sequence of 14 bytes containing the correct sequence numbers. There is no other error checking possible since the protocol has no provision for checksums.
Each frame is parsed and the results are printed on stdout. If -t
has been passed on the command line, each line will be prefixed with a timestamp derived from gettimeofday()
.
If you are piping output to another process and you want output to be line buffered, use the -u
option. Without -u
, output is only line buffered if stdout is a tty.
Raw hex output from the meter is available with the -d
program option.
Output lines usually look like this:
[timestamp] value [prefix]unit [additional ...]
Values like 0L or 0.L indicate overrange.
Optional Prefix | Meaning |
---|---|
n | nano |
u | micro |
m | milli |
k | kilo |
M | mega |
Units | Meaning |
---|---|
F | farad |
Ohm | ohm |
A | amp |
V | volt |
Hz | hertz |
% | duty cycle |
C | degrees Celcius |
Additional |
---|
AC |
Rel |
Hold |
LowBattery |
Diode |
Beep |
Sources
https://github.com/wavemechanics/parse-ut60e/
More Info
Reading out the Uni-Trend UT60E in Linux [broken]
Discussion about UT60E LabView drivers
Protocol description, probably an older version local cache