Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ dc=True
peak_max=False
peak_min=False
```

# Source
https://github.com/tobiasfalk/UIN-T-USB-Reader
7 changes: 5 additions & 2 deletions readDMM.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@

import logging
from enum import Enum

from ut61eplus import UT61EPLUS
from ut61eplus import SERIAL_NUMBERS

log = logging.getLogger(__name__)

logging.basicConfig(level=logging.DEBUG)

dmm = UT61EPLUS()
dmm = UT61EPLUS(serial = str(SERIAL_NUMBERS.A))

log.info('name=%s', dmm.getName())
dmm.sendCommand('lamp')
m = dmm.takeMeasurement()
log.info('measurent=%s', m)

dmm.listDevices()
3 changes: 2 additions & 1 deletion ut61eplus/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .ut61eplus import UT61EPLUS
from .ut61eplus import UT61EPLUS
from .ut61eplus import SERIAL_NUMBERS
23 changes: 20 additions & 3 deletions ut61eplus/ut61eplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
8d . => sum over all - LSB

"""

class SERIAL_NUMBERS:
A = '006C2895'
B = '006C3EE8'
C = '006C2FB6'

class Measurement:

Expand Down Expand Up @@ -308,9 +311,14 @@ class UT61EPLUS:
'not_peak': 78,
}

def __init__(self):
def __init__(self, serial = None):
"""open device"""
self.dev = hid.Device(vid=self.CP2110_VID, pid=self.CP2110_PID)
if not serial == None:
print(serial)
print(type(serial))
self.dev = hid.Device(vid=self.CP2110_VID, pid=self.CP2110_PID, serial = serial)
else:
self.dev = hid.Device(vid=self.CP2110_VID, pid=self.CP2110_PID)
#self.dev.nonblocking = 1
self._send_feature_report([0x41, 0x01]) # enable uart
self._send_feature_report([0x50, 0x00, 0x00, 0x25, 0x80, 0x00, 0x00, 0x03, 0x00, 0x00]) # 9600 8N1 - from USB trace
Expand Down Expand Up @@ -398,6 +406,15 @@ def sendCommand(self, cmd)->None:
self._write(seq)
# pylint: disable=unused-variable
unknown = self._readResponse()

def listDevices(self):
for device_dict in hid.enumerate():
keys = list(device_dict.keys())
keys.sort()
if device_dict['vendor_id'] == self.CP2110_VID:
for key in keys:
print("%s : %s" % (key, device_dict[key]))
print()

def _test(self):
self._write(self._SEQUENCE_GET_NAME)
Expand Down