Configuring Analog Input Voltage Ranges in Python Using the NI‑DAQmx API

Updated Apr 16, 2026

Reported In

Driver

  • NI-DAQ™mx

Programming Language

  • Python

Issue Details

When reading an analog input value through the Python API with NI-DAQmx, the reported measurement does not reflect the actual voltage present on the input channel. In testing, the analog input consistently returned a maximum value of 5 V, even though the physical input voltage exceeded 5 V and remained within the device’s hardware specifications. The affected channel supports a ±10 V input range, but the API did not report values above 5 V.

Solution

When using the Python API with NI-DAQmx, it is necessary to specify the parameters in the function where the channel is declared, more specifically, the lower and upper ranges in the function constructor.

As an example, the next function has the min and max voltage values present on its parameters, taken from the NI-DAQmx Python Documentation API:

  • task.ai_channels.add_ai_voltage_chan("Dev1/ai0", min_val=-10.0, max_val=10.0) 

The whole set of parameters that can be used for the method shown above is explained as follows. If some parameter labeled as optional is not declared inside parentheses, the function will work normally or will take the default value in the constructor definition:

  • physical_channel: Specifies the names of the physical channels to use to create virtual channels. The DAQmx physical channel constant lists all physical channels on devices and modules installed in the system.
  • name_to_assign_to_channel: Specifies a name to assign to the virtual channel this function creates. If you do not specify a value for this input, NI-DAQmx uses the physical channel name as the virtual channel name. 
  • terminal_config: Specifies the input terminal configuration for the channel. (Optional)
  • min_val: Specifies, in units, the minimum value you expect to measure. (Optional, default value is -5)
  • max_val: Specifies, in units, the maximum value you expect to measure. (Optional, default value is 5)
  • units: Specifies the units to use to return voltage measurements. (Optional, default value is Volts)
  • custom_scale_name: Specifies the name of a custom scale for the channel. If you want the channel to use a custom scale, specify the name of the custom scale in this input and set units to FROM_CUSTOM_SCALE. (Optional)