Skip to main content

NI-DAQmx instrument backend for lab-executor-mcp

Project description

lab-nidaq-mcp

NI-DAQmx instrument backend for lab-executor-mcp. Version 0.1 supports software-timed, single-point analog input, digital input, analog output, and digital output on the agreed USB-6009 and USB-6210 devices. Waveforms, streaming, triggers, counters, and timers are out of scope.

Resources are device-level and case-sensitive: DAQ::Dev1 and DAQ::Dev2. Commands select a channel:

READ AI ai0
READ DI port0/line0
INFO model
WRITE AO ao0 2.5
WRITE DO port1/line0 1
SAFE

Safety model

Outputs are disabled unless explicitly declared in configuration. Every declared output requires an explicit safe_value; the software never assumes zero is safe. A configured interlock is read immediately before every ordinary output write, and a mismatch or read failure refuses the write. Safe-value writes from SAFE and close() deliberately bypass the interlock and attempt every declared output. Analog output values are checked against both the declared range and the model capability before a DAQmx task is created. Writes are never automatically retried.

Mandatory installation requirement (D9)

The USB-6009 and USB-6210 cannot be assigned a programmable power-up output state. Software therefore cannot guarantee an output level after a host crash, USB disconnection, or loss of host control. The installer is responsible for wiring the external circuit so that a high-impedance output line is the safe state. This is an installation requirement, not a guarantee made by this backend. support_level remains experimental until output operation and this wiring requirement are verified on the installed hardware.

Configuration

devices:
  Dev2:
    model: "USB-6009"
    interlock: none
    analog_inputs:
      ai0: {range: [-10, 10]}
    analog_outputs:
      ao0:
        range: [0, 5]
        safe_value: 0.0
    digital_outputs:
      port1/line0:
        safe_value: 0

model and interlock are mandatory. The declared model selects physical capabilities and must match the DAQmx product_type read on first hardware access. Use the explicit interlock string none, or configure {line: "port0/line7", require: 1}. An interlock line cannot also be declared as an output.

lab-nidaq --config nidaq.yaml --dry-run
lab-nidaq --config nidaq.yaml

The entry point is lab_executor.backends: nidaq, with routing prefix DAQ::.

Measured hardware limits

The capability table's maximum sample rate is the device's specified figure. It is not a guarantee that a given host can sustain it, and this backend does not pretend otherwise: a rate the hardware cannot keep up with surfaces as a transport error carrying DAQmx's own diagnosis, rather than silently returning short or duplicated data.

Measured on this hardware on 2026-07-20:

  • USB-6210 at 250 kS/s — 10,000 samples acquired without error.
  • USB-6009 at its specified 48 kS/s maximum — DAQmx reports Onboard device memory overflow (-200361). The device has little onboard memory and transfers over interrupts, so the specified maximum is not reachable for buffered reads on this host. 10 kS/s was reliable.

An unconnected differential input rails rather than reading zero. A USB-6210 input with nothing attached returned a constant 10.974836 V across all 10,000 samples, while a USB-6009 single-ended input on the same code path returned genuine ADC noise (9 distinct values, σ≈2.2 mV). Constant data from an acquisition usually means the terminal is floating, not that acquisition failed; bias unused differential inputs to AI GND if you need a meaningful reading.

Development

Tests use only MockNiDaqBackend; they never construct a DAQmx task. Run:

python -m pytest -q
python -m ruff check src tests
python -m ruff format --check src tests
python -m build

License

MIT

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

lab_nidaq_mcp-0.1.1.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

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

lab_nidaq_mcp-0.1.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file lab_nidaq_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: lab_nidaq_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for lab_nidaq_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 11f0a496b324df12ac48fcb695126de24333a602098e231a0eb861fcef01f352
MD5 3a26830412c259000dd62b35c9169d8d
BLAKE2b-256 0fbe1827e8d67720e42f7b63ac51057fe2483ca887a143b4a8b3203ee842654c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lab_nidaq_mcp-0.1.1.tar.gz:

Publisher: publish.yml on TECTOS-JP/lab-nidaq-mcp

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

File details

Details for the file lab_nidaq_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lab_nidaq_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for lab_nidaq_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5c453be358e4615e8241e56925dc87e04ef870344085c422ec371b6271f60b0
MD5 8201bbaaba69effe3b6cb5500afbfed8
BLAKE2b-256 6c58bcde7e860f62734a33d06106123fc9d5b8d00f37d6a1282fe3501f277fdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for lab_nidaq_mcp-0.1.1-py3-none-any.whl:

Publisher: publish.yml on TECTOS-JP/lab-nidaq-mcp

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