Skip to main content
Read analog-to-digital converter (ADC) values from your box. Supports LabJack T7, LabJack U3 and MCC USB-202 hardware with per-hardware channel naming and voltage ranges.

Syntax

Arguments

Options

Usage

Read ADC Value

Read voltage from an ADC net:
Output:
The result is returned in volts with 6 decimal places.

List ADC Nets

When invoked without a net name (and no default is set), lists all available ADC nets:
Output:

Supported Hardware

Hardware Comparison

LabJack U3

The U3 uses a different driver stack from the T7: the LabJack Exodriver and LabJackPython. The two families can share one Lager Box.
  • The ranges above are LabJack’s figures for a U3-HV. On a U3-HV, AIN0-AIN3 are fixed high-voltage inputs.
  • AIN4-AIN7 are the same physical pins as FIO4-FIO7, and AIN8-AIN15 are the same pins as EIO0-EIO7. An adc read sets the pin to analog mode, and a gpio read or write on the same pin sets it back to digital mode.
  • AIN8-AIN15 are on the DB15 connector of the U3.
  • Lager treats every U3 as a U3-HV, because a U3-LV reports the same USB product ID.

Channel Naming

When you create an ADC net, use a channel name that lager instruments lists for the instrument. lager nets add refuses any other value, including a numeric shorthand such as 0, and prints the valid channels. LabJack T7: AIN0-AIN13
LabJack U3: AIN0-AIN15
MCC USB-202: CH0-CH7

Instrument Name Matching

The backend driver is selected based on the instrument name in the net configuration:

Default Net

Set a default ADC net to avoid specifying the name each time:
Then:

Examples

Scripting Example

Notes

  • Results are returned in volts with 6 decimal places
  • The LabJack T7 and the USB-202 support bipolar measurement (+/-10 V range)
  • On a LabJack U3, only AIN0-AIN3 of a U3-HV are bipolar
  • ADC nets must be configured before use with lager nets add <name> adc <channel> <address>
  • Default net can be set with lager defaults add --adc-net
  • LabJack T7 shares a connection handle with DAC, GPIO, and SPI operations on the same device
  • USB-202 opens and closes the connection on each read
  • Use lager instruments --box <box> to verify the ADC device is detected

See Also

  • DAC — Digital-to-analog converter output (the complement of ADC)
  • Python ADC API — Read ADC values in Python scripts