Skip to content

Commit d0bd991

Browse files
dccoteclaude
andcommitted
Add Stanford Research SR830 lock-in amplifier driver
Problem: The lab's SR830 DSP lock-in amplifier, reached over a Prologix GPIB-USB adaptor, had no driver in PyHardwareLibrary. Solution: Add SR830Device (and DebugSR830Device) combining PhysicalDevice, AnalogInputStreamDevice, AnalogOutputDevice, PhaseLockedDetectionDevice, and TriggerableDevice: - Aux A/D inputs (OAUX?) via getAnalogVoltage(AuxInput); Aux D/A outputs (AUXV) via setAnalogVoltage(value, AuxOutput). - Demodulated reads X/Y/R/theta (OUTP?/SNAP?), reference frequency (FREQ?), input source (ISRC), sensitivity (SENS) and time constant (OFLT) in physical units with nearest-step snapping. - Buffered acquisition of the internal data buffer (DDEF/SRAT/SEND/REST/STRT/ PAUS/SPTS?/TRCA?) via the AnalogInputStreamDevice primitives, with a StreamChannel enum and a SampleClock (internal rate vs external per-edge). - Trigger via TSTR (setTriggerSource) and TRIG (softwareTrigger). - doInitializeDevice self-discovers the Prologix among the connected FTDI adaptors by confirming *IDN? contains SR830, and pins the adaptor serial for reconnects. - DebugSR830Device swaps in a DebugPrologixGPIBPort (an in-memory CommunicationPort that follows the readData/writeData structure) so all parse/validate paths run without hardware. Verified against the lab SR830 (s/n 86552): tests/testSR830.py has 43 tests, including 8 that talk to the real instrument (reads, aux out round-trip, buffered acquisition, trigger) and skip cleanly when no SR830 is attached. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T2DmAfLHSiK1fb3PiXDyJP
1 parent 1fa3e13 commit d0bd991

4 files changed

Lines changed: 917 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@ API changes can land even when the minor version is unchanged.
66

77
## [Unreleased]
88

9+
### Added
10+
- `SR830Device` (and `DebugSR830Device`): Stanford Research SR830 DSP lock-in
11+
amplifier over a Prologix GPIB-USB controller. It combines several capabilities:
12+
`AnalogInputStreamDevice` (the four rear-panel Aux A/D inputs via `OAUX?`, plus
13+
hardware-timed buffered acquisition of the demodulated outputs from the internal
14+
data buffer), `AnalogOutputDevice` (the four rear-panel Aux D/A outputs via
15+
`AUXV`), `PhaseLockedDetectionDevice` (X/Y/R/theta, reference frequency, signal
16+
input source, sensitivity, and time constant), and `TriggerableDevice` (the
17+
rear-panel TRIG IN). Enums: `AuxInput`, `AuxOutput`, `StreamChannel`,
18+
`InputSource`. `doInitializeDevice` self-discovers the Prologix among the
19+
connected FTDI adaptors by confirming `*IDN?`, and pins the adaptor's serial.
20+
- `PrologixGPIBPort` (`hardwarelibrary/communication/`): a `SerialPort` subclass
21+
that speaks the Prologix GPIB-USB controller `++` protocol. GPIB instruments
22+
talk to it with the ordinary `readString`/`writeString` primitives; the `++read
23+
eoi` handshake is encapsulated in its `readString`.
24+
- New DAQ capability contracts in `daq/daqdevice.py`: `PhaseLockedDetectionDevice`
25+
(lock-in / phase-locked detection), `TriggerableDevice` with the `TriggerSource`
26+
enum, and the `SampleClock` enum for stream sample clocking.
27+
28+
### Changed
29+
- `AnalogInputStreamDevice`: the sample-rate parameter of
30+
`configureStream`/`acquireWaveform` is renamed `scanRate` -> `sampleRate`.
31+
`LabjackDevice.configureStream` keeps `scanRate` as a temporary deprecated
32+
synonym for existing callers.
33+
- `LabjackDevice` now imports `u3` (LabJackPython) lazily at point of use, so
34+
`import hardwarelibrary.daq` (and the new SR830 driver) works on hosts that do
35+
not have LabJackPython installed.
36+
937
## [1.3.3] - 2026-07-08
1038

1139
### Changed

hardwarelibrary/daq/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@
33
from .daqdevice import (
44
AnalogInputDevice, AnalogOutputDevice, AnalogIODevice, AnalogInputStreamDevice,
55
DigitalInputDevice, DigitalOutputDevice, DigitalIODevice,
6+
PhaseLockedDetectionDevice, InputSource,
7+
TriggerableDevice, TriggerSource, SampleClock,
68
)
7-
from .labjackdevice import LabjackDevice, DebugLabjackDevice
9+
from .labjackdevice import LabjackDevice, DebugLabjackDevice
10+
from .sr830device import (
11+
SR830Device, DebugSR830Device, DebugPrologixGPIBPort,
12+
AuxInput, AuxOutput, StreamChannel,
13+
)

0 commit comments

Comments
 (0)