Electron Pi

My notebook on Raspberry Pi and Arduino projects

Getting going with an electret microphone and an Arduino

Reading about electret microphones, it all seemed very complicated. However, the wikipedia page makes it very simple. I’m using a PPCOM-08635 – it’s a SparkFun part, supplied via Proto-Pic. Anyway, if you take the schematic on the wikipedia page, and simplify it even further. All we need is one resistor.

electret_bb

Two observations – first, it helps if you wire it up the right way around. If you wire it up the wrong way around, you still get a signal, just not as good. Don’t trust the red and black in my diagram! Second – the value of the resistor matters. I put a 10k resistor in first, tried 1k and 100k and found 10k was the best. 10k puts the quiet output in the middle of the display, and seems to give nice peaks. I think the microphone has a built-in resistance – impedance? I don’t yet understand impedance.

In a previous post I had an Arduino sketch and Processing script; this turns out to be very nice for displaying the output. One thing is that my 2kHz sampling frequency is a little low. If I whistle, then I get a nice peak in the Fourier transform. If I start low, the peak is at the left of the graph – low frequency. If I make higher and higher whistles, the peak gets further to the right, until it hits the edge, and “bounces back”. Also, at whistles higher than the bounce-back point, with a high whistle, the waves look longer than with a lower whistle. Now it happens that I have a musical instrument – a mandolin – handy, so I can generate a 440Hz A (or thereabouts, I haven’t tuned the thing in years). That sound is generating a peak quite close to the right of the display, but a little lower than the bounce-back point.

Other obsevation – I have a cheap motor. If I power the motor off a completely separate circuit, then if I let the motor get too near to the microphone, there is *lots* of noise, the average reading gets lower, it’s all crazy. I suppose the magnetic fields generated with the motor are interfering with the microphone. It might make the project of listening to a motor (to listen out for the squeal of a stalled motor, for example) trickier.

For a simple circuit to get going with, it works remarkably well. I’ll want to do further amplification, which will mean complications, and it would be useful to rewrite the software, to sample at a higher frequency and send data to the computer in batches, also there’s some analog signal processing I could think about doing – a VU meter, perhaps with some high-, low- or even band-pass filters. Some on-Arduino processing, with the built-in FFT library, maybe.

Edited To Add: This is, I suppose, Part 1 in a series of 4. The remaining parts are here (where I add in an op-amp), here (where I add a capacitor between the electret and the op-amp), and here (where I do volume sensing with the output).

7 responses to “Getting going with an electret microphone and an Arduino

  1. peter September 14, 2013 at 1:23 pm

    Very nice blog, thanks for the tutorial.

  2. Anirudh April 17, 2016 at 9:46 am

    Nice blog! I bought one of these and when I saw all other websites which said I needed an extra breakout board for the to mic to be read by Arduino, I was disappointed. But this one was very easy!

  3. Soard May 10, 2016 at 11:22 am

    The easiest best blog in the to world of electronics

  4. Soard May 10, 2016 at 11:23 am

    The easiest best blog in the the world of electronics

  5. Vickey Perring February 27, 2017 at 12:11 pm

    “Great Blogpost! Thanks for one’s marvelous posting! I _genuinely enjoyed”

  6. Harry February 18, 2019 at 7:54 pm

    I know this site presents quality depending posts and other
    information, is there any other web page which provides these kinds of stuff in quality?

  7. Pingback: Cannot Detect sound from any microphone – Arduino Apprentices

Leave a comment