PropShield Audio Amplifier Output Issues

paynterf

Well-known member
I'm trying to use a Teensy 3.2 PropShield (the model with motion sensors) to amplify the output from the Teensy's DAC. I used the code from this post (plus the AudioMemory(20) command suggested by Paul) to produce a 440Hz sinewave from the DAC. However, when I used the PropShield, the output from the speaker terminals (connected to 5-ohm resistive load) is anything BUT pretty (see attached images). As you can see from the code, I changed the 'sin.amplitude' around a bit to see if that was the problem, but although I could indeed change the amplitude at AudioIN, that didn't materially change the output. Here's the code:

Code:
/*
    Name:       DAC_SineWave.ino
    Created:    3/12/2024 8:31:37 PM
    Author:     FRANKNEWXPS15\Frank
*/
#include <Audio.h>

AudioSynthWaveformSine   sine;
AudioAmplifier           amp;
AudioOutputAnalog        dac;
AudioConnection          patchCord1(sine, amp);
AudioConnection          patchCord2(amp, dac);

void setup() {
  AudioMemory(20);
  dac.analogReference(EXTERNAL);
  delay(50);
  pinMode(5, OUTPUT);
  digitalWrite(5, HIGH);
  delay(10);


  amp.gain(1.0);

  sine.frequency(440.0);
  //sine.amplitude(1.0); //1.0 is max
  sine.amplitude(0.5);//half amplitude
  //sine.amplitude(0.01);//one-tenth amplitude
  sine.phase(0.0);
};

void loop()
{
  //sine.amplitude(1.0); //max amplitude
  //delay(1000);
  //sine.amplitude(0); //OFF
  //delay(1500);
};

IMG_4974.JPG

Setup with just Teensy showing DAC output


240314_DAC_SinewaveAmp5Ohm.png

Top trace is 'AudioIn' on propsheild. Bottom trace is audio out from propshield.


240314_DAC_SinewaveNoAmp.jpg

Data capture from DSO showing propshield AudioIN

IMG_4976.JPG


Photo of Teensy 3.2 with propshield attached. Note soldered flying leads on Audio GND and Audio IN.

Anyone have any ideas what I'm doing wrong here?

TIA,

Frank
 
How does it sound if you connect a speaker?

What do you measure if you just use the + and - from the speaker out? Connecting the "-" of the speaker out of the class d amplifier to any other ground can mess it up.
 
Hmm, it actually sounds OK. I changed the freq to 1000Hz, (as I am familiar with that tone) and connected it to an old 2-1/4" 8-Ohm speaker. Has a bit of a beat note, maybe 20-30Hz? but otherwise OK.

I tried using my Hamnatek DSO1102 digital scope to look at both the '+' and '-' outputs wrt Analog GND and then do a CH1-CH2 math operation, but that output looked terrible as well. Here's the scope capture from that experiment.

Any way to verify (other than audibly) that the output looks like the input? I guess I could connect up a microphone and look at it's output?

Frank
 

Attachments

  • 2024-03-14 19_24_31_868.png
    2024-03-14 19_24_31_868.png
    15.5 KB · Views: 5
Paul,

Thanks for the clarification - I know about Class D amps, but just didn't realize that was what was being used on the propshield. Yeah, I know, RTFM ;)
 
Got my new Sparkfun Analog MEMS microphone hooked up so I could look at the speaker output. After some diddling I settled on sine.amplitude(0.5) on the Teensy 3.2 with the mic just over the surface of the speaker. This produced a not-quite clipped output, as shown in the following photo:
IMG_4978_Web.JPG
 
Back
Top