Tenma DC power supply controllers
Provides two basic controllers (tested on Linux) for a TENMA DC power supply via serial interface. Working on python 2.7 and python 3.
- tenmaControl.py (tenma-control) (command line utility)
- gtkIndicator.py (tenma-applet) (GTK indicator to sit on tray)
tenmaControl
What is this?
A small command line program / library to setup a Tenma 72-XXXX DC POWER SUPPLY from your computer via SERIAL.
Supports the following models with predefined limits:
* 72-2545 -> Tested on HW (@kxtells)
* 72-2535 -> Set as manufacturer manual (not tested)
* 72-2540 -> Tested on HW (thomas-phillips-nz)
* 72-2550 -> Tested on HW (@kxtells)
* 72-2705 -> Tested on HW (@ollie1400)
* 72-2710 -> Tested on HW (r202401, renier.daudey)
* 72-2930 -> Set as manufacturer manual (not tested)
* 72-2940 -> Set as manufacturer manual (not tested)
* 72-13320 -> Set as manufacturer manual (not tested)
* 72-13330 -> Tested on HW (thomas-phillips-nz)
* 72-13360 -> Tested on HW (Sebastian Norlin)
Also, even if not described, should support Koradka
models and other Velleman units
which are just rebrandings of the same internals. Might need to set the
appropiate MATCH_STR in the source code, feel free to open a PR if you test
it in a known hardware unit.
Originally, Coming back from holidays was hard. So I spent some time with a little game setting up our power supply(tongue). You'll find a small explanation of the original code in:
https://jcastellssala.com/2017/10/31/tenma72-2540-linux-control/
Installing
From pip
pip install tenma-serial
pip install will leave tenma-control and tenma-applet in your PATH ready to use.
Locally
It does not have many requirements, so you might just clone the repo and run it. install the required packages first.
pip install -r requirements.txt
Usage examples
Note that it can be connected via a usb to serial cable, or directly with the
provided USB cable. In Linux it identifies the usb as Bus 001 Device 015: ID 0416:5011 Winbond Electronics Corp. Virtual Com Port , running dmesg to get
where the /dev/ttyACMX device registerd and pointing tenmaControl.py to that
device should work.
any of the following examples can run via tenma-control or tenmaControl.py.
Print the Tenma version
tenmaControl.py /dev/ttyUSB0
Set the current and the voltage
For example: 2.2 Amperes 5V:
tenmaControl.py -c 2200 -v 5000 /dev/ttyUSB0
Turn on the channel output
tenmaControl.py --on /dev/ttyUSB0
Turn OFF the channel output
tenmaControl.py --off /dev/ttyUSB0
Load an existing memory
tenmaControl.py -r 1
tenmaControl.py --recall 2
Create a new value for a memory 4
tenmaControl.py -c 2200 -v 5000 --save 4 /dev/ttyUSB0
Print everything
tenmaControl.py -c 2200 -v 5000 --save 4 --verbose --debug /dev/ttyUSB0
tenma-applet gtkIndicator
A very simple GTK indicator to control a tenma DC power supply from a GTK based desktop (GNOME or similar). Provides ON, OFF and RESET facilities. Simply start it with:
WARN: This applet is barely maintained and has not been tested in newer GNOME versions.
tenma-applet
Or directly from the source code via:
./gtkIndicator.py
Known Shortcomings:
- The physical buttons are blocked for a while after connecting.
Testing:
This project contains some pytest tests to make it easier to add support for new power supply variants, and validate changes to the code.
These tests live under the tests/ directory in test_tenma.py. There are two environment variables used by the tests:
- TENMA_MODEL - set this to the MATCH_STR of the power supply you're testing. Defaults to 72-2540
- TENMA_PORT - Optional: set this to the COM/tty port on you PC connected to the power supply. Defaults to auto-finding the port
The tests were written against 72-2540, there are no extra tests for the 72-133XX models (yet). We curerntly test:
- PSU init/version string
- Set/get voltage
- Set/get current
- Save/recall memory in all slots
- Set/unset beep
- Turn output on/off
Note: Before testing, disconnect everything from the power supply. We try to test as safely as possible, but no promises are made
First, install pytest:
pip install pytest
Then you can run the tests from the root directory of the repo:
python -m pytest
You can set the environment variables when you run the test:
# Windows:
$env:TENMA_MODEL='72-2550'; $env:TENMA_PORT='COM7'; python -m pytest
# Linux:
TENMA_MODEL='72-2550' TENMA_PORT='COM7' python -m pytest
Metadata
Release files for tenma-serial 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tenma_serial-1.1.4.tar.gz | 38.7 kB | Without provenance | Details for tenma_serial-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tenma_serial-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for tenma_serial-1.1.4-py3-none-any.whl |
Total release size: 70.3 kB
Release files / tenma_serial-1.1.4.tar.gz
| Download URL | tenma_serial-1.1.4.tar.gz |
|---|---|
| Size | 38.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33f2c068741926ce683594e84c3ce82a44f771aa367109ee4eaaedc07f3e3223
|
|
BLAKE2b-256 checksum How to use checksums |
3d92f91464962eb5fc586163528d84f27f199c1e72bcf3ed04ba26795ddfb706
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / tenma_serial-1.1.4-py3-none-any.whl
| Download URL | tenma_serial-1.1.4-py3-none-any.whl |
|---|---|
| Size | 31.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a2a134c56a89d141de8e067bdc292ea1b6527e3d6e21c5ffd5c015eb474999d
|
|
BLAKE2b-256 checksum How to use checksums |
b05b22f1bcdf1804cf11943af8bd3742670c02718f6e349d26cd65b74e6b4bbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for tenma-serial 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.