Can't get Audio Shield to work

Status
Not open for further replies.

KrisKasprzak

Well-known member
I just got my audio shield and physically soldered to to my Teensy 3.2 (teensy is on top of the shield).

I have a mic connected to line in and using the attached sketch, peak1 always returns 0. I would expect something while i'm tapping the mic.

I'm using a shotgun style mic that is battery powered.

Any thoughts?

Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=250,88
AudioAnalyzePeak         peak1;          //xy=647,224
AudioAnalyzePeak         peak2;          //xy=648,170
AudioAnalyzeToneDetect   tone1;          //xy=662,309
AudioAnalyzeToneDetect   tone2;          //xy=667,396
AudioConnection          patchCord1(i2s1, 0, peak2, 0);
AudioConnection          patchCord2(i2s1, 0, tone1, 0);
AudioConnection          patchCord3(i2s1, 1, peak1, 0);
AudioConnection          patchCord4(i2s1, 1, tone2, 0);
// GUItool: end automatically generated code







void setup() {
  AudioMemory(4);
  Serial.begin(9600);
}

// for best effect make your terminal/monitor a minimum of 31 chars wide and as high as you can.



void loop() {

  if (peak1.available()) {

    Serial.println( peak1.read());

  }

}
 
this works so board is at least working....

Code:
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
#include <SerialFlash.h>

AudioSynthWaveform    waveform1;
AudioOutputI2S        i2s1;
AudioConnection       patchCord1(waveform1, 0, i2s1, 0);
AudioConnection       patchCord2(waveform1, 0, i2s1, 1);
AudioControlSGTL5000  sgtl5000_1;

void setup() {
  AudioMemory(10);

  Serial.begin(115200);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.3);
  waveform1.begin(WAVEFORM_SINE);
  delay(1000);

}


void loop() {


  waveform1.amplitude(0.4);

  for (int i = 20; i < 1200; i++) {
    waveform1.frequency(i);
    delay(1);
  }
}
 
A microphone's signal is way too small for line input unless the mic has a built-in preamp.
The audio board has a connection for a microphone on the edge opposite the SD card. The pins are labelled MIC and GND.

You will need to add this after the last AudioConnection:
Code:
AudioControlSGTL5000     sgtl5000_1;

and add these at the end of the setup() function:
Code:
  sgtl5000_1.enable();
  sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  // micgain for the MEMS microphone with 67dB preamp should be zero
  // micgain for my Sony microphone with no preamp should be 26-30
  sgtl5000_1.micGain(26);
  sgtl5000_1.volume(0.6);

Pete
 
Status
Not open for further replies.
Back
Top