Skip to main content

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/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.

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

bk_precision_1900-1.1.0.tar.gz (4.0 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.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file bk_precision_1900-1.1.0.tar.gz.

File metadata

  • Download URL: bk_precision_1900-1.1.0.tar.gz
  • Upload date:
  • Size: 4.0 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.0.tar.gz
Algorithm Hash digest
SHA256 b60e94b65bfa2bf27a84b3a48dc7bf18301c0a9c743d25d02b9e9725f828e2f5
MD5 86fa07d48928f086da4a4f581adb1ba0
BLAKE2b-256 e16a57b31eb8266b22423a08a51dd23a64cffbb35b14fe543290e52ca367aa9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bk_precision_1900-1.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bk_precision_1900-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92e84dbe32e97ffba7a34fa7c6b5c66aada05f6111f171c52c47d1d3022e162c
MD5 4836d612777d81a0e3b994b65331c8dc
BLAKE2b-256 a3f3ffb2b7a6672cfabbf1c3a4daabccc8c13f9eeacdf856f1b6bfa061fca2d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for bk_precision_1900-1.1.0-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.

Supported by

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