Skip to main content
Read analog-to-digital converter (ADC) values from your gateway.

Syntax

lager adc [NET] [OPTIONS]

Arguments

ArgumentDescription
NETName of the ADC net to read (optional if default is set)

Options

OptionDescription
--box TEXTLagerbox name or IP address
--helpShow help message and exit

Usage

Read ADC Value

Read voltage from an ADC net:
lager adc SENSOR_1 --box my-lager-box
Output:
2.45
The result is returned in volts.

List ADC Nets

When invoked without a net name (and no default is set), lists all available ADC nets:
lager adc --box my-lager-box
Output:
Name          Net Type  Instrument  Channel  Address
================================================================
VOLTAGE_SENSOR adc      LabJack_T7  AIN0     USB::470026574
TEMP_SENSOR    adc      LabJack_T7  AIN1     USB::470026574
CURRENT_MON    adc      LabJack_T7  AIN2     USB::470026574

Examples

# Read ADC value from voltage sensor
lager adc VOLTAGE_SENSOR --box my-lager-box

# Read ADC value from temperature sensor
lager adc TEMP_SENSOR --box my-lager-box

# Read ADC value from current monitor
lager adc CURRENT_MONITOR --box my-lager-box

# List all ADC nets on the Lager Box
lager adc --box my-lager-box

# Use default net (if configured)
lager adc

Scripting Example

Use ADC readings in shell scripts:
#!/bin/bash
# Read sensor and check threshold
VOLTAGE=$(lager adc VOLTAGE_SENSOR --box my-lager-box)
if (( $(echo "$VOLTAGE > 3.0" | bc -l) )); then
    echo "Voltage too high: $VOLTAGE V"
    exit 1
fi
echo "Voltage OK: $VOLTAGE V"

Supported Hardware

ManufacturerModelDescription
LabJackT7Multi-channel ADC (AIN0-AIN13)

Notes

  • Results are returned in volts
  • ADC nets must be configured before use with lager nets create <name> adc <channel> <address>
  • Default net can be set with lager defaults add --adc-net
  • Pin names depend on the hardware (e.g., AIN0, AIN1 for LabJack)
  • Use this for monitoring analog signals like voltage, current, and temperature sensors