hanmatek-psu


Namehanmatek-psu JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://gitlab.com/janoskut/hanmatek-psu/-/tree/main
SummaryLibrary and CLI for the Hanmatek Power supply units (PSU) of the HM3xxP series.
upload_time2023-06-12 11:49:40
maintainerJanos
docs_urlNone
authorJanos
requires_python>=3.8
licenseMIT
keywords power-supply psu equipment lab automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![](https://img.shields.io/pypi/v/hanmatek-psu.svg?maxAge=3600)](https://pypi.org/project/hanmatek-psu/)
[![Latest Release](https://gitlab.com/janoskut/hanmatek-psu/-/badges/release.svg)](https://gitlab.com/janoskut/hanmatek-psu/-/releases)
[![pipeline status](https://gitlab.com/janoskut/hanmatek-psu/badges/main/pipeline.svg)](https://gitlab.com/janoskut/hanmatek-psu/-/commits/main)
[![coverage report](https://gitlab.com/janoskut/hanmatek-psu/badges/main/coverage.svg)](https://gitlab.com/janoskut/hanmatek-psu/-/commits/main)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)



# Hanmatek HM3xxP PSU control library and CLI

Unifying library and CLI for the popular and low-cost digital lab power supplies `HM305P` and
`HM310P`.

The library provides an (almost) complete, easy to use interface to all known functions of the
device. This project is different to the below mentioned ones, in that it provides a minimal,
but complete interface to the device and also keeps the dependencies low.

This project is based on the work done in <https://github.com/notkevinjohn/HM310P>, which uses the
`minimalmodbus` library for device communication. Other related projects were providing
useful register definition and hints:

- <https://github.com/JackDoan/hm305_ctrl/tree/master/hm305>
- <https://github.com/hobbyquaker/hanmatek-hm310p>
- <https://sigrok.org/wiki/ETommens_eTM-xxxxP_Series#Protocol>


## Installation

```py
pip install hanmatek-psu
```

If users are in the `plugdev` user group, Hanmatek devices are accessible via `/dev/ttyUSBx` without
privileges. Adding the following `udev` rule will create a symlink `/dev/ttyHM3xxP` when a Hanmatek
PSU device is plugged in via USB. This symlink is used by default by the `hanmatek-cli` to find
devices:

```sh
echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="ttyHM3xxP", MODE="0666", GROUP="plugdev"' | sudo tee "/etc/udev/rules.d/99-hanmatek.rules" > /dev/null
```

## Usage

### CLI Usage

```sh
hanmatek-cli -h
hanmatek-cli --discover             # find devices
hanmatek-cli                        # show default device info
hanmatek-cli --device /dev/ttyUSB0  # specific device
hanmatek-cli voltage:set 3.0        # set voltage
hanmatek-cli current:set 0.1        # set current limit
hanmatek-cli output on
hanmatek-cli current                # read current
hanmatek-cli power                  # read power
hanmatek-cli output off
hanmatek-cli --list                 # list all commands/registers
```

### Library Usage

```py
from hanmatek import HM3xxP

device = HM3xxP("/dev/ttyHM3xxP")
print(device.info())
device.write("voltage:set", 3.0)
device.write("current:set", 3.0)
device.write("output", True)
print(device.read("current"))
print(device.read("power"))
device.write("output", False)
```

## Development

The following tools are used to provide clean and quality software, and made available through a
`tox` configuration: `flake8` for linting, `black` for code formatting and checking, `mypy` for
type checking and `pytest` for unit tests. Use as:

```sh
pip install tox
```

```sh
tox -a       # show test environments
tox          # run all
tox -e test  # run unit tests
tox -e lint  # run lint
tox -e type  # run type checker
```

(we're using [`pyproject-flake8`](https://pypi.org/project/pyproject-flake8), so that the `flake8`
configuration can live in `pyproject.toml` - within `tox` we then run `pflake8` instead of
`flake8`.)

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/janoskut/hanmatek-psu/-/tree/main",
    "name": "hanmatek-psu",
    "maintainer": "Janos",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "janoskut@gmail.com",
    "keywords": "power-supply,psu,equipment,lab,automation",
    "author": "Janos",
    "author_email": "janoskut@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/19/e1/8879e9a701f15daea2d27960ab84fba6060d3794273069e04c4462b459b3/hanmatek_psu-1.1.2.tar.gz",
    "platform": null,
    "description": "[![](https://img.shields.io/pypi/v/hanmatek-psu.svg?maxAge=3600)](https://pypi.org/project/hanmatek-psu/)\n[![Latest Release](https://gitlab.com/janoskut/hanmatek-psu/-/badges/release.svg)](https://gitlab.com/janoskut/hanmatek-psu/-/releases)\n[![pipeline status](https://gitlab.com/janoskut/hanmatek-psu/badges/main/pipeline.svg)](https://gitlab.com/janoskut/hanmatek-psu/-/commits/main)\n[![coverage report](https://gitlab.com/janoskut/hanmatek-psu/badges/main/coverage.svg)](https://gitlab.com/janoskut/hanmatek-psu/-/commits/main)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\n\n# Hanmatek HM3xxP PSU control library and CLI\n\nUnifying library and CLI for the popular and low-cost digital lab power supplies `HM305P` and\n`HM310P`.\n\nThe library provides an (almost) complete, easy to use interface to all known functions of the\ndevice. This project is different to the below mentioned ones, in that it provides a minimal,\nbut complete interface to the device and also keeps the dependencies low.\n\nThis project is based on the work done in <https://github.com/notkevinjohn/HM310P>, which uses the\n`minimalmodbus` library for device communication. Other related projects were providing\nuseful register definition and hints:\n\n- <https://github.com/JackDoan/hm305_ctrl/tree/master/hm305>\n- <https://github.com/hobbyquaker/hanmatek-hm310p>\n- <https://sigrok.org/wiki/ETommens_eTM-xxxxP_Series#Protocol>\n\n\n## Installation\n\n```py\npip install hanmatek-psu\n```\n\nIf users are in the `plugdev` user group, Hanmatek devices are accessible via `/dev/ttyUSBx` without\nprivileges. Adding the following `udev` rule will create a symlink `/dev/ttyHM3xxP` when a Hanmatek\nPSU device is plugged in via USB. This symlink is used by default by the `hanmatek-cli` to find\ndevices:\n\n```sh\necho 'SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"1a86\", ATTRS{idProduct}==\"7523\", SYMLINK+=\"ttyHM3xxP\", MODE=\"0666\", GROUP=\"plugdev\"' | sudo tee \"/etc/udev/rules.d/99-hanmatek.rules\" > /dev/null\n```\n\n## Usage\n\n### CLI Usage\n\n```sh\nhanmatek-cli -h\nhanmatek-cli --discover             # find devices\nhanmatek-cli                        # show default device info\nhanmatek-cli --device /dev/ttyUSB0  # specific device\nhanmatek-cli voltage:set 3.0        # set voltage\nhanmatek-cli current:set 0.1        # set current limit\nhanmatek-cli output on\nhanmatek-cli current                # read current\nhanmatek-cli power                  # read power\nhanmatek-cli output off\nhanmatek-cli --list                 # list all commands/registers\n```\n\n### Library Usage\n\n```py\nfrom hanmatek import HM3xxP\n\ndevice = HM3xxP(\"/dev/ttyHM3xxP\")\nprint(device.info())\ndevice.write(\"voltage:set\", 3.0)\ndevice.write(\"current:set\", 3.0)\ndevice.write(\"output\", True)\nprint(device.read(\"current\"))\nprint(device.read(\"power\"))\ndevice.write(\"output\", False)\n```\n\n## Development\n\nThe following tools are used to provide clean and quality software, and made available through a\n`tox` configuration: `flake8` for linting, `black` for code formatting and checking, `mypy` for\ntype checking and `pytest` for unit tests. Use as:\n\n```sh\npip install tox\n```\n\n```sh\ntox -a       # show test environments\ntox          # run all\ntox -e test  # run unit tests\ntox -e lint  # run lint\ntox -e type  # run type checker\n```\n\n(we're using [`pyproject-flake8`](https://pypi.org/project/pyproject-flake8), so that the `flake8`\nconfiguration can live in `pyproject.toml` - within `tox` we then run `pflake8` instead of\n`flake8`.)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Library and CLI for the Hanmatek Power supply units (PSU) of the HM3xxP series.",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://gitlab.com/janoskut/hanmatek-psu/-/tree/main",
        "Repository": "https://gitlab.com/janoskut/hanmatek-psu/-/tree/main"
    },
    "split_keywords": [
        "power-supply",
        "psu",
        "equipment",
        "lab",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "40d0e1132071b01cdf2d965f55034c4af900458a79bbd80a02990ec1d1538408",
                "md5": "39ef8fca450ec83bfcb71df5c4b8d2c4",
                "sha256": "6e5f2a4403d25a2c30cd3ea1d10339b6ef796d70a022c37f8556db757ed6152f"
            },
            "downloads": -1,
            "filename": "hanmatek_psu-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "39ef8fca450ec83bfcb71df5c4b8d2c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8567,
            "upload_time": "2023-06-12T11:49:39",
            "upload_time_iso_8601": "2023-06-12T11:49:39.080859Z",
            "url": "https://files.pythonhosted.org/packages/40/d0/e1132071b01cdf2d965f55034c4af900458a79bbd80a02990ec1d1538408/hanmatek_psu-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19e18879e9a701f15daea2d27960ab84fba6060d3794273069e04c4462b459b3",
                "md5": "30f30cabc641d0b10a1352ca92907406",
                "sha256": "6344bcfc6a4f420ae926cff026471d302c44680fc73043be4f3671babf6fcd67"
            },
            "downloads": -1,
            "filename": "hanmatek_psu-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "30f30cabc641d0b10a1352ca92907406",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7249,
            "upload_time": "2023-06-12T11:49:40",
            "upload_time_iso_8601": "2023-06-12T11:49:40.267311Z",
            "url": "https://files.pythonhosted.org/packages/19/e1/8879e9a701f15daea2d27960ab84fba6060d3794273069e04c4462b459b3/hanmatek_psu-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-12 11:49:40",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "janoskut",
    "gitlab_project": "hanmatek-psu",
    "lcname": "hanmatek-psu"
}
        
Elapsed time: 0.14180s