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:
Setup with just Teensy showing DAC output
Top trace is 'AudioIn' on propsheild. Bottom trace is audio out from propshield.
Data capture from DSO showing propshield AudioIN
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
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);
};
Setup with just Teensy showing DAC output
Top trace is 'AudioIn' on propsheild. Bottom trace is audio out from propshield.
Data capture from DSO showing propshield AudioIN
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