ESP32 DAC output is noisy or buzzes: pins 25 and 26, filtering and amplifier

The classic ESP32 has two 8-bit DACs, on GPIO 25 and 26. Add a filter and an amplifier, and do not drive a speaker directly.

What the message means

An 8-bit output is coarse and the pin has little current. Wi-Fi activity also adds noise through the supply.

Fix it in this order

  1. Use GPIO 25 or 26 on the classic ESP32. Other chips may have no DAC.
  2. Add a capacitor in series for AC coupling, and a small RC low-pass filter.
  3. Use a small amplifier module to drive the speaker.
  4. Keep the supply clean and add a capacitor near the board.
  5. Turn Wi-Fi off while you test audio quality.
  6. Use an I2S DAC module for better quality.

Why it happens

The classic ESP32 has two 8-bit DAC channels on GPIO 25 and 26, giving 256 output levels between ground and about 3.3 V. That is coarse for audio and the pin cannot drive a speaker, so the signal needs a coupling capacitor to remove the DC level, a filter and an amplifier. The ESP32-S2 has DACs on different pins, and models such as the S3 and C3 have no DAC at all.

Wi-Fi bursts draw current in pulses that ripple the supply, and the ripple appears in the output as a buzz. An I2S DAC chip has higher resolution and its own reference, which is why it sounds cleaner.

If you see this, do this

You seeDo this
Buzz that changes with Wi-FiSupply noise.
Very quiet outputAdd an amplifier.

buzzer no tone, input-only pins.

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.

Why this happens

The DAC on GPIO 25 and 26 turns an 8-bit number from 0 to 255 into a voltage between 0 and about 3.3 V. That gives steps of roughly 3.3 / 255 = 13 mV. For audio, steps that large add a hiss of quantisation noise, and the output has no filter, so the sharp steps carry high-frequency content that can sound harsh.

The pin also supplies very little current. A speaker connected directly loads it down and distorts the signal, and the output carries a steady DC level that a speaker should not receive. The result can be quiet, buzzing sound. Noise from Wi-Fi bursts on the supply adds a buzz that follows the radio activity.

How to confirm the cause

  • Output a steady value with dacWrite and measure it with a multimeter. A value of 128 should read about half of 3.3 V.
  • Look at the output on an oscilloscope, if you have one, to see the steps in a sine wave.
  • Turn Wi-Fi off and run the tone again. If the buzz goes, the supply or radio activity is the source.
  • Power the board from a different supply or add a larger capacitor near the 3.3 V pin and see if the buzz changes.
  • Connect through a capacitor to an amplifier module instead of a speaker and compare.

Worked example

This test writes a ramp on GPIO 25. 256 steps at 40 microseconds is about 10 ms, so the repeat rate is close to 100 Hz in practice (the loop overhead adds slightly). A filter of 1 kohm and 100 nF has a cut-off at 1 / (2 x pi x 1000 x 0.0000001), about 1591 Hz.

void setup() {}
void loop() {
  for (int i = 0; i < 256; i++) {
    dacWrite(25, i);
    delayMicroseconds(40);
  }
}

// AC coupling: 10 uF into a 10 kohm load
// cut-off = 1 / (2 x pi x 10000 x 0.00001) = about 1.6 Hz

Common mistakes

  • Connecting a speaker straight to the pin.
  • Using GPIO 25 or 26 on an ESP32 variant that has a DAC on other pins or none.
  • Passing the DC level to the amplifier without a coupling capacitor.
  • Expecting 8 bits to sound like a music player.
  • Running Wi-Fi at full activity while testing audio.

If this did not fix it

  • Ground loops between the board, the amplifier and the USB power source.
  • The amplifier’s own gain and noise, which can add more than the DAC does.
  • A move to an I2S DAC module if you need clean output.