Output - ESP32 DAC

ESP32 and ESP32-S2 Digital Analog Converter (DAC)

Plugin details

Type: Output

Name: ESP32 DAC

Status: NORMAL

GitHub: P152_DAC.ino

Maintainer: tonhuisman

Used libraries: .

Description

Plugin for using the built-in DAC (Digital Analog Converter) as available on ESP32 and ESP32-S2 chips. This implies that the plugin is only available on ESP32 and ESP32-S2 builds!

Configuration

Device configuration
  • Name A unique name should be entered here.

  • Enabled The device can be disabled or enabled. When not enabled the device should not use any resources.

Device Settings

  • Analog Output: Select 1 of 2 available GPIO pins that support the DAC feature.

ESP32:

../_images/P152_AnalogOutputOptionsESP32.png
  • DAC1 / GPIO-25: First available DAC output pin.

  • DAC2 / GPIO-26: Second available DAC output pin.

ESP32-S2:

../_images/P152_AnalogOutputOptionsESP32S2.png
  • DAC1 / GPIO-17: First available DAC output pin.

  • DAC2 / GPIO-18: Second available DAC output pin.

Commands

Command Syntax

Extra information

dac,<id>,<value>
<id>: Select DAC1 (1) or DAC2 (2).
<value>: Range: 0 .. 255.

Set an analog level on the addressed DAC output. The actual voltage available on the pin is: (VCC / 255) * value.

The used <id> has to match with the configured DAC/GPIO for this task.

If you have 2 ESP32 DAC tasks configured, for the 2 available DAC pins, then the command doesn’t have to be prepended with the taskname, as only the matching task will accept the command.

Extra events

Despite that the plugin doesn’t allow configuring explicit Values, there is a single value available: <taskname>#Output, and this is also generated as an event, using the default Interval. This variable and event show the last set value of the dac command, above.

Change log

Changed in version 2.0: added 2023-04-10 Initially added.