Teensy 4.1 w/ Electret Microphone & Audio Shield

trevtt

Member
I've been working on a project that needs to record audio and I decided to go with the hardware described above. I've connected the shield with header pins and connected an electret microphone to the MIC & GND pads on the Teensy 4.x Audio Shield.

I've read through the documentation on the Audio System Design Tool, but haven't found any documentation for connecting electret microphones to these pins as was done in the audio tutorial workshop. I tried following the tutorial with no success. The peak meter doesn't work, the FFT example doesn't work, and I haven't even heard anything but static from the headphone jack despite trying many audio system design tool setups and hardware tests.

Any ideas, experiences, or thoughts would be welcome. Thanks!
 
Trevtt,

I'm a newby with this thing as well. The shield has two pins for the Mic, look at the Audio adapter in this link.... https://www.pjrc.com/store/teensy3_audio.html

The MIC two pins one is connected to the case (traces), which per my experience is the ground pin, and should be connected to the ground thru-hole. the other pin is for the other mic pin.

audio_shield.jpg


Good luck,
Frank
 
Hi Frank,

Sorry, I guess my wording was wrong -- I've connected the mic to those through-hole pins, NOT to any pins. Still no signal to the teensy for some reason.

Thanks for the help though!
 
I've been working on a project that needs to record audio and I decided to go with the hardware described above. I've connected the shield with header pins and connected an electret microphone to the MIC & GND pads on the Teensy 4.x Audio Shield.

I've read through the documentation on the Audio System Design Tool, but haven't found any documentation for connecting electret microphones to these pins as was done in the audio tutorial workshop. I tried following the tutorial with no success. The peak meter doesn't work, the FFT example doesn't work, and I haven't even heard anything but static from the headphone jack despite trying many audio system design tool setups and hardware tests.

Any ideas, experiences, or thoughts would be welcome. Thanks!

Sorry I do not do much with Audio, but wondering which sketches you are trying? For examplePeakMeterMono.ino

Which has:
Code:
AudioInputAnalog         adc1;           //xy=164,95
AudioAnalyzePeak         peak1;          //xy=317,123
AudioConnection          patchCord1(adc1, peak1);

I believe that AudioInputAnalog defaults to pin A2(16)

Now if you are using the microphone on the Audio board, I believe it is connected to the SGTL5000 object
And that you control using it by using the inputSelect method on that object to select either line input or the Microphone.

Code:
// Advanced Microcontroller-based Audio Workshop
//
// http://www.pjrc.com/store/audio_tutorial_kit.html
// https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
// 
// Part 2-4: Using The Microphone


///////////////////////////////////
// copy the Design Tool code here
///////////////////////////////////
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=142,326
AudioOutputI2S           i2s2;           //xy=418,313
AudioConnection          patchCord1(i2s1, 0, i2s2, 0);
AudioConnection          patchCord2(i2s1, 0, i2s2, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=559,419
// GUItool: end automatically generated code




void setup() {
  Serial.begin(9600);
  AudioMemory(8);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);
  sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  sgtl5000_1.micGain(36);
  delay(1000);
}

void loop() {
  // do nothing
}
 
Thanks for the response! My microphone is connected directly to the board, and I tried running the code you attached -- still no output to a pair of headphones.

Feeling rather stuck, although i do have one lead -- the GND through hole between the 3V and 5V holes on the teensy does not appear to be grounding properly. When I use the GND through hole on the other side of the board (the GND next to pin 0), the circuit does appear to ground properly with the 3 & 5V power sources. Any ideas there?

Thanks again.
 
Trevtt,

The headphone ground is a VIRTUAL ground (on the audio shield) and should NOT be connected to anything else. So it IS going to be odd.

I've loaded KurtE's code and it works great. I've boosted the gain to 56, and yes, definitively louder...

I'm thinking that you may have the microphone installed backwards maybe, since it is a device that requires bias.

The side that has traces going to the shell, should be to connected to ground.
 
KurtE,

The trouble I'm having is learning where all of the commands are...LOL

I'll get there... Thanks!!!!

Best,
Frank
 
Hi trevtt,
If the exemples program don't even work, it's most probably an hardware problem,
Most of the time in electret mic you also have to connect the enclosure of the mic to the ground, otherwise it can lead to big disturbance in the sound quality (or even no sound at all), I was trick by it already.
Make sure to double check that :)
IMG_20220731_104437.jpg
 
Thanks for the help everyone,

I agree it seems to me like a hardware problem. I definitely have the mic wired correctly with GND connected to the shell of the mic, and the other wire connected to MIC. In other news, I have purchased the SPH0645 mic and connected it according to this specification. Still no sound at all.

I am completely stumped. Any ideas?

EDIT: I tested the 'FFT' sample file and the synthesized sine wave works, so at least I know my teensy isn't completely broken. Also hope the image below helps.

Image 3.jpeg
 
Last edited:
In a closer look maybe poor solder joints on pins 19-23? Out of habit, I usually make sure that my solder flows and I'll check the other side to make sure solder made it through the 'through hole'. I would just resolder the whole thing, and make sure I do not heat it up too much, but enough to get the job done. I solder even unused pins.... but hey, that's just me.
 
I had the same problem with an electret microphone connected to the Teensy 4 with Audio Shield.
I used the example Part 2-4 Microphone check which is mentioned by KurtE above.
After measuring with osci and studying the SGTL5000 data sheet I found out that additionally the DAC had to be linked to the headphones :

Code:
sgtl5000_1.headphoneSelect(AUDIO_HEADPHONE_DAC);

After adding this to the example code and adjusting the MicGain() my microphone worked fine :)

Btw.:
SELECT_HP is documented in CHIP_ANA_CTRL (0x0024) on page 38 of the SGTL manual and 'control_sgtl5000.cpp' of the audio library wrong obviously.
DAC = 0, LINEIN = 1 there, but in 'control_sgtl5000.h' the headphoneSelect() function is implemented vice versa and is working fine as it is.
 
Last edited:
Back
Top