Microphone Amplifiers

I’ve been prototyping microphone amplifiers for SmartMic. Although I’m not much on an analog guy I’m getting somewhere. Note the tiny SOT-23 op-amp soldered to a header!

We want to be able to handle electret and dynamic microphones, and have 0 to 40dB gain (trimmer adjustable). Here are the transistor and op-amp versions:

Note the DC coupling to the STM32F4 ADC, we want this to be about half scale on the ADC. I’m using the internal 12 bit ADC and DAC to handle the audio signals rather than an external PCM Codec. This seems to be working out pretty well so far. I sample at 16 kHz and don’t worry about anti-alias or reconstruction filtering – I figure the rig’s xtal filter and audio filtering will handle that. Seems to work.

With the transistor version I am concerned about repeatability across manufacture runs and temperature. For example the emitter resistor is AC bypassed so the spread of Beta’s will mean varying gain, or the DC offset might vary. The low Ve bothers me too. However by tweaking the various C values we could tailor the freq response which might be useful. On balance I think we might run with the op-amp version.

To test the amplifiers I speak into the microphone and sample a phrase using the ADC on my STM32F4 Discovery board running a unit test program that uploads the sample to my laptop via USB. This software converts the 12 bit unsigned samples to signed 16 bit samples. I can then plot the signal using Octave and check the DC offset and peak-peak levels:

Then I apply some sox and Codec 2 command line magic:
david@bear:~/tmp/codec2-dev/src$ sox -r 16000 -s -2 ~/stlink/stm_out.raw -r 8000 -t raw - lowpass 3300 highpass 100 | ./c2enc 1300 - - | ./c2dec 1300 - - | sox -t raw -r 8000 -s -2 - smartmic_micamp_1300.wav
Likewise with the logitech USB headset I used as a comparison, which was set as the default input sound device:
david@bear:~/tmp/codec2-dev/src$ rec -t raw -r 8000 -s -2 -c 1 logitech.raw
david@bear:~/tmp/codec2-dev/src$ ./c2enc 1300 logitech.raw - | ./c2dec 1300 - - | sox -t raw -r 8000 -s -2 - logitech_1300.wav vol 2

…..which lets me listen to the mic signals after encoding/decoding with Codec 2. It’s amazing what Unix style “stdin/stdout” tools strung together can do. Very quick prototyping.

I generally use my little laptop speaker to listen as (i) it makes Codec 2 sound better which strokes my ego and (2) it’s close to the sort of speaker Codec 2 will be used for in the real world. Here are some samples:

Transistor, electret
Opamp, electret
Opamp, Yaseu MH31 dynamic
$15 Logitech USB headset

The levels aren’t all exactly the same. To my ears the dynamic mic seems to have less low frequency response, not sure if that is good or bad. HF radio mics are generally tailored to maximise speech energy at those frequencies most important for intelligibility. This causes SSB modulation to allocate more transmit power to these regions of the speech spectrum, enhancing the received signal in the noisy, fading HF channel. Digital Voice doesn’t have the same relationship between the source audio spectrum and transmitted power, so the frequency response is less important from a transmitted “punch” point of view. This may mean traditional HF radio microphones and audio filtering is not needed and may even be harmful in a digital voice world.

We have found however, that the microphone and/or frequency response of the source audio can dramatically affect the Codec 2 speech quality. We are trying to gather more information on that and work out why.

9 thoughts on “Microphone Amplifiers”

  1. Back in the 90’s I played with a 1-bit A/D based on the LM324 chip. This had four op-amps in it. The idea was to low-pass and limit the audio, then send the PWM waveform to an RS-232 pin. Then the MS-DOS machine was programmed to sample this pin using an interrupt service at 8 kHz.

    The resulting audio was then saved in a file, compressed, and sent via packet radio at 1200 baud (yuk, ha). It was fun. Anyway, I found the schematic and thought I would pass it along.


    73, Steve

    1. Old school! Yes my first experience was sampling/replaying voice via the cassette interface of my 1983 Z-80 machine. It was understandable, like your design a 1 bit ADC.

      A lot of the intelligibility in speech is due to frequency information, for example with just 2 or three tones we can perceive vowels. A zero crossing detector (1 bit ADC) can detect frequencies OK, e.g. a frequency counter works counting zero crossings.

      I’ve also had some experience in fixed point coding of tone detectors .. they can also operate happily on 1 bit of resolution.

      Might be an idea for an ultra low bit rate Codec 2 mode….

      Your design has two 40dB gain stages – quite a bit of gain.



  2. Hi David,

    Microphones– Electrets have the flatest response. If backwards they still work a little which can lead to confusing results. Dynamic and Carbon. Probably not of much interest? Dynamic the best don’t even hold a candle to electrets. Carbon do dynamic compression. MUCH easier to listen to, but vary a LOT in signal level, etc. Probably effectively obsolete now. I have looked at frequency response some. A random noise source from a flat speaker system gives the best calibration. All mikes are somewhat directional and vary with distance from the speaker :(. I could go on and on….

    HTH, Feel free to correspond directly.


  3. Hi David,

    A couple of comments on the schematic.

    1. You may want 100 ohms in series with the reset button to tame high current pulses when the switch closes.

    2. A bunch of pads in the microphone and headphone region may allow easier patches as you get freq. response and levels right for the various audio variations. I have found a ‘tone’ control very useful in the path I listen to.

    3. Ethernet seems to be there but not easy. Quite a few wires to really get it to run. Maybe a poor man’s version of 10 base 2 done in software? All we really need is a way to get packets to and from a nearby router or other device which can have a ‘real’ ethernet interface :). And that could be a fun project to do.


  4. Thanks John, re reset button you are referring to the SmartMic schematic? I’ll mention these suggestions to Rick.

    The 407 variant of the uC supports Ethernet but we are thinking of moving to the pin-compatible 405 that doesn’t support Ethernet and is a little cheaper.

    If some one is really keen on experimenting they can just load a 407 and break out the Ethernet pins.

    Otherwise there is a RS232 serial, and USB for connectivity.

  5. Hi David,

    Yes, I did mean that switch. Sometimes the high current pulses from simple things like this can amazing things to happen. Even sometimes hardware damage inside fast chips!

    The 407 chip looks pretty neat. I still like the idea of my ham radio attached to asterisk :).

    warm regards,

  6. Regarding the MH-31 handmic, there is a little switch at the back which controls the tone I think: I’m not sure what position is what, and whether one gives a “flatter” response than the other.

Comments are closed.