0
\$\begingroup\$

I am trying to get an electret mic to detect sound, which I can then pick up using a Raspberry Pi Pico ADC pin.

My electret has two output pins. One is connected to ground, the other is connected to the Picos ADC pin, and also to the Picos 3.3V reference voltage over a resistor, R1.

The voltage detected by the ADC pin is fixed at a constant regardless of the sound incident on the electret.

I varied R1 over several values between 220 through to 2,000 Ohms, and in each case the voltage is different (dependant on resistance) but remains fixed as before.

I thought that incident sound waves would drive the microphone diaphragm thus generating an AC current. From this I would expect the Pico to be able to read this AC current with the setup I describe above, but it isn't.

I've seen some schematics online showing a capacitor placed between the ADC pin and the mic, which I would assume only introduces a phase offset and removes the DC component. From this I can't see it would solve my issue with the voltage reading.

The specific electret component I have is listed here: https://kitronik.co.uk/products/3310-microphone-insert-pcb-mount-pack-of-5?_pos=1&_sid=3e44071e0&_ss=r

I believe it to have an in-built op-amp on the + pin.

Any help in pointing out where my issue could be would be appreciated. An explanation of why would also be helpful.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Wrt the comment about "some schematics online showing a capacitor", bear in mind that also the datasheet for the component you're using, is showing that capacitor in its diagram. \$\endgroup\$
    – MrGerber
    Commented Aug 15, 2023 at 10:59

3 Answers 3

9
\$\begingroup\$

The output amplitude is so low the MCU ADC can't measure anything except the DC bias voltage. Contrary to your assumption, there is no built-in op-amp in the mic capsule.

You will need a suitable amplifier circuit between the electret mic capsule and MCU ADC input. Approximately the amplification needs to be around 40 dB, or even more.

\$\endgroup\$
3
\$\begingroup\$

Your electret's datasheet specifies:

enter image description here

It's been a while, but this is an old way of writing out sensitivity.

One bar is \$10^5\:\text{Pa}\$. So \$1\:\mu\text{bar}\$ is \$100\:\text{mPa}\$.

Today, we usually use one Pascal as the reference, so this means we need to add \$20\:\text{dB}\$ to the written specification for comparison with more common specs today.

\$60\:{\text{dB}_\text{SPL}}\$ is a loud conversational level. \$40\:{\text{dB}_\text{SPL}}\$ is the lower end of conversational levels.

Loud, the output would be \$20\:\mu\text{Pa} \times 10^{^\frac{60\:{\text{dB}_\text{SPL}}-54\:{\text{dB}_\text{SPL}}+20\:{\text{dB}_\text{SPL}}}{20}} \$ or about \$400\:{\mu\text{V}_\text{PK}}\$. It will be about 10 times less, or about \$40\:{\mu\text{V}_\text{PK}}\$ at the lower end of conversational levels.

This assumes, as stated, that \$R_\text{L}=1\:\text{k}\Omega\$. You can use a higher voltage where possible, but this also means a larger \$R_\text{L}\$. In this case, I'd just recommend a standard \$9\:\text{V}\$ alkaline battery as the voltage source. I usually anticipate that the electret will require about \$1.5\:\text{V}\$ itself. And since a standard \$9\:\text{V}\$ alkaline battery is really more like \$8.5\:\text{V}\$, I'd use \$7\:\text{V}\$ as the resistor drop. I also usually expect an electret requires \$500\:\mu\text{A}\$. So this means \$R_{_\text{L}}=\frac{8.5\:\text{V}-1.5\:\text{V}}{500\:\mu\text{A}}=14\:\text{k}\Omega\$.

I'd select \$10\:\text{k}\Omega\$, though. (Some of the electrets can use a little more current.)

Given this resistor value is 10 times the one they specified, you can expect about 10 times the AC output voltage, but obviously now with a source resistance that is also 10 times higher. So between \$400\:{\mu\text{V}_\text{PK}}\$ and \$4\:{\text{mV}_\text{PK}}\$ and with a source impedance of \$10\:\text{k}\Omega\$.

To get that up into the range of \$1\:{\text{V}_\text{RMS}}\$ would require a final voltage gain (after attentuations are accounted) of \$20\cdot\log_{10}\left(\frac{1\:{\text{V}_\text{RMS}}}{4\:{\text{mV}_\text{PK}}\,\cdot\, \frac1{\sqrt{2}}}\right)\approx 51\:\text{dB}\$ (about 350 times.)

But that's where I'd start the design process.

The first stage should be carefully designed to use low-noise transistors. (Sufficiently low-noise opamps are power-hogs, boutique, and otherwise not needed -- so BJT-only.) The voltage gain should be very modest -- perhaps a factor of 3 or 4 (\$+9.5\:\text{dB}\$ to \$+12\:\text{dB}\$.) But no more than about \$+15\:\text{dB}\$. A class-A stage should be fine, but use a current source as the collector load for it. Once that stage is done, then the 2nd stage can be designed to provide the remaining gain of around \$+39\:\text{dB}\$. (And that can be a decent audio amp.)

Regardless, this will require a minimum of two stages of amplification: the pre-amplifier (described above) and an amplifier stage that provides necessary remaining voltage gain and matching up with the ADC input for the MCU. (We've not yet discussed the MCU ADC.) But 3 stages would not be off the table.

Not doing the necessary analysis and then design and construction steps to get from A to B is likely why you may be having troubles.

Example of first stage design

There is a design process for a similar amplifier found here at the EESE site that includes the following schematic:

enter image description here

This is about how I would approach a first stage design using low noise BJTs (like the BC549 and BC559), except that the above design isn't just a first stage, wasn't designed for low noise, and is instead designed to directly drive a speaker.

There's a comment there, from G36, saying that the above design is similar to one by John Linsley Hood, dating back to this 1969 article (now preserved at Elliot's site).

This brings me to the point. There is an excellent pair of articles at Elliot Sound Products:

In the 2nd article see Figure 4. He chooses the same \$9\:\text{V}\$ battery and specifies the same \$10\:\text{k}\Omega\$ resistor for his electret pre-amplifier. (Once the battery is selected, the resistor falls out from that choice. We reached a similar place likely for similar reasons.)

Elliot's design uses a class-A design but one that has some exceptional properties. More on that, later.

I've redrawn it in a way I prefer. And I've replaced his output capacitors as this will be feeding into the next stage and I just wanted to test it. Click on the image to make it larger and more readable:

enter image description here

I've also included an electret simulation of my own in the lower left corner, for testing purposes. (And the obvious \$9\:\text{V}\$ battery source simulation, as well.)

The top graph shows the loaded microphone output, which is about \$2.5\:{\text{mV}_\text{RMS}}\$. Unloaded, this would be closer to \$2.8\:{\text{mV}_\text{RMS}}\$. But the amplifier will load it down a little.

The bottom graph shows the unloaded output of the amplifier stage. (I used a \$10\:\text{M}\Omega\$ resistor, which is essentially no load.) This is about \$10.6\:{\text{mV}_\text{RMS}}\$. So the gain is about \$+12.5\:\text{dB}\$.

addendum

I am adding this months later...

Elliot's design has some nice features:

  • As it should, it uses global NFB to set the gain. In this case, the NFB factor is just \$\beta\approx \frac1{1+\frac{R_8}{R_5}}\$ (neglecting \$r_e^{\:'}\$.) The open loop gain will be in the several thousands, so the closed loop gain won't be too far afield when setting \$R_5\approx \frac{R_8}{A_v-1}\$. This is a very simple calculation to make. (It's actually \$R_5=R_8\cdot\frac{A_{vo}-A_v}{A_{vo}\left(A_v-1\right)+A_v}\$, derived from \$A_v=\frac{A_{vo}}{1+\beta\cdot A_{vo}}\$. But the simpler equation is close as \$A_{vo}\gt 5000\$ from the high impedance of the current source working against the two concerted BJTs.)
  • The quiescent point is insensitive to variations in the power supply and also insensitive to variations in transistor \$\beta\$. For example, any excess base current needed by \$Q_4\$ (due to a lower value of \$\beta\$) is just passed along via \$Q_1\$ to develop an added drop across \$R_8\$, leading to an adjusted quiescent collector voltage for \$Q_4\$. This causes no problems as there is a current source feeding that node and the design includes a lot of headroom for part variations of this kind.
  • The quiescent \$V_{_\text{CE}}\$ of \$Q_1\$ can be set to any comfortable value by adjusting the voltage divider of \$R_1\$ and \$R_3\$. The divider should be set for the lowest allowed power supply value so that \$Q_1\$ stays in active mode. But with that done, if the supply is increased from there the re-biasing of \$Q_1\$ is harmless as its \$V_{_\text{CE}}\$ simply picks up the slack without harm. (In this way, \$Q_1\$ and \$Q_4\$ are relative isolated from each other rather than possessing a tightly coupled design.)
  • The input impedance (as seen by the electret and \$R_2\$) is quite high: roughly \$110\:\text{k}\Omega\$.
  • \$R_8\$ is simultaneously a key part of the DC biasing and also the path that provides the global NFB connection into the circuit. It does both, well, simultaneously, and without sacrificing anything important. I don't see this kind of circuit parsimony as often as I'd like!

The result is very smart:

  1. The design can be arranged to handle supply voltages at or above \$5\:\text{V}\$ and it will work at the same quiescent point for supply voltages that are significantly higher. For higher voltages, there is only a 2nd order effect on the quiescent current due to the Early Effect operating on the current source. Other than that, the \$R_1\$ and \$R_3\$ divider voltage scales. But this is simply picked up smoothly by an increase in \$V_{_\text{CE}}\$ of \$Q_1\$ without the slightest impairment to the behavior/design goals. Very smart.
  2. The arrangement of \$R_8\$, \$R_9\$, and \$Q_1\$ (DC biasing) diverts only just enough current to sustain \$Q_4\$'s quiescent point and a little more for what \$R_9\$ must also sink. It self-biases very nicely and adapts to often wide BJT parameter variations of \$\beta\$ and \$I_{_\text{SAT}}\$ in a very smooth manner. Very smart.
  3. After all is said and done, the base recombination current of \$Q_1\$ will be very light and its emitter impedance reflected to the base almost negligible. So the input impedance (I assign \$R_2\$ to the source impedance driving the circuit) is dominated by \$R_4\$ summed with \$R_1\$. That's easy to see and adjust. But as shown, it's also a factor of 10 larger than the source impedance (\$R_2\$) which is a good design rule, as well. And the DC quiescent point for \$Q_1\$ works through \$R_8\$, which is also the NFB resistor. Very smart.
  4. The placement and use of \$C_3\$ and \$R_5\$ as a part of the AC closed loop gain setting group is simple and direct and again very smart.
  5. The whole design is well-handled parsimony, minimizing up to a point but not further. Further simplification would sacrifice something important. Further addition wouldn't provide benefits worth the added complexity. Very smart.

It's well designed and worth retaining in mind.

\$\endgroup\$
1
\$\begingroup\$

Your two-pin microphone requires the pull-up resistor to power its internal amplifier, and that contributes a large DC signal in addition to a smaller AC sound signal. There are multiple approaches to keep the DC signal (and power supply noise) from dominating, and the capacitor coupling is one such (but that means there are low-frequency limits in addition to the DC removal... which is a kind of low frequency you WANT to limit).

The microphone probably will have a few millivolts of output in addition to its almost-3300 mV bias, and that implies that the ADC (assuming 8-bit function) will vary by a few least-significant-bits, in a range of 0-255. You probably want an amplifier stage in addition to the DC blocking function, to get the benefit of better granularity.

Either a coupling capacitor, or a transformer, or some kinds of differential amplification, can be employed usefully. As for the pull-up resistor, that microphone draws less than 0.5 mA of current, and requires 1.5V net power, so the 3.3V supply sets an upper limit of 3.6k ohms; 1 k ohms should be good.

\$\endgroup\$
5
  • \$\begingroup\$ This and the previous answer may appear to contradict each other. For clarification, an electret microphone typically has an internal amplifier consisting of a single FET, this may provide an output in the millivolts to hundreds of millivolts. \$\endgroup\$
    – Frog
    Commented Aug 12, 2023 at 20:24
  • \$\begingroup\$ @Frog I don't see the contradiction - we both say amplification is required. And if I am not mistaken with the units and math, the mic sensitivity indicates that it will output only a 20mV signal when blasted with ear-deafening signal at 94 dB SPL. That's 24-25 LSB counts with a 12-bit 3.3V ADC. \$\endgroup\$
    – Justme
    Commented Aug 12, 2023 at 20:41
  • \$\begingroup\$ @Justme the first answer says that the mic doesn’t have a built-in op amp, while the second speaks of an internal amplifier. Both are correct but I feel that amplifier vs operational amplifier is worthy of explanation. \$\endgroup\$
    – Frog
    Commented Aug 12, 2023 at 20:45
  • 3
    \$\begingroup\$ @Frog We are both correct. There is an internal buffer amplifier. It is not an op-amp. It is just a JFET which is typical and common in all such electret capsules. \$\endgroup\$
    – Justme
    Commented Aug 12, 2023 at 20:55
  • \$\begingroup\$ @Frog Basic Amplifier: tutorialspoint.com/amplifiers/amplifier_basic.htm Operational Amplifier: tutorialspoint.com/semiconductor_devices/… \$\endgroup\$
    – MrGerber
    Commented Aug 15, 2023 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.