Popping sound when disabling output from sine tone generator (AD9833)

Hello, I am building a project which needs playing sine waves in an accurate timely manner. I am using the AD9833 chip to generate the tones and using this library to control it GitHub - Billwilliams1952/AD9833-Library-Arduino: Library to control the AD9833 waveform generator

I am using this schematic but instead of wiring the OUT to A0, I connected it to a headphone through a 2.2uF capacitor to remove DC offset.

The 32 ohm represent the headpones and the signal generator is the OUT of the AD9833

circuit

Signal looks very clean either when turning on or turning off on an oscilloscope but there is a hearable click/pop noise only when turning off the sound (gen.EnableOutput(false))

#include <AD9833.h>
#define FNC_PIN 10
AD9833 gen(FNC_PIN);       // Defaults to 25MHz internal reference frequency

void setup() {
  Serial.begin(115200);
  gen.Begin();
  gen.ApplySignal(SINE_WAVE, REG0, 8000);
}

void loop() {
    gen.EnableOutput(true); 
    delay(1000);
    gen.EnableOutput(false);
    delay(1000);
}

Any suggestions how to remove it? I tried placing a resistor in parallel with the speaker but didn't help. Tried (220, 1K and 10K ohms)

1 Like

Yes you need to mute it before turning it off. I am not sure if that function is in the library or not. You can also put a transmission gate (analog switch) in the audio line with a simple pull down resistor. Many times inputs are simply shorted but without information on the generator I cannot be sure it will not damage it. Thanks for the schematic it helps better then a page explaining your project. Good Job!

May you explain what difference does it make "muting" it before disabling it? The analog switch will still open the circuit and acts as if it was disabled. I believe it happens because muting/disabling it quickly makes the voltage jump from a value to instant 0 creating this pop. I am not sure though

If you disable the clock the DAC output remains unchanged, so you should not hear a click/pop.
// Enable / Disable Internal Clock
gen.EnableInternalClock ( false );

Don't use EnableOutput

I found a function named DisableInternalClock which I think is the one you are referring to. However, with trying it, the popping is much worse. Like 5x worse.
Same results achieved with sleep functions

gen.SleepMode(true);
gen.SleepMode(false)

The documentation shows EnableInternalClock but you are right the actual funcion in the code is DisableInternalClock.

So if you do DisableInternalClock (true) you still hear a pop?

Yep, much worse

void setup() {
  Serial.begin(115200);
  gen.Begin();
  gen.ApplySignal(SINE_WAVE, REG0, 8000);
  gen.EnableOutput(true); 
}

void loop() {
    gen.EnableInternalClock(true);
    delay(1000);
    gen.EnableInternalClock(false);
    delay(1000);
}

You mean DisableInternalClock() correct?

I don't have AD9833 so I can't confirm your findings.
Hopefully someone who has one will see your post.

Ah yes, my bad

void loop() {
    gen.DisableInternalClock(true);
    delay(1000);
    gen.DisableInternalClock(false);
    delay(1000);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.