Teensy Microphone Module

That code formatting is ugly! I just cut and pasted from the Arduino sketch. Is there a better way to do that and preserve indentation???

Also - pin connections are: 3.3V, AGND and A3 (in this example). I'm assuming any analog input will work.

Note the "AudioInputAnalog adc1(A3);" statement.
 
Last edited:
Yes - on advanced the # / hashtag gives the HTML wrapper for [C0DE] // CODE here with upper case O not a Zero [/C0DE]

That and Ctrl+T in IDE before copying.
 
I'll swap out my I2S Audio object for an ADC input. Easy-peezy, thanks to the library..
Looking forward to it!
 
Posting pics here because the don't seem to work in private messages.
Leon, these are the two pics to which I referred.
Daves Mic Test.JPG
New Mic in Audacity.jpg
 
You have 3.3V and the mic output reversed (not your fault! I don't have the silkscreen labels!!). Try the red wire to the top-most pin that goes to FB1 and the yellow wire to the pin next to the "J1" designation that goes to FB3. Also make sure that you're using the correct analog input. A2 is the default and that looks right if I'm counting the pins correctly.

Connecting 3.3V to the output should not cook the microphone circuit - that 1K ohm resistor between the output of the IC and the pin should keep anything too bad from happening.

I just realized that my pin out is backward from the Adafruit design. Actually, they flipped the connector and the microphone element to the opposite side, essentially reversing the connections. So thats is a good question - do people have a preference??? Now that I'm staring at it, I'm leaning toward copying Adafruit (and Sparkfun) and moving the connector and mic element to the other side. Please share your thoughts!

In any case, the mic should fire up just fine and what you have seems like a good test. Here is a video I took this morning after getting a real speaker system connected (not the little Bluetooth speaker I was using).

https://youtu.be/kolw5YgSxuA
 
Last edited:
Switched the power and output to this
Daves Mic Test 2.JPG
Same result so far.

I'm going to build up a new setup step by step, and report back.

If I've blown the mic by backward connection of power and output, any idea what would have blown? Can I check that?
 
Hmm. The basic voltages should be:
Pin 1 on J1 - connected to FB1 - that's the direct connection to the Teensy pin 3.3V so not much to go wrong there. There should also be 3.3V on one side of the larger cap C3

Pin 2 on J1 - should be ground

Pin 3 on J1 - connected to the zero ohm resistor in the FB3 position. This should read roughly 0.6V between pin 2 and pin 3. That is the DC offset voltage after the 1K ohm voltage dividers. If you probe R4, you should read 0.6V on the side closest to J1 (connector) and 1.2V on the side closest to the IC U1.

If you have an oscilliscope, you should be able to see the audio signal on pin 3 (with the 0.6V DC offset) and the same signal times 2X on the side of R4 next to the IC. That's the output from the chip.
 
Great News!
The mic is working very well... after I inserted a paper insulator between the electret housing and the nearest component.
All of your voltages checked out, by the way.
That said, the electret shield was bringing the circled component down to ground. I expect I bumped the mic somehow after arrival. (The shipping package would have protected anything)
Paper insulator marked.jpg

440Hz signal generator into a cheap 16 ohm speaker harvested from a radio shack device.
This is the physical setup, at this point checking the new mic. (move the yellow wire to check AdaFruit or SparkFun.)
Mic Test Board and Speaker.JPG
Electrets from left to right:
  • SparkFun
  • AdaFruit
  • Leonid
  • Plain-Old-Electret-to-Audio-Shield

Output to Audacity through USB --> MacBook

This is the output: New Mic on the top (left channel), I2S through the bottom (right channel)
New Mic-Paper - I2S Long Strip.jpg
I'm curious about the drift in the I2S mic signal. I had not checked it before, and it was not bothering my application (FFT checking - throwing out the first few bins).

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

// GUItool: begin automatically generated code
AudioInputAnalog         adc1;           //xy=244,142
AudioInputI2S            i2s1;           //xy=244,252
AudioMixer4              mixerLeftADC;         //xy=468,161
AudioMixer4              mixerRightI2S;         //xy=467,265
AudioOutputUSB           usb1;           //xy=700,206
AudioConnection          patchCord1(adc1, 0, mixerLeftADC, 0);
AudioConnection          patchCord2(i2s1, 0, mixerRightI2S, 0);
AudioConnection          patchCord4(mixerLeftADC, 0, usb1, 0);
AudioConnection          patchCord3(mixerRightI2S, 0, usb1, 1);

AudioControlSGTL5000     sgtl5000_1;     //xy=254,198
// GUItool: end automatically generated code

#define   AUDIO_VOLUME        0.7          // 0-1.0, typical 0.5 for easy listening.  User volume control could adjust this.
#define   MIC_GAIN            50          // 0-63 dB I2SInput-->USBOutout-->Audigy, and adjusting down to eliminate clipping.  

void setup() {
    Serial.begin(9600);
    delay(500);
    Serial.print("Setup...");
    AudioMemory(20);    
    sgtl5000_1.enable();
    sgtl5000_1.volume(AUDIO_VOLUME);
    sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
    sgtl5000_1.micGain(MIC_GAIN);
    mixerLeftADC.gain(0, 1);
    mixerRightI2S.gain(0, 3);
    AudioMemoryUsageMaxReset();
    Serial.println("...Finished");
}

unsigned long startTime = millis(),
              loopCount = 0;
bool skipping = false;

void loop() {
    unsigned long runTime = millis() - startTime;
    if ((runTime % 1000) == 0) {
         if (!skipping) {
               Serial.printf("%d\t%d\n", loopCount, runTime/1000);
               skipping = true;
         }
    } else {
         skipping = false;
    }
    loopCount++;
}

Let's chat about next steps, Leon.
Great stuff!
 
Last edited:
Thank you for all your testing!! Great catch on that capacitor shorting out to the microphone element can. That essentially shorts out the mic signal!! I'll be flipping the mic to the other side for the other ones I build AND labeling the pins!!

I plan to build up a total of ten (10) of these Alpha version mics and am looking for volunteers to test them in your projects. Some basic questions I to like to answer:
1) Signal range - does the auto gain control adequately respond from quiet to loud. Does it saturate at concert levels? What do people consider loud?
2) LED noise - is it insensitive to location? Wiring length?
3) Size - I have already started modifying the design to cut down the size but how large is too large? If I can knock a few tenths of an inch off each side, would that be fine??
4) Mounting - do we need the four mounting holes or would two suffice?
5) Output shielding - ideally we'd all use shielded cable from the mic to the Teensy. Is it worth the extra space to add a separate ground pin for the output so we can separate the power return and also shield the mic output??

I'm sure there will be more questions as we go but please let me know if you're interesting in helping test these.

Thanks!

Leon
 
I'm curious about the drift in the I2S mic signal. I had not checked it before, and it was not bothering my application (FFT checking - throwing out the first few bins).

That drift looks like a low frequency signal superimposed on the 440Hz test tone. I didn't break out the calipers to measure but it looked like ~25 fast cycles for every one of the slower cycles. 17Hz??
 
I posted a message to you, Leon, but now I think others might have other responses, so... much of the same stuff here:

I'll do more testing tomorrow.

I have a big string of LEDs (150) that I can pull back out. I set it aside because I was having apparent conflict between the two interrupt-driven libraries
- Teensy Audio
- FastLED or AdaFruit

You didn't see that apparently with a short LED strip, and that makes sense... the LED libraries takes a certain amount of time to publish the serial stream of control messages. The time increases for each LED controlled. Some of the common LED technologies are time-sensitive, so they need their interrupt routine not interrupted. Same for Audio, I understand. Paul?

I could certainly see if the LEDS affect the sound output... looking for noise that is related to the LED changes, I imagine.

As for size, the board itself looks large compared to the AdaFruit, and certainly the SparkFun - though it adds value and is worth some trade-offs.
The size issue in my case has to do with the Mic being tied to the board. I insert my electret into a molded hole in a wind controller - and the board sticking out sideways from the hole would require a re-design of the unit. Not terrible, but there could be other ways... e.g. - the board is a filter/amplifier/voltage regulator, and need not be the mic itself... but rather just have two holes for the typical electret pin footprint - and perhaps a circle of space, as you have it.

Then I could mount the mic as I wish, and wire it to the board with a short pair of wires.

Mounting holes - 4 is too many, I think. Audio shield has three (do you have a Teensy Audio Shield?)
AdaFruit has 2.
SparkFun none.
Two is probably ample.

Note for Paul: the Audio shield is very cool, though larger than I'd like, and includes more technology than I need.
It's dang handy for prototyping Audio apps with mics and earbuds (or other speakers).
Its width blocks the breadboard pins, though, and that's a pain.
Perhaps looking at the 3.5/3.6 features, a smaller Audio board could be fashioned:
- no need for SD card reader, perhaps no need for memory add-on socket
- continue make easy stereo I/O for the Audio lib
 
Hi Leon,

I can help you test if you need more volunteers. I'm in the middle of a T3.6 64x32 APA102 project and was planning on using the MAX9814 Adafruit board for sound, so it should be an easy swap.

IMG_2926.jpg
 
I'm building a setup using a mic and could test one if you end up with an extra. In the end would use something smaller as it will be worn. First step with a large enough setup where I could fit something like this. It would get used then I could compare against for my sanity going smaller. It won't need hi-fidelity - but get fed to FFT for tone, and LOUD noise detection and maybe voices to some degree.
 
Note for Paul: the Audio shield is very cool, though larger than I'd like, and includes more technology than I need.
...
Perhaps looking at the 3.5/3.6 features, a smaller Audio board could be fashioned:
- no need for SD card reader, perhaps no need for memory add-on socket
- continue make easy stereo I/O for the Audio lib

Maybe a simple output-only board like this?

osh.jpg

Perhaps an a very inexpensive DIY soldering kit?
 
I like the idea.
Is this just a sample size, or do the outlines make sense for specific components?
If this is something specific, the 8-pin chip would test the novice for soldering (and me right now... though I'm determined...)

A combination of this and Neutronned's mic circuit (less the electret itself - and maybe electret(s)) would make a groovy little board.
(I've been waiting all week to use 'groovy').
 
Teensy with Mic and Audio board as front door light/welcome

Interesting project, would like something like this as a Teensy version of the Whistled which is a pretty cool idea. Use to turn out outdoor lights when hands are full. There is documentation and interesting discussion on approaches to coding whistle detection, some much simpler than spectral analysis. Then the audio board could play a welcome clip. Right now I have a simple solar charged LED with PIR - which my wife loves.
 
I got a microphone module from NeutronNed and am putting it through its paces now. My first tests were to make sure it works, test it with my APA102s, and see how quiet it is. The short version is I'm picking up noise from it on several different Teensys whether it's powered by an adapter, USB on a desktop, or USB on a laptop battery, but I'm not convinced it's the microphone's fault. I think it might be the default Los Angeles background noise.

Here's a not very good video of my tests, I apologize in advance that I didn't realize autofocus was off...

I'm about to start some tests with the microphone module outputting to the LEDs, so hopefully more soon.

 
potatotron: Thank you for running the tests! That array looks great!! On the noise front, I'm wondering if we're all plagued with some level of 60Hz power line noise. I'll look at the output a bit closer to see if there is something rumbling around down there.
 
potatotron: Thank you for running the tests! That array looks great!! On the noise front, I'm wondering if we're all plagued with some level of 60Hz power line noise. I'll look at the output a bit closer to see if there is something rumbling around down there.

If there is then it's not specific to your design. Just a bit ago I tested your module with the Adafruit MAX9814 board and Adafruit's is definitely more noisy. My camera doesn't like the lights in my office so tomorrow when there's sunlight I'll make a side-by-side comparison video.

It also looks like several examples out on the web don't use the first (or even first few) FFT buckets; I changed my code to discard buckets 0 and 1 and that eliminated most of the noise on the display.

All in all I'd say your board is great. The only recommendation I have at this point would be to maybe add a pin for the Gain control....I'm not completely convinced it's necessary, but it would be one more thing to experiment with.

Related to that topic, I'm currently using pieces of Paul's OctoWS2811 library's SpectrumAnalyzer example and in setup() this gets called to set the Y axis scale:

Code:
void computeVerticalLevels() {
  unsigned int y;
  float n, logLevel, linearLevel;

  for (y=0; y < matrix_height; y++) {
    n = (float)y / (float)(matrix_height - 1);
    logLevel = pow10f(n * -1.0 * (dynamicRange / 20.0));
    linearLevel = 1.0 - n;
    linearLevel = linearLevel * linearBlend;
    logLevel = logLevel * (1.0 - linearBlend);
    thresholdVertical[Y-y-1] = (logLevel + linearLevel) * maxLevel + slop;
	//Serial.print(Y-y-1);
	//Serial.print(" ");
	//Serial.println(thresholdVertical[Y-y-1],10);
  }
}

Right now dynamicRange, maxLevel, and slop are constants specified at compile time, I'm going to see if I can write something to periodically analyze the input and tweak the numbers, this could make the display automatically adjust between quieter talking sounds and loud music.

[edit - spelling]
 
Last edited:
Update on the MAX9814 design:
1) Up to Beta-level!! Testing has been going well and feedback positive!
2) Shrunk the size down to 1.0" x 0.6"
3) Kept the option to change the gain from 60 to 50 to 40, but dropped the A/R jumper
4) Flipped the mic to the other side
5) Added pin out info for J1 so you know what to connect to!

A dozen boards on order from OSHPark and this time I'm getting a stencil from OSH Stencil. No more manually applying micro-solder-dots for that IC! There will be a few weeks of delay while everything comes in and I'll post more info when I have the Beta boards built.

https://www.dropbox.com/sh/emody78vc...NY-tkRpBa?dl=0

This is the Dropbox link to the Eagle files - look for the .BRD and schematic from March 9 around 8-9PM Central.
 
Last edited:
Looks like a broken link in post #47, Leon.
I'd like to order and construct a few mics.
Did you get the solder mask you spoke of?
I'll need all the help I can get.
 
Thanks for the tip on the broken link - not sure what happened but let's try this again!
https://www.dropbox.com/sh/emody78vc1fs8j0/AACzHrMgqQNJ63fJNY-tkRpBa?dl=0

( PS - this is the live link to my project folder - so files are subject to change!!)

I have built up one of the 'new' Beta mic boards and seems to work as expected. Yes, I used the solder stencil from OSH stencils and it worked fine. It seems to put down a bit too much solder for my liking so I'll have to figure out how to moderate that. I had a couple of solder bridges on the fine-pitch IC that needed some repair but that wasn't so bad.

I have some hot stuff to take take of for work over the next couple of days but plan to build up eight more by next Monday.

Davidelvig - did you discover anything with that one misbehaving mic?

Others - if you have one of the original Alpha Mics and would like to test a Beta mic, please let me know.
 
Last edited:
Neutronned,
No news on the misbehaving mic. As I noted before, the offset voltage at the output pin is too high (~.8V), and the output produces a 60Hz square-ish wave - and that's it. It had behaved beautifully until I somehow damaged it. I'd be happy to power it up and check some voltages at various, or all, points and email that to you.

Would it be better to just ship it back so you can poke around?

I am interested in continuing the journey toward this mic. It will be clearly useful to have a solid 0.6V offset mic.
Send another beta my way (if you trust me).
I'd also like to try my hand at the process of ordering and assembling, so if you don't mind, I'll order some boards as well.
 
Back
Top