Skip to content

Commit

Permalink
Mak this a python package
Browse files Browse the repository at this point in the history
  • Loading branch information
philpagel committed Oct 12, 2024
1 parent adbd19f commit e5b051b
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.pyc
*.swp
.venv

dist/
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
VERSION="0.0.1"

help:
@echo "The following make targets are available:\n"
@echo " dep install dependencies (requirements)"
@echo " dep-dev install dependencies for packaging"
@echo " build build python package"
@echo " install install python package"
@echo " pypi upload package to pypi"
@echo " clean clean up package and cruft"
.PHONEY: help


dep:
python -m pip install -r requirements.txt
.PHONEY: dep

dep-dev:
python -m pip install -r requirements-dev.txt --upgrade
.PHONEY: dep-dev

build:
python -m build
.PHONEY: build

install:
python -m pip install dist/ut8803e-$(VERSION).tar.gz
.PHONEY: install

clean:
rm -rf dist
rm -rf src/ut8803e.egg-info
rm -rf src/ut8803e/__pycache__
.PHONEY: clean
48 changes: 48 additions & 0 deletions protocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Protocol

To my knowledge, there is no official protocoll documentation published by the
manufacturer. So the protocol and data formats described below were reverse
engineered. By sniffing the communication between the instrument and the
original vendor software.

If you are interested in the revering process you can read about it in my
[blog](https://techbotch.org/blog/ut8803e-bench-meter/) (sorry, German only).

The instrument speaks USB-HID via the integrated CP2110 USB UART bridge.
Commands and data records are binary.


## Data logging

The instrument continuously streams measurement data at a rate of about 3
readings per second. This happens automatically – no specific polling command
is required.

## Commands

The following commands (given in hex) are supported and do exactly what the
corresponding press of a physical button would do:

abcd04460001c2 # Hold
abcd04470001c3 # Back light
abcd04480001c4 # Select
abcd04490001c5 # Manual Range
abcd044a0001c6 # Auto Range
abcd044b0001c7 # Min/Max
abcd044c0001c8 # Exit Min/max
abcd044d0001c9 # Rel
abcd044e0001ca # D Value
abcd044f0001cb # Q Value
abcd04500001cc # Exit DQR
abcd04510001cd # R value
abcd04580001d4 # request device-ID

The original vendor software (Windows only) always sends some kind of
confirmation package after each command package (`abcd045a0001d6`). However, it
is unclear what this really does because all command packages I tested seem to
work fine without the extra package.





20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ut8803e"
version = "0.0.1"
description = "Talking to a UNI-T UT8803/UT8803E bench multimeter"
readme = "README.md"
requires-python = ">=3.8"
authors = [
{name="Philipp Pagel", email="[email protected]" },
]
license = {text="BSD 3-Clause License"}
dependencies = [
"click",
"pycp2110",
"construct",
]
[project.scripts]
ut8803e = "ut8803e.ut8803e:main"
Empty file added src/ut8803e/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions src/ut8803e/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .ut8803e import *

if __name__ == '__main__':
main()
File renamed without changes.

0 comments on commit e5b051b

Please sign in to comment.