Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Connecting to amp through DAC

Hybrid View

  1. #1
    Member
    Join Date
    Apr 2019
    Location
    UK
    Posts
    26

    Connecting to amp through DAC

    Please can someone help with this? I have searched this forum and the web, but find very little about using the Teensy audio capability with speakers.

    I've got my Teensy 3.2 + audio board happily playing the SDTEST.WAV files, or my own .WAV file, from the SD card, and I can listen via the headphone jack.
    However, I can't seem to persuade it to output anything to my amp via the DAC output. There is some hiss from the speaker, but no signal.

    Hardware:
    Teensy 3.2
    Audio board
    Adafruit PAM8302A
    8ohm Visaton speaker (what I happened to have)

    I have connected A+ on the amp to A14/DAC, and A- to GND.
    I am powering both from 4AA LiFe batteries via a Polulu step-down 5V regulator.
    GND is common throughout.

    Code:
    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    AudioPlaySdWav           playWav1;     
    AudioOutputAnalog        dac1;           
    AudioConnection          patchCord1(playWav1, 0, dac1, 0);
    AudioControlSGTL5000     sgtl5000_1;     
    
    #define SDCARD_CS_PIN    10
    #define SDCARD_MOSI_PIN  7
    #define SDCARD_SCK_PIN   14
    
    void setup() {
      Serial.begin(9600);
    
      AudioMemory(8);
    
      sgtl5000_1.enable();
      sgtl5000_1.volume(0.4);
    
      SPI.setMOSI(SDCARD_MOSI_PIN);
      SPI.setSCK(SDCARD_SCK_PIN);
      if (!(SD.begin(SDCARD_CS_PIN))) {
        while (1) {
          Serial.println("Unable to access the SD card");
          delay(500);
        }
      }
    }
    
    void playFile(const char *filename)
    {
    //  Serial.print("Playing file: ");
    //  Serial.println(filename);
    
      playWav1.play(filename);
    
      // A brief delay for the library read WAV info
      delay(5);
    
      while (playWav1.isPlaying()) {
      }
    }
    
    void loop() {
      playFile("LAPWING.WAV");  
      while(true); 
      }

  2. #2
    Member
    Join Date
    Apr 2019
    Location
    UK
    Posts
    26
    Update:
    I've moved the GND and A- connections on the AMP to AGND on the Teensy. This made a kind of sense. It has cut out the background hiss, and the speaker still clicks at power up, but still no signal.

  3. #3
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,110
    Why are you connecting to the Teensy if you have an audio board?

    Use a line out and ground from the audio connector pins from the audio board.

  4. #4
    Member
    Join Date
    Apr 2019
    Location
    UK
    Posts
    26
    Ahhhh, thanks so much. I misunderstood: I thought the line-out was digital. Working fine now.

    This project has a serious conservation potential for engdangered wading birds, so I was keen to get it up and running during the next few days. I hope that is a plus for you too?!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •