ElectronicZoologyfield notes from the garage
← Back to PAM8403 guide
128 0 - 255 DAC 0 - 3.3V
ESP32 Feature

DAC

Digital-to-Analogue Converter

A DAC converts a digital number (0-255) into an analogue voltage (0-3.3V). The ESP32 has two: GPIO25 (DAC1) and GPIO26 (DAC2).

Audio works by writing thousands of sample values per second - each number sets an exact voltage level, and the rapid succession of levels forms a waveform that the amplifier drives into the speaker.

Key details

  • GPIO25 -> DAC1 (used in PAM8403 guide)
  • GPIO26 -> DAC2
  • 8-bit resolution: 0 = 0V, 128 = 1.65V, 255 = 3.3V
  • dacWrite(25, value) - sets output instantly
  • 8kHz sample rate = 8000 writes per second