Skip to main content

pyrpl-voltage-driver

A small standalone driver that turns a Red Pitaya (STEMlab 125-10 / 125-14) analog output into a held DC voltage source via pyrpl. Configures pyrpl's arbitrary signal generator (ASG) as a dc waveform with amplitude=0, so offset is the only knob that drives the SMA — set_voltage() is then a single FPGA register write.

Designed to drop into any project that needs a positive, unipolar voltage actuator on a networked Red Pitaya — independent of any larger control framework.

Install

PyPI's pyrpl is stuck at 0.9.3.6 (2017). The maintained fork lives on GitHub, so install it from there first, then install this package:

pip install git+https://github.com/pyrpl-fpga/pyrpl
pip install pyrpl-voltage-driver

If you use uv:

uv add git+https://github.com/pyrpl-fpga/pyrpl
uv add pyrpl-voltage-driver

Usage

from pyrpl_voltage_driver import RedPitayaPyrplDAC

dac = RedPitayaPyrplDAC(
    hostname="rp-f0aabb.local",  # or static IP
    output="out1",
    vmax=0.5,                    # clamp output to 0..0.5 V
)

dac.connect()                    # 10-30 s on first call: SSH + bitstream upload
try:
    dac.set_voltage(0.2)
    # ... do stuff ...
    dac.set_voltage(0.0)
finally:
    dac.disconnect()             # parks the output at 0 V and turns it off

set_voltage(v) clamps v to [0, vmax]. Calling set_voltage() before connect() raises NotConnectedError.

Wrapping this driver to fit an existing host application's interface (VoltageDriver Protocol, pydantic YAML config, async, custom error hierarchy, ...)? See docs/integration.md.

Constructor parameters

Parameter Default Notes
hostname (required) Red Pitaya hostname or IP, e.g. rp-f0aabb.local.
output "out1" "out1" or "out2" — which SMA the ASG is wired to.
asg "asg0" "asg0" or "asg1" — which on-FPGA ASG channel to use.
vmax 1.0 Upper bound on the output in volts. Must be in (0, 1.0]. The SMA itself is bipolar ±1 V.
config_name "pyrpl_voltage_driver" Name of pyrpl's per-instrument YAML file under ~/.pyrpl/. Use distinct names per device.
user None SSH user. Defaults to pyrpl's choice (typically root).
password None SSH password. Defaults to pyrpl's choice (typically root).
park_on_disconnect True On disconnect(), zero the output and turn output_direct off.
force_qt_offscreen True Set QT_QPA_PLATFORM=offscreen before importing pyrpl. Disable if you run with a display.

Headless / Qt note

pyrpl imports PyQt at top level, which tries to open an X display. By default this driver sets QT_QPA_PLATFORM=offscreen before importing pyrpl, so it works on headless servers. If you're already exporting your own QT_QPA_PLATFORM (e.g. running with a real display), pass force_qt_offscreen=False.

First-connect cost

connect() opens an SSH session to the Red Pitaya, pushes pyrpl's bitstream, and starts the FPGA monitor server. Expect 10-30 seconds. Subsequent connect() calls in the same Python process are no-ops.

Development

uv sync --extra test
uv run pytest tests/unit -v

The unit tests are fully mocked — no Red Pitaya required.

For hardware-in-the-loop tests against a real Red Pitaya (useful before depending on this package on a new machine), see docs/testing.md. Quick version:

REDPITAYA_HOST=rp-f0aabb.local uv run pytest tests/integration -v

Releasing (maintainers)

Cutting and publishing PyPI releases is documented in docs/releasing.md — covers one-time PyPI setup, the first-version flow, subsequent versions, and recovering from a broken upload.

Metadata

Release files for pyrpl-voltage-driver 0.2.0

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

Source distribution (sdist)

Source distribution for pyrpl-voltage-driver 0.2.0
File Size Uploaded Provenance Actions
pyrpl_voltage_driver-0.2.0.tar.gz 25.1 kB Without provenance Details for pyrpl_voltage_driver-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyrpl-voltage-driver 0.2.0
File Interpreter ABI Platform Actions
pyrpl_voltage_driver-0.2.0-py3-none-any.whl Python 3 none any Details for pyrpl_voltage_driver-0.2.0-py3-none-any.whl

Total release size: 30.6 kB

Release files / pyrpl_voltage_driver-0.2.0.tar.gz

Download URL pyrpl_voltage_driver-0.2.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2beb2f6ecf4935da15df78474cb409014525af9c7031112847ddeabcd4c7c16e
BLAKE2b-256 checksum
How to use checksums
a4caa5837b2b5271a049fec1c4918aa36dfe8201885c68d8eda528203b615f39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / pyrpl_voltage_driver-0.2.0-py3-none-any.whl

Download URL pyrpl_voltage_driver-0.2.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9a023cac996c2519955168b211dd699337d2267868ab5a5e5c48b1d3e19b658
BLAKE2b-256 checksum
How to use checksums
0f5c2d833dffcd32ee3910b4c5ba61a3fffa64900117bd348fe39457dfa2b5a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for pyrpl-voltage-driver 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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