ESP32 DAC

The ESP32 DAC platform allows you to output analog voltages using the 8-bit digital-to-analog converter of the ESP32. Unlike the ESP32 LEDC Output, which can simulate an analog signal by using a fast switching frequency, the hardware DAC can output a real analog signal with no need for additional filtering.

The DAC spans across two pins, each on its own channel: GPIO25 (Channel 1) and GPIO26 (Channel 2).

The output level is a percentage of the board supply voltage (VDD_A) - generally this will be 3.3V.

# Example configuration entry
output:
  - platform: esp32_dac
    pin: GPIO25
    id: dac_output

# Example usage
on_...:
  then:
    - output.set_level:
        id: dac_output
        level: 50%

Configuration variables:

  • pin (Required, Pin Schema): The pin to use DAC on. Only GPIO25 and GPIO26 are supported.

  • id (Required, ID): The id to use for this output component.

  • All other options from Output.

Use Cases

  • Generating a specific (and dynamic) reference voltage for an external sensor or ADC, such as the ADS1115 Sensor

  • Controlling the bias of a transistor

  • Driving a bar graph or large amount of LEDs using an analog-controlled LED driver like the LM3914 (datasheet); this can allow you to make tank level indicators, temperature gauges, and so on from a single output pin