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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bk_precision_1900-1.1.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bk_precision_1900-1.1.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

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

Hashes for bk_precision_1900-1.1.2.tar.gz
Algorithm Hash digest
SHA256 4b67c1738873aef2eb0ad7db3198a0f961ab347ef0edd82353860455599834be
MD5 b1b89cc41edc013990d16233cc8ea8ba
BLAKE2b-256 ceac8383c8dbe976014fe72e04fa69730fbf570355775e264bb5c4664159fcf1

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bk_precision_1900-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for bk_precision_1900-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a01401efa30b029c940df321dce28e447e06ba4bbda8a32e9df336342c11560e
MD5 aac49d19ebf0ff4342e827d92b9cc86f
BLAKE2b-256 14c7beebee9c9d2d39152993527bb3cf9d621d8b349a4b244e0cdb75f2c5bb09

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page