Control the BK Precision 1900 series power supplies
Project description
BK Precision 1900 Series Control
A lightweight Python 3.12 library and CLI for controlling BK Precision 1900-series programmable DC power supplies, tested on the BK 1902B. It provides both a Pythonic context-manager interface and a simple command-line tool for automation or lab use.
✨ Features
- Safe open/close via context manager
- Set and read output voltage/current
- Enable or disable output
- Query front-panel readings (voltage, current, CV/CC mode)
- Command-line interface (
bk1902b) for quick manual control
🧰 Installation
From PyPI
pip install bk_precision_1900
From Source
git clone https://github.com/DephyInc/bk_precision_1900.git
cd bk_precision_1900
pip install -e ".[dev]"
🚀 Command-Line Usage
After installation, a console script bk1902b is available.
# Set output voltage to 12.0 V
bk1902b set-voltage --port /dev/ttyUSB0 12.0
# Set output current to 2.0 A
bk1902b set-current --port /dev/ttyUSB0 2.0
# Turn output on / off
bk1902b output --port /dev/ttyUSB0 on
bk1902b output --port /dev/ttyUSB0 off
# Read front-panel display (voltage, current, mode)
bk1902b read-display --port /dev/ttyUSB0
bk1902b read-display --port /dev/ttyUSB0 --json
Replace
/dev/ttyUSB0with your serial port (e.g.,COM3on Windows).
🧑💻 Library Usage
import time
from bk_precision_1900.bk1902b import BK1902B
with BK1902B("/dev/ttyUSB0") as psu:
psu.set_current(0.1)
psu.set_voltage(5.0)
psu.enable_output()
time.sleep(5)
psu.disable_output()
🧩 Demo Script
A minimal example (bk_precision_1900/bk_demo.py) is included:
python -m bk_precision_1900.bk_demo /dev/ttyUSB0
It cycles voltages between 1 V and 40 V, reads back live measurements, and prints CV/CC status.
🧪 Development
# Format, lint, and type-check
ruff format .
ruff check .
mypy .
Requirements are managed via pyproject.toml and use Ruff for linting + formatting and Mypy for static type checking.
📝 To Do
- Implement full BK 1900 command set (
GETS,SOVP,SOCP, etc.) - Query limits instead of hard-coding max values
- Add unit tests / mock serial backend
- Automate releases (e.g. GitHub Actions)
⚖️ License
MIT License © Dephy Inc. See https://dephyinc.mit-license.org/ for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bk_precision_1900-1.1.2.tar.gz.
File metadata
- Download URL: bk_precision_1900-1.1.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b67c1738873aef2eb0ad7db3198a0f961ab347ef0edd82353860455599834be
|
|
| MD5 |
b1b89cc41edc013990d16233cc8ea8ba
|
|
| BLAKE2b-256 |
ceac8383c8dbe976014fe72e04fa69730fbf570355775e264bb5c4664159fcf1
|
Provenance
The following attestation bundles were made for bk_precision_1900-1.1.2.tar.gz:
Publisher:
pypi-release.yml on DephyInc/bk-precision-1900
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bk_precision_1900-1.1.2.tar.gz -
Subject digest:
4b67c1738873aef2eb0ad7db3198a0f961ab347ef0edd82353860455599834be - Sigstore transparency entry: 1004145791
- Sigstore integration time:
-
Permalink:
DephyInc/bk-precision-1900@3303f019b16cfe6cc89222135f82e66bc0478710 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/DephyInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@3303f019b16cfe6cc89222135f82e66bc0478710 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bk_precision_1900-1.1.2-py3-none-any.whl.
File metadata
- Download URL: bk_precision_1900-1.1.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a01401efa30b029c940df321dce28e447e06ba4bbda8a32e9df336342c11560e
|
|
| MD5 |
aac49d19ebf0ff4342e827d92b9cc86f
|
|
| BLAKE2b-256 |
14c7beebee9c9d2d39152993527bb3cf9d621d8b349a4b244e0cdb75f2c5bb09
|
Provenance
The following attestation bundles were made for bk_precision_1900-1.1.2-py3-none-any.whl:
Publisher:
pypi-release.yml on DephyInc/bk-precision-1900
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bk_precision_1900-1.1.2-py3-none-any.whl -
Subject digest:
a01401efa30b029c940df321dce28e447e06ba4bbda8a32e9df336342c11560e - Sigstore transparency entry: 1004145794
- Sigstore integration time:
-
Permalink:
DephyInc/bk-precision-1900@3303f019b16cfe6cc89222135f82e66bc0478710 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/DephyInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@3303f019b16cfe6cc89222135f82e66bc0478710 -
Trigger Event:
push
-
Statement type: