diff --git a/.gitignore b/.gitignore index 960f359..11b37d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *.pyc *.swp .venv - +dist/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f3dc6a9 --- /dev/null +++ b/Makefile @@ -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 diff --git a/protocol.md b/protocol.md new file mode 100644 index 0000000..6a14ebf --- /dev/null +++ b/protocol.md @@ -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. + + + + + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..fa36790 --- /dev/null +++ b/pyproject.toml @@ -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="phil@techboch.org" }, + ] +license = {text="BSD 3-Clause License"} +dependencies = [ + "click", + "pycp2110", + "construct", +] +[project.scripts] +ut8803e = "ut8803e.ut8803e:main" diff --git a/src/ut8803e/__init__.py b/src/ut8803e/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/ut8803e/__main__.py b/src/ut8803e/__main__.py new file mode 100644 index 0000000..088a654 --- /dev/null +++ b/src/ut8803e/__main__.py @@ -0,0 +1,4 @@ +from .ut8803e import * + +if __name__ == '__main__': + main() diff --git a/ut8803e.py b/src/ut8803e/ut8803e.py similarity index 100% rename from ut8803e.py rename to src/ut8803e/ut8803e.py