I have seen modules for microphones (such as the one below) that use the LM393 and claim to have amplification.

photo

I have looked this part up and it is a comparator. I have read that op amps can be used as comparators, but I don't understand if the other way is also possible. My understanding is that comparator only outputs V+ or Gnd.

Can a comparator or this LM393 specifically be used as an amplifier for microphone signal? What parameters in the spec will make such a comparator applicable for use as an amplifier?

Update:
I have traced the connections on the module and made a schematic. It is based on my best effort and might not be accurate. Seems that the LM393 in this case is not used to amplify the analog out only to digitize it. I guess the general question still stands though.

schematic

  • 1
    A comparator is basically an opamp that is specifically designed to work in a comparator configuration, in this case one with an open collector. So likely you saw it in a class D amp – PlasmaHH Aug 19 '16 at 13:08
  • @PlasmaHH: in that application I wouldn't call it a class D amplifier but rather a \$\Delta\Sigma\$ converter... – Curd Aug 19 '16 at 13:15
  • @Arik Yavilevich: please show the "modules for microphone amplification that use the LM393" (schematic). – Curd Aug 19 '16 at 13:18
  • It would surprise me if anyone could make a usable ΔΣ converter using an LM393. My guess is that the LM393 is a bit too slow for that. – Bimpelrekkie Aug 19 '16 at 13:21
  • @Curd, I have not seen a schematic. I only saw this claim in the listings in ebay. I have no idea if the info listed was actually correct. This is why I am asking. I have one of those here, and potentially I could try to trace the circuit, and post it, but it could be difficult for me. I am a beginner. Should I do it? – Arik Yavilevich Aug 19 '16 at 13:45

Take a look at the basic schematics of the internals shown in the data sheets for the LM324 (regular op-amp) and LM393 (comparator) respectively: -

enter image description here

The input stages are both pretty similar but the first big difference is the internal compensation capacitor inside the LM324 op-amp (shown with a red box around it). This compensation will ensure that with regular types of negative feedback (including the typically worst case scenario of connecting the output directly to the inverting input), the LM324 op-amp won't become unstable and oscillate.

Q10 and Q11 in the LM324 are just emitter followers so there is no "added gain" (aka potential extra stability worries) coming from those transistors and Q12 (LM324), is going to behave pretty much like Q7 in the LM393 i.e. produce a lot of voltage gain.

Clearly, the output stages are very different with the LM324 utilizing push-pull emitter followers (no gain) whereas the LM393 has another high gain common emitter stage formed by Q8.

So, in short, the LM324 has frequency compensation to allow a wide variety of feedback configurations whereas the LM393 doesn't have this compensation and, to make things worse from a stability point of view, it has a further stage of voltage gain.

If you take the data sheet's schematics as a decent guide to the internals of both chips, you have to conclude that applying "normal" amounts of negative feedback (to make a regular op-amp type amplifier), will result in oscillation or significant instability issues particular at low closed-loop gains.

Looking further into the detail of the data sheets, the LM393 has a minimum voltage gain of 50 V per milli volt inputted whereas the LM324 is only 15 V per millivolt inputted. This substantiates the suspicion of higher gain (for the LM393) implied by the schematics in the data sheets.

Having said all that, there are always methods of making a comparator into an amplifier but, there aren't enough clues in the LM393 data sheet that hint at a firm method.

The LM393 modules you see advertised on eBay aren't microphone amplifiers as such.

They are advertised as sound detection modules, which deliver a (more or less) digital ouput.

That module has an LM393 on it, and is advertised as a sound detector. It has an active low output, which matches the capabilties of the LM393 - the LM393 can only pull down.

It won't do you any good as a microphone amplifier. That isn't its job, and (miraculously) it is advertised as doing what it is actually good for.


Since the LM393 is a dual comparator, the LM393 modules with an analog out may well be using the second comparator as a (bad) amplifier for the microphone.


With the added schematic, you can see that the 393 isn't being used as an amplifier in these modules at all.

AO is direct from the microphone, as I suspected.

The two comparators are providing simple on/off signals in response to the volume of the sound the microphone picks up.

  • JRE, you are right about the item you referenced, but there are also models with 4 pins. One of them being an analog out pin. And a standing, multi-turn trim pot. ebay.com/itm/… – Arik Yavilevich Aug 19 '16 at 14:47
  • 2
    It is still listed as a sound dectection module. It has a digital output, so that's from the LM393. There's no other amplifier, so analog out can pretty much only be the microphone audio without amplification. – JRE Aug 19 '16 at 14:57
  • @ArikYavilevich - I agree with JRE. I have tried to use those modules, and the analogue output was poor (almost useless). The digital output is okay-ish for loud noises, like the 'clap-on, clap-off' lights that used to be advertised on TV (but you may be too young to remember). – gbulmer Aug 19 '16 at 15:51
  • All signs suggest that you are right. I am trying to follow the traces and post a schematic so this can be confirmed. – Arik Yavilevich Aug 19 '16 at 21:10
  • @JRE, I have added a schematic. Can you please take a look? – Arik Yavilevich Aug 19 '16 at 22:15

When you posted the question first I wondered very much why a comparator would be used as an amplifier (even if it was possible) because there are OpAmps that are as cheap as the LM393 but surely would do the job better. So it doesn't make sense.

One idea was that the comparator is used in a \$\Delta\Sigma\$ converter to convert the signal in a simple digital form that is robust against interference.

That's why I asked for the schematic.
Now that you have provided the schematic we see that it isn't used to amplify it as analog signal but just turn it into a simple digital signal. That may be useful for some applications where it is enough to detect the presence of one dominant sound frequency or as sensor to detect just the presence of any noise; but I wouldn't call this amplification of a sound signal.

So the question remains: where is the amplification that is claimed to be on the board?

Obviously they mean the JFET (or even a complete IC) that most electret microphone capsules have integrated:

enter image description here

Picture taken from that document.

  • If as suggested by @JRE the module's primary purpose is sound detection, it will need to have a comparator in any case. As the LM393 has two comparators on the chip, this means there is a spare comparator to play with. As adding the additional very small surface-mount components that would typically be required to use an op-amp would cost virtually nothing in either size or budget, why not attempt to do it? It might be a particularly poor amplifier, but if somebody somewhere finds a use for it it might be a good idea to do it anyway. – Jules Aug 20 '16 at 18:53

A comparator lacks compensation so, in general, it cannot be stabilized to act as an amplifier at unity gain easily, if at all, depending on the internal construction.

However, in the particular case of the LM393 it is possible to use it as a really crummy op-amp by adding a BFC to the output. (I believe the \$\mu\$ is missing from the datasheet and the capacitor values should be 0.5uF - it's not that Big and Fat a Capacitor. ).

enter image description here

This is only possible because the circuit inside the LM393 family is so very simple, so the internal node that would normally be used in an op-amp is effectively accessible.

enter image description here

A comparator IS an amplifier so generally yes it can be used as an amplifier. I'm not saying that it will be practical or easy though !

An LM393 IS an amplifier but it is designed to be used as a comparator and it therefore is designed to have a very high gain and an open collector output. You could load the open collector output with a resistor to supply and apply feedback (to reduce the gain) so that it becomes a linear amplifier. Looking at the internal circuit of the LM393 that should be possible.

But a challenge might be to get it stable and have it perform as you would like (for a linear feedback amplifier).

  • Yes - as FakeMoustache has indicated, stability will mostly be a problem because comparators are intentionally NOT frequency- compensated (because of high slewing properties). Hence, only small to moderate feedback is allowed. – LvW Aug 19 '16 at 13:28
  • Couldn't you mitigate that by using a low pass filter in the feedback path? – jbord39 Aug 19 '16 at 13:33
  • A feedback with a lowpass characteristic would even downgrade the situation. The stability margin would be further reduced. Watch the loop gain respsonse! No - even worse: The circuit will be most probably unstable ! – LvW Aug 19 '16 at 13:49
  • 1
    You could make a VERY low frequency pole in the feedback loop, it will then be the dominant pole and the amplifier will be stable. But that will severly limit the bandwidht of the whole amplifier. – Bimpelrekkie Aug 19 '16 at 14:34
  • Yes - I even would say that such a device cannot be regarded as a useful amplifier. – LvW Aug 19 '16 at 15:00

A comparator has an open collector output stage with limited current.

You can use a pullup R such as 1K and negative feedback ratios much higher values to make a poor man's amplifier biased similar to op amps.

After playing with one of these sound sensors for a bit, I have a couple observations.

  • The LM393 is used because it is dirt cheap - probably < 10 cents in qt.

  • The LM393 might be be able to be used with some negative feedback as an amplifier but this hasn't been tried. Probably because the board is supposed to be a general purpose board - also priced to be $2.00

  • There is zero gain on the microphone - except for built-in fet on the electret - as noted above. Expect outputs under 100mv - but still usable if you read the electret differentially and don't just try to threshold the output, as a bunch of online tutorials show. They have to scream or snap fingers next to the thing to get it do anything. Still you might as well buy an electret and bias it with a handful of resistors.

  • The digital output is hardly stable, and tends to oscillate. I had less noise when adding some pullup resistance 10K to VCC (this is from observations with a scope).

  • Finally the whole thing is really touchy and adjusting the 25 turn pot so that the green light is blinking (basically DC biasing the mic element) is absolutely necessary.

  • Low cost Chinese junk - using an op-amp and a couple of caps would result in vastly superior sensor - but hey - you get what you pay for. I suspect even AC coupling the input to the comparator would have infinitely improved things. At the cost of about 1-2 cents and three parts.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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