Package: tenma-serial
Tenma DC power supply controllersProvides 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)tenmaControlWhat 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-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 supportKoradka
modelsand other Velleman units
which are just rebrandings of the same internals. Might need to set the
appropiateMATCH_STRin 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/InstallingFrom pippip install tenma-serialpip install will leavetenma-controlandtenma-appletin your PATH ready to use.LocallyIt does not have many requirements, so you might just clone the repo and run it. install the required packages first.pip install -r requirements.txtUsage examplesNote that it can be connected via a usb to serial cable, or directly with the
provided USB cable. In Linux it identifies the usb asBus 001 Device 015: ID 0416:5011 Winbond Electronics Corp. Virtual Com Port, runningdmesgto get
where the /dev/ttyACMX device registerd and pointing tenmaControl.py to that
device should work.any of the following examples can run viatenma-controlortenmaControl.py.Print the Tenma versiontenmaControl.py /dev/ttyUSB0Set the current and the voltageFor example: 2.2 Amperes 5V:tenmaControl.py -c 2200 -v 5000 /dev/ttyUSB0Turn on the channel outputtenmaControl.py --on /dev/ttyUSB0Turn OFF the channel outputtenmaControl.py --off /dev/ttyUSB0Load an existing memorytenmaControl.py -r 1
tenmaControl.py --recall 2Create a new value for a memory 4tenmaControl.py -c 2200 -v 5000 --save 4 /dev/ttyUSB0Print everythingtenmaControl.py -c 2200 -v 5000 --save 4 --verbose --debug /dev/ttyUSB0tenma-applet gtkIndicatorA very simple GTK indicator to control a tenma DC power supply from a graphical desktop. Provides ON, OFF and RESET facilities. Simply start it with:tenma-appletOr directly from the source code via:./gtkIndicator.pyKnown Shortcomings:The physical buttons are blocked for a while after connecting.Testing:This project contains somepytesttests to make it easier to add support for new power supply variants, and validate changes to the code.These tests live under thetests/directory intest_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-2540TENMA_PORT - Optional: set this to the COM/tty port on you PC connected to the power supply. Defaults to auto-finding the portThe tests were written against 72-2540, there are no extra tests for the 72-133XX models (yet). We curerntly test:PSU init/version stringSet/get voltageSet/get currentSave/recall memory in all slotsSet/unset beepTurn output on/offNote: Before testing, disconnect everything from the power supply. We try to test as safely as possible, but no promises are madeFirst, install pytest:pip install pytestThen you can run the tests from the root directory of the repo:python -m pytestYou 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