riden
A simple synchronous, single-threaded client for Riden laboratory power supplies (RD6006, RD6006P, RD6012, RD6012P, RD6018, RD6024, RK6006).
It speaks Modbus RTU over a regular serial port or Bluetooth SPP (RFCOMM) on Linux.
Features
- synchronous API with no background event loop:
with Riden.connect(...) as rd: ...; - Bluetooth on Linux via
bt://URLs (AF_BLUETOOTH+ RFCOMM); - batched I/O: fields are read and written in one Modbus transaction per contiguous register block, not one transaction per field;
- automatic model and voltage/current scale detection on connect;
- ready-made transport stack: transaction pacing, keepalive, reconnect, and logging.
Requirements
- Python 3.14 or newer;
- Linux with BlueZ for Bluetooth SPP;
- any OS supported by pyserial for USB serial.
Install
uv add riden
or with pip:
pip install riden
From source:
git clone https://github.com/acc15/riden
cd riden
uv sync
Quick start
from riden import Riden
with Riden.connect("bt://E2:F9:C6:24:71:C8?channel=1&timeout=0.5") as rd:
print(rd.status())
# Several fields — a single device transaction.
v, i, p = rd.read("v", "i", "p").values()
print(v, i, p)
# Several fields — a single write transaction.
rd.write(v_set=5.0, i_set=0.1, en=True)
For USB serial, pass the device path:
with Riden.connect("/dev/ttyUSB0") as rd:
...
Field names are case-insensitive, so "V" and "v" refer to the same field.
Example: voltage sweep + status
import time
from riden import Riden
with Riden.connect("bt://E2:F9:C6:24:71:C8?channel=1&timeout=0.5") as rd:
try:
rd.write(v_set=0.0, i_set=0.1, en=True)
for voltage in range(0, 60, 5):
rd.write(v_set=float(voltage))
time.sleep(2)
print(rd.status())
finally:
rd.write(v_set=0.0, en=False)
Bluetooth on Linux
Pair and trust the device first (bluetoothctl pair/trust); the RFCOMM
channel is usually 1. URL format:
bt://AA:BB:CC:DD:EE:FF?channel=1&timeout=0.5
timeout and connect_timeout are specified in seconds as query parameters.
BtSerial is registered as a pyserial URL handler, so bt:// works anywhere a
regular serial port is accepted.
Performance
read() selects the requested fields, computes their overall address range,
and issues one read_registers call for the whole range, then decodes the
raw registers into fields. write() encodes and validates all values first,
merges adjacent fields into contiguous blocks, and sends one transaction per
block.
Therefore:
# 1 transaction instead of 3
v, i, p = rd.read("v", "i", "p").values()
# 1 transaction instead of 3
rd.write(v_set=5.0, i_set=0.1, en=True)
Sparse fields are still read in one transaction spanning the whole range between them, so grouping nearby fields is preferable.
Development
uv sync
uv build # sdist + wheel in dist/
just check # ty + ruff + pytest
Scripts in scripts/ are run through uv run:
uv run scripts/v_sweep.py
uv run scripts/link_test.py "bt://E2:F9:C6:24:71:C8?channel=1&timeout=0.5"
just --list shows the remaining tasks.
License
MIT — see LICENSE.
Metadata
Release files for riden 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| riden-0.1.0.tar.gz | 17.6 kB | Without provenance | Details for riden-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| riden-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for riden-0.1.0-py3-none-any.whl |
Total release size: 40.5 kB
Release files / riden-0.1.0.tar.gz
| Download URL | riden-0.1.0.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32d6d2747a3ee198103e0a69276a6c08d80288341268a2461c2a0b56c79fbecf
|
|
BLAKE2b-256 checksum How to use checksums |
bac2989d92d336f2b403f58184904e78806af27f374e8defcb956360cd1b3ad7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / riden-0.1.0-py3-none-any.whl
| Download URL | riden-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83a271380dbee06d3c14480fc830667e1bbf680678124b39bc19b9f067b1c699
|
|
BLAKE2b-256 checksum How to use checksums |
75dc6e366a8c610987d3675fe97801c9ef05579e072bfa5c065cee66089668d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for riden 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.