Hi everyone,
I’m working on a Teensy 4.1 audio project using the Teensy Audio Shield (SGTL5000) and a PAM8403 amplifier. The system plays audio from an SD card, but I’m consistently getting noisy output on the speaker connected via the PAM8403.
Below are my details and tests:
Hardware Details:
Microcontroller: Teensy 4.1
Audio Shield: SGTL5000-based Teensy Audio Shield
Amplifier: PAM8403, single-channel (right channel only connected).
Speaker: (Add details: e.g., 4-ohm, 3W, etc.)
Connections:
Teensy 4.1 and Audio Shield: Standard I2S connections.
LRCLK: Pin 20
BCLK: Pin 21
DIN: Pin 7
MCLK: Pin 23
PAM8403 Amplifier:
Input Signal: Right channel from Teensy Audio Shield (R pin).
Input Ground: GND of Audio Shield.
Power: 5V power supply GND with Teensy and Audio Shield).
Speaker: Connected to PAM8403 output pins.
Why does the PAM8403 produce noise while the other setups are clear?
Is there a way to improve the PAM8403’s performance with the Teensy Audio Shield?
Any recommendations for alternative amplifier setups or optimizations?
I’m working on a Teensy 4.1 audio project using the Teensy Audio Shield (SGTL5000) and a PAM8403 amplifier. The system plays audio from an SD card, but I’m consistently getting noisy output on the speaker connected via the PAM8403.
Below are my details and tests:
Hardware Details:
Microcontroller: Teensy 4.1
Audio Shield: SGTL5000-based Teensy Audio Shield
Amplifier: PAM8403, single-channel (right channel only connected).
Speaker: (Add details: e.g., 4-ohm, 3W, etc.)
Connections:
Teensy 4.1 and Audio Shield: Standard I2S connections.
LRCLK: Pin 20
BCLK: Pin 21
DIN: Pin 7
MCLK: Pin 23
PAM8403 Amplifier:
Input Signal: Right channel from Teensy Audio Shield (R pin).
Input Ground: GND of Audio Shield.
Power: 5V power supply GND with Teensy and Audio Shield).
Speaker: Connected to PAM8403 output pins.
Why does the PAM8403 produce noise while the other setups are clear?
Is there a way to improve the PAM8403’s performance with the Teensy Audio Shield?
Any recommendations for alternative amplifier setups or optimizations?
C:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlaySdWav playSdWav1; // xy=69,177
AudioFilterStateVariable filter1; // xy=309,92
AudioFilterStateVariable filter2; // xy=312,257
AudioMixer4 mixer2; // xy=584,261
AudioMixer4 mixer1; // xy=602,114
AudioAnalyzePeak peak1; // xy=810,386
AudioAnalyzePeak peak2; // xy=836,450
AudioOutputI2S i2s1; // xy=899,223
AudioConnection patchCord1(playSdWav1, 0, filter1, 0);
AudioConnection patchCord2(playSdWav1, 1, filter2, 0);
AudioConnection patchCord3(filter1, 0, mixer1, 0);
AudioConnection patchCord4(filter1, 1, mixer1, 1);
AudioConnection patchCord5(filter1, 2, mixer1, 2);
AudioConnection patchCord6(filter2, 0, mixer2, 0);
AudioConnection patchCord7(filter2, 1, mixer2, 1);
AudioConnection patchCord8(filter2, 2, mixer2, 2);
AudioConnection patchCord9(mixer2, 0, i2s1, 1);
AudioConnection patchCord10(mixer2, peak2);
AudioConnection patchCord11(mixer1, 0, i2s1, 0);
AudioConnection patchCord12(mixer1, peak1);
AudioControlSGTL5000 sgtl5000_1; // xy=539,383
// GUItool: end automatically generated code
#define SDCARD_CS_PIN BUILTIN_SDCARD
void setup() {
Serial.begin(9600);
delay(200);
Wire.begin();
delay(200);
AudioMemory(8);
delay(200);
sgtl5000_1.enable();
delay(200);
sgtl5000_1.volume(1);
sgtl5000_1.dacVolume(1);
delay(1000);
while (!Serial && millis() < 3000);
delay(200);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
mixer1.gain(0, 1);
mixer2.gain(0, 1);
pinMode(13, OUTPUT);
}
void loop() {
playSdWav1.play("SDTEST1.WAV");
while (playSdWav1.isPlaying()) {
// Additional tasks can be performed here
}
delay(500);
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
}