> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lagerdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DAC

> Control DAC output on box

Control DAC (Digital-to-Analog Converter) output on your device. The DAC command sets a precise analog voltage on a DAC net, useful for generating reference voltages, bias signals, or test stimuli.

## Syntax

```bash theme={null}
lager dac [OPTIONS] NET [VOLTAGE]
```

## Global Options

| Option | Description |
| - | - |
| `--box TEXT` | Lager Box name or IP address |
| `--json` | Emit a machine-readable JSON object instead of formatted text |
| `--help` | Show help message and exit |

## Arguments

* `NET` - Name of the DAC Net to control
* `VOLTAGE` - Voltage value in volts to output

## Supported Hardware

| Manufacturer | Model | Channels | Output Range | Resolution |
| - | - | - | - | - |
| LabJack | T7 | 2 (DAC0-DAC1) | 0 to 5 V | 16-bit |
| LabJack | U3 | 2 (DAC0-DAC1) | 0.04 to 4.95 V | |
| Measurement Computing | USB-202 | 2 (DAC0-DAC1) | 0 to 5 V | 12-bit |

The CLI accepts values from 0 to 5 V, the widest of these ranges. The box then checks the range of the net's instrument and refuses a value outside it.

### LabJack U3

* The output range is 0.04 V to 4.95 V, not 0 V to 5 V. The box refuses a value outside that range and does not clamp it. You cannot set a U3 DAC to 0 V.
* A U3 has no DAC readback. `lager dac NET` without a voltage returns the last value that the box set on that net.
* If the box has no value to report, the read fails with a `has no readback` error. This happens, for example, after a `lager python` script ran. Set a value first.

### Channel Naming

When you create a DAC net, use a channel name that `lager instruments` lists for the instrument:

**LabJack T7:** `DAC0`, `DAC1`

**LabJack U3:** `DAC0`, `DAC1`

**MCC USB-202:** `DAC0`, `DAC1`

## Read the Output

Omit the voltage to read the output value of the net:

```bash theme={null}
lager dac VOLTAGE_OUTPUT --box my-lager-box
```

The MCC USB-202 does not support readback, so a read on a USB-202 net fails.

## Default Net

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

```bash theme={null}
lager defaults add --dac-net VOLTAGE_OUTPUT
```

Then:

```bash theme={null}
lager dac 3.3
```

## Examples

```bash theme={null}
# Set DAC output to 3.3V
lager dac VOLTAGE_OUTPUT 3.3 --box my-lager-box

# Set DAC output to 5.0V
lager dac POWER_RAIL 5.0 --box my-lager-box

# Set DAC output to 1.8V
lager dac REFERENCE_VOLTAGE 1.8 --box my-lager-box

# Set DAC output to 0V
lager dac SIGNAL_GENERATOR 0.0 --box my-lager-box
```

## Troubleshooting

| Issue | Cause | Fix |
| - | - | - |
| Output stuck at 0V | Net not configured or wrong channel | Verify net configuration with `lager nets --box <box>` |
| Voltage inaccurate | Resolution limit or load effects | LabJack T7 and USB-202 output 0-5V, and LabJack U3 outputs 0.04-4.95V; verify your circuit doesn't draw too much current from the DAC output |
| "outside the LabJack UD DAC range" | The value is below 0.04 V or above 4.95 V on a LabJack U3 | Send a value from 0.04 V to 4.95 V |
| "Net not found" | Typo or net not created | Check available nets with `lager nets --box <box>`. Net names are case-sensitive. |

## Notes

* Net names (e.g., `VOLTAGE_OUTPUT`, `POWER_RAIL`) refer to names assigned when setting up your testbed
* Voltage values are specified in volts
* Only works with nets of type `dac`
* Ensure the target box has DAC nets properly configured
* DAC outputs provide precise voltage control for analog circuits
* LabJack T7 and USB-202 output 0-5V. LabJack U3 outputs 0.04-4.95V.

## See Also

* [ADC](/source/reference/cli/adc) -- Analog-to-digital converter input (the complement of DAC)
* [Python DAC API](/source/reference/python/dac) -- Set DAC output in Python scripts


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.