Skip to main content

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/ttyUSB0 with your serial port (e.g., COM3 on 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.

Metadata

Release files for bk-precision-1900 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bk-precision-1900 1.1.2
File Size Uploaded
bk_precision_1900-1.1.2.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bk-precision-1900 1.1.2
File Interpreter ABI Platform
bk_precision_1900-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / bk_precision_1900-1.1.2.tar.gz

Download URL bk_precision_1900-1.1.2.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4b67c1738873aef2eb0ad7db3198a0f961ab347ef0edd82353860455599834be
BLAKE2b-256 checksum
How to use checksums
ceac8383c8dbe976014fe72e04fa69730fbf570355775e264bb5c4664159fcf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 27, 2026.

Transparency log

Release files / bk_precision_1900-1.1.2-py3-none-any.whl

Download URL bk_precision_1900-1.1.2-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a01401efa30b029c940df321dce28e447e06ba4bbda8a32e9df336342c11560e
BLAKE2b-256 checksum
How to use checksums
14c7beebee9c9d2d39152993527bb3cf9d621d8b349a4b244e0cdb75f2c5bb09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page