Help with Basic Audio Lib results

This seems like a market opportunity.
A clean, amplified electret mic with 0.6V bias and 1.2Vpp at its reasonable maximum.
- 3.3V input
- RC filters on-chip so none are needed on the breadboard.
- form factor similar to the Adafruit offering
- $10? (I'd buy some at that price)

The RC circuit in the Audio Lib adc documentation is doable, but time-consuming to set up on a breadboard.
The Audio Shield, while powerful, expands the footprint of the project and covers the breadboard side-to-side. It's overkill for a quick, clean mic input.

Is the 0.6V bias common outside the Teensy space?
 
Last edited:
Does seem like a great product! 3.3V to 5V input, variable gain via trim pot along with a variable bias would be good. Actually, you could have a variable max output and always have the bias at the middle. Probable makes sense to center the signal. I'll think more about that and maybe play with a circuit design.

No, that low 0.6V bias is unusual. Typically they are at 50% of the A/D input range in order to maximize that range. I'm pretty sure that the microcomputer's A/D inputs are good for 0 to 3.3V so having the more limited range of 0 to 1.2V for the audio library seems like a design decision that is leaving a few bits on resolution on the table. Paul has a very good rationale for that decision, I'm sure!
 
This bias circuit will increase problems since 20% of the inevitable RF noise on the +3.3V line will be fed into the ADC input. Basically, There should be two filters for decoupling from +3.3V: One for the mic power supply as Paul wrote above, and a separate one for the bias voltage.

Another problem might be that (as written above) the mic is pre-amplified and there is a ca. 3Vpp AC amplitude at its output with a 1.6V bias. Both are too high. The bias alone will saturate already the ADC and the AC signal will overdrive it. A simple voltage divider 18k and 10k from the Mic output would bring the bias and the AC amplitude of the mic down to an appropriate level which solves both problems at the same time.

That microphone module is still signing with a wonky 1.2-1.5Khz signal superimposed on the output. Might be the large capacitive load creating oscillation or maybe noise creeping in on the supply (even though I can't see it with my set-up). Going to go back to the start, un-mod the microphone module and build out that original filter. More to come.
 
This seems like a market opportunity.
A clean, amplified electret mic with 0.6V bias and 1.2Vpp at its reasonable maximum.

Yes. My hope is Onehorse or Sparkfun would make such a product. Ideally, it should also have some provision for running from a battery, even if just a JST connector that mates with commonly available batteries and just connects it to VIN.

Later this year I'm going to be putting quite a lot more work into sound-reactive LED control (and non-blocking Neopixel library), so there's going to be more need for a good quality, ready-to-use microphone board. If nobody wants to pick this up, PJRC will probably end up making one. But I'd much rather focus on Teensy and the software side.

No, that low 0.6V bias is unusual. Typically they are at 50% of the A/D input range in order to maximize that range.

The range is 1.2V, so this is 50%.

In older 8 bit AVR and PIC chips, indeed 1.2V range is unusually low. But even then, some AVR offer both 2.56V and 1.1V.

In modern 32 bit chips, 1.2V internal reference is pretty much standard. This isn't just Freescale. The STM chips and NXP's LPC chips have 1.2V internal reference. Atmel's SAMD chips (used on most of Arduino's 32 bit boards) have 1.0V internal reference.

Paul has a very good rationale for that decision, I'm sure!

It's a simple matter of the chip's internal reference voltage being 1.2V. The reduction in range is worthwhile for rejection of power supply noise on the reference.

Ordinary line level audio is also approx 1Vp-p, so this matches pretty well to the commonly used consumer gear audio signals.


That microphone module is still signing with a wonky 1.2-1.5Khz signal superimposed on the output.

Adafruit's design leaves a lot to be desired. If I can get someone to create a board with 0.6V offset, hopefully they'll be willing to do a better design, and ideally go through a couple iterations if the first attempt isn't great.

sch.jpg
(click for full size)

This schematic has 2 paths for power supply noise to couple to the signal where a quiet signal matters most, before the amplifier gain. The mic bias at least has some attempt to filter away noise, but the 0.1 uF capacitor isn't nearly large enough. Together with 1K impedance, this put the single-pole corner frequency around 1.6 kHz, so it's only effective at filtering away noise in the top few octaves of human hearing.

The 1M resistors are a lesser issue, only because their impedance is so high. Their noise contribution will be about 60 dB less, because the mic imedance is 1000 times lower. Still, using an extra resistor and capacitor on this path would add minimal cost, and a smaller capacitor would work fine because the resistors are higher.

The power supply filtering could be done much better. Isolating the grounds is probably worthless and might even be harmful. This is the sort of thing that should be tested on a first prototype and iterated. Excellent analog design isn't easy and this is the sort of thing I'm not able to predict in advance.

But it is pretty easy to predict these ferrite beads are really only effective at RF frequencies. At audio bandwidth, they're just wires. FB2 probably wants to be become something useful for audio, like 100 uH. For example, Digikey 587-2048-1-ND might be a good starting point. However, even this is on the low end, less than 1 ohm impedance in the middle of the audio band. Even something like 587-2509-1-ND isn't a lot. Adding a series resistor, like 10 ohms or even 100 ohms, would also be a good idea. At the lowest frequencies where no reasonable inductor does any good, a resistor in series will really help. To make this effective as a filter, a large decoupling capacitor would also be needed.

Adafruit didn't use any decoupling capacitor at all, even though Maxim says one is needed. A 0.1 uF ceramic probably wants to be used in parallel with something big like 100 uF or more. This might seem excessive, but consider the most important audio frequencies are very low, just a few hundred Hz. Really good audio design would probably do much, much more, perhaps even a LDO regulator. But I believe an inductor and resistor in series and a pair of decoupling capacitors can probably be good enough.

The other really important thing missing from Adafruit's design (and almost all others in the maker market) is low-pass filtering. Well, other than the natural response of the microphone itself. Ideally, there should be at least a 2-pole filter, which costs another opamp and more resistors and capacitors (good NP0/C0G ones). If it's just a normal Sallen-Key circuit, the corner frequency should be fairly low, perhaps 6 to 8 kHz. Yes, that attenuates some of the higher frequencies people can hear, but attenuating signal and noise above the Nyquist rate is far more important. Any higher frequencies (above Nyquist) that make it to the ADC pin become terrible aliasing noise in the audio band.

Yes, I know this all adds up to many more parts, and some of them physically larger. My hope is the usual thought process of "can a smaller/cheaper part work" or "are so many parts needed" can give way to thinking more like "audio quality shouldn't suck, even when used in a hostile environment like a many-LED project". Onehorse, if you're reading this, any thoughts?
 
Last edited:
Nice write up and all great points! I didn't realize the A/D range was only 1.2V (and didn't bother to look it up, either... sorry!) The 3.3V supply on the Teensy looks pretty quiet already and most of the IC amps seem to have great specs on supply noise rejection. I've started downloading various mic circuits and IC amps to see what's out there. I haven't looked at mic amplifiers before but worked on ECG circuits for a few years and there are lots of similarity (similar freqs, similar gain). And I have been looking for an excuse to fire up Eagle again so I'll play around with something and share it. I'm assuming I should start a new thread title "Low Noise, 0.6V offset Mic Module" or something like that.

BTW - I like the simplicity of the Sparkfun mic amp module and have a few on order. They also only require a single resistor change to shift the bias but I'll also probably knock the gain down a tad to compensate for the lower pp range. I'll let you know how that goes.
 
Teensy 4 ADC audio library

I landed here looking for a way to interface an electret with a teensy 4,as shown if you click on an ADC element in the audio library design tool, but I'm running into compiler errors. is the ADC element still supported by the audio library on teensy 4? Do I need to use a different pin or a different library to get data from the T4's ADC into the audio library's frequency processing functions? My application has a very limited amount of space, I don't want to add on a whole audio board.
 
Microphone input on Teensy 4, please?

I landed here looking for a way to interface an electret with a teensy 4,as shown if you click on an ADC element in the audio library design tool, but I'm running into compiler errors. is the ADC element still supported by the audio library on teensy 4? Do I need to use a different pin or a different library to get data from the T4's ADC into the audio library's frequency processing functions? My application has a very limited amount of space, I don't want to add on a whole audio board.

I was considering using one of those adafruit mics, I wanted to use it for a background input for noise cancelling, using a T4.

I was hoping I could just plug it into A3.
Now I am baffled.

My background is in software, which doesn't so easily lead to the blue magic smoke I dread, I can just about manage pullup resisters for i2c breakouts... Can anyone help with a simple mic solution we can just plug in?

p.s. cannot help with the compiler errors, I haven't tried it (yet).
RichR

p.s. just tried with the design tool into the first design tool use : got this....
Part_2_01_First_Design_Tool_Use:11: error: 'AudioInputAnalog' does not name a type

Code:
// GUItool: begin automatically generated code
AudioInputAnalog         adc1;           //xy=86,346
AudioInputI2S            i2s2;           //xy=94,187
AudioMixer4              mixer3;         //xy=251,359
AudioMixer4              mixer1;         //xy=430,244
AudioMixer4              mixer2;         //xy=466,363
AudioOutputI2S           i2s1;           //xy=645,246
AudioConnection          patchCord1(adc1, 0, mixer3, 0);
AudioConnection          patchCord2(i2s2, 0, mixer1, 0);
AudioConnection          patchCord3(i2s2, 1, mixer2, 0);
AudioConnection          patchCord4(mixer3, 0, mixer2, 1);
AudioConnection          patchCord5(mixer3, 0, mixer1, 1);
AudioConnection          patchCord6(mixer1, 0, i2s1, 0);
AudioConnection          patchCord7(mixer2, 0, i2s1, 1);
// GUItool: end automatically generated code
 
Last edited:
Thanks Frank, I forgot about that.

Any ideas about if we would be able to adopt the adafruit Mic? Will it still have that electronics issue? That looks rather daunting.
 
Thread is old but still relevant. I have the same setup as @Davidelvig, the 4466 is unmodified and gain level is entirely up. Issue is that I can't get it to register unless the mic is sitting in front of the speaker at high volume. Would modifying the 1M resistor make it more sensitive at lower decibels?

 
You probably have a bias issue, not gain. If you using the Adafruit Max4466 microphone module (https://www.adafruit.com/product/1063), the two 1Meg resistors bias the input from the mic module to mid supply, meaning that the output of the MAX4466 will be also at mid supply. With something like 3.3V supply, that means the output will idle around 1.65V, which is still too high for the A/D input on the Teensy. Try changing to a 221K ohm resistor per Paul's suggestion here: https://forum.pjrc.com/threads/4046...io-Lib-results?p=126317&viewfull=1#post126317

I design a version for the Teensy several years ago but only made and sold a few. Here's the Tindie page - the document show the schematic and I can send you the Eagle design, if desired. https://www.tindie.com/products/NeutronNed/max9814-microphone-module-for-teensy/
 
You probably have a bias issue, not gain. If you using the Adafruit Max4466 microphone module (https://www.adafruit.com/product/1063), the two 1Meg resistors bias the input from the mic module to mid supply, meaning that the output of the MAX4466 will be also at mid supply. With something like 3.3V supply, that means the output will idle around 1.65V, which is still too high for the A/D input on the Teensy. Try changing to a 221K ohm resistor per Paul's suggestion here: https://forum.pjrc.com/threads/4046...io-Lib-results?p=126317&viewfull=1#post126317

I design a version for the Teensy several years ago but only made and sold a few. Here's the Tindie page - the document show the schematic and I can send you the Eagle design, if desired. https://www.tindie.com/products/NeutronNed/max9814-microphone-module-for-teensy/


Thanks for the advice.. so pardon my hardware skiils, but any way to know the wattage rating required for the 2.2k resistor?


2023-08-24 16_25_23-Window.jpg
 
any way to know the wattage rating required for the 2.2k resistor?

Because the max voltage is only 3.3V, power dissipation is so low that you really don't need to worry. Pretty much any part will work.

During use the voltage is likely to be less than the full 3.3V power. But for the sake of a worst case estimate, let's assume the 2.2K resistor has the full 3.3V applied continuously. Power in a resistor is V * V / R = 3.3 * 3.3 / 2200. That's 4.95mW as a worst case, in a system running on 3.3V power. If you use a higher voltage, the power can of course be much more.

So for use with a 3.3V system, even the smallest part rated for 1/32W can handle 30mW, which is more than 6 times the worst (and rather unlikely) case.
 
Because the max voltage is only 3.3V, power dissipation is so low that you really don't need to worry. Pretty much any part will work.

During use the voltage is likely to be less than the full 3.3V power. But for the sake of a worst case estimate, let's assume the 2.2K resistor has the full 3.3V applied continuously. Power in a resistor is V * V / R = 3.3 * 3.3 / 2200. That's 4.95mW as a worst case, in a system running on 3.3V power. If you use a higher voltage, the power can of course be much more.

So for use with a 3.3V system, even the smallest part rated for 1/32W can handle 30mW, which is more than 6 times the worst (and rather unlikely) case.

Thank you for the assistance. I will leave my discovery here in case it helps anyone else but the result is that the MAX9814 is far superior and literally worked out-of-the-box. So first thing I noticed is maybe I got the wrong parts.. the 2.2k resistor seems to be much smaller than the one it's replacing. That said, I was able to fasten it to the location of the old one after a little work but the result was not pretty. I did this with a blade tip on the soldering iron.

20230826_231013.jpg

20230826_233445.jpg

Unfortunately I can't measure the output on the line after switching to the 2.2k at the moment but here are the results. The audio gets a bit loud on this video to show how it's not responding to level.

2.2k SMD patch (audio volume alert) :mad:

After that I swapped out the mic for the MAX9814 with no modifications it worked perfectly. At silence I get little or no interference and at normal listening levels it is very descriptive. I ran a sound test and it appears to be walking the spectrum, given this is only 1/2 of the 27 bands that I am measuring.

MAX9814 with no modifications

So the result is that the MAX9814 is far superior to the MAX4466 at reading audio at acceptable noise levels. It appears to be calibrated with only a what was mentioned earlier
" adding a 220 ohm resistor between Teensy's 3.3V and the mic power input, and a 100 uF capacitor."

I also didn't jumper the gain to ground on the 98814.
Hope this is helpful.
 
The MAX4466 isn't upto audio really, very noisy at 80nV/√Hz, gain-bandwidth product is a few 100kHz (you want more like 10MHz for low distortion audio)

The MAX9814, despite being designed for microphones is still a noisy chip at 30nV/√Hz (5 to 10nV/√Hz would be considered a quiet opamp for instance).
Bear in mind its designed for something like a mobile phone where high sensitivity is not required as its held to the face while talking.
 
Back
Top