NI-DAQmx DAQ Devices

v0.1.2
io.github.K-Dense-AI/labmcp-ni-daqmx Checked 3 days ago Published 2 months ago

MCP server for National Instruments DAQ devices (NI-DAQmx).

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_connection_info Get Connection Info

Report which instrument is connected (identity, address, simulated or real), whether the server is read-only, and the active safety limits. Call this first.

get_command_log Get Command Log

Return the most recent raw commands sent to / replies received from the instrument (newest last). Useful for debugging and for recording what was done.

ParameterTypeDescription
limitinteger

reconnect Reconnect

Close and re-open the connection to the instrument (e.g. after it was power cycled or a cable was re-plugged).

list_devices List Devices

List every NI-DAQmx device the driver can see (product type, serial number, channels, whether it is an NI MAX simulated device) and which one this server is connected to.

get_device_info Get Device Info

Describe the connected device: analog input/output channels, digital lines, supported voltage ranges, maximum sample rates, and the outputs this server has set. Call this before choosing channels, ranges and rates.

read_analog Read Analog

Measure voltage on one or more analog inputs: a single on-demand reading, or a finite hardware-timed acquisition of `samples` per channel at `rate_hz`. Returns per-channel statistics and a downsampled waveform; optionally saves all data to CSV. Bounded by the `max_samples`, `max_rate_hz` and `max_acquisition_s` limits; the device's own maximum rate (shared by all channels on multiplexed devices) also applies. Blocks for samples / rate_hz seconds.

ParameterTypeDescription
channels *stringAnalog inputs, e.g. 'ai0', 'ai0:3' or 'Dev1/ai0, Dev1/ai4'
max_pointsintegerMax points per channel in the returned waveform
max_vnumberHighest expected voltage (sets the input range)
min_vnumberLowest expected voltage (sets the input range)
rate_hzSample clock rate per channel (required if samples > 1)
samplesintegerSamples per channel; 1 = one on-demand reading
save_pathWrite all samples to this new .csv file (never overwritten)
terminal_configstringInput wiring: rse = single-ended to AI GND, diff = differential, nrse = to AI SENSE

read_thermocouple Read Thermocouple

Measure temperature (°C) with thermocouples (types B, E, J, K, N, R, S, T) on a thermocouple-capable device, e.g. an NI 9211/9212/9213/9214 module or USB-TC01. Use cjc_source='built_in' on modules with a cold-junction sensor; 'constant' uses cjc_value_c (accuracy then depends on how well you know the terminal temperature). Devices without thermocouple support return an NI-DAQmx error.

ParameterTypeDescription
channels *stringThermocouple inputs, e.g. 'ai0' or 'ai0:3' (on a thermocouple-capable device/module)
cjc_sourcestring'built_in' = the module's cold-junction sensor (e.g. NI 9211/9213, USB-TC01); 'constant' = cjc_value_c
cjc_value_cnumberCold-junction temperature in °C when cjc_source='constant'
max_cnumberHighest expected temperature, °C
max_pointsinteger
min_cnumberLowest expected temperature, °C
rate_hzSample rate if samples > 1
samplesintegerSamples per channel; 1 = one reading
save_pathWrite all samples to this new .csv file (never overwritten)
thermocouple_typestring

read_digital_lines Read Digital Lines

Read the logic level of digital lines. Lines that this server is driving as outputs are reported from their last commanded level and are NOT re-read: an NI-DAQmx digital-input task would switch them to inputs and release whatever they drive. Reading a line another program drives may likewise make it an input.

ParameterTypeDescription
lines *stringDigital lines, e.g. 'port0/line0:3' or 'Dev1/port1/line0'

write_analog Write Analog

Set an analog output to a DC voltage (static, software-timed). The output keeps this value after the call on most NI devices, until changed or `set_outputs_safe` is called. This energises whatever the output drives (valve or heater controllers, laser drivers, actuators). Checked against `max_ao_voltage_v` (absolute value) and the device's AO range (e.g. USB-6008/6009: 0-5 V) before anything is sent.

ParameterTypeDescription
channel *stringOne analog output, e.g. 'ao0' or 'Dev1/ao1'
voltage_v *numberDC output voltage in V

write_digital_lines Write Digital Lines

Drive digital output lines high or low. The lines keep their level after the call until changed or `set_outputs_safe` is called. Digital outputs often switch relays, valves, pumps or trigger other instruments; confirm with the user what each line controls. Voltage levels depend on the device (e.g. 5 V TTL or 3.3 V).

ParameterTypeDescription
levels *arrayOne level for all lines, or one per line in order
lines *stringDigital lines, e.g. 'port0/line0' or 'port0/line0:3'

set_outputs_safe Set Outputs Safe

Put the device's outputs in a safe state: every analog output to 0 V (or the bottom of its range if 0 V is not in it) and, by default, every digital line this server drove - plus the `safe_do_lines` option lines - driven low. Use when finished or if anything looks wrong.

ParameterTypeDescription
digital_lowbooleanAlso drive low every DO line this server drove (and the safe_do_lines option)