Background: I am currently using a SparkFun Electret Microphone and I need to both filter and amplify the signal before turning it into a square wave to be interpreted by an FPGA.

The mic itself has a ~1.65 VDC offset and the signal amplitude is in the range of 200 mV. The mic is powered off of 3.3 V.

For amplification I am utilizing an LM324 powered off +/-2.5 V. For the conversion of the signal, I am using an LM339 comparator with a low pass "averaging" circuit and it is powered off of 3.3 V.

Issue: Both of these circuits work just fine independently of each other. The active filter does a pretty good job of attenuating room noise below the 8 kHz cutoff I had specified when I built it.

The LM339 with the "averaging" filter works just fine to convert the sine wave from the mic to a square wave as well.

The problem I am encountering is trying to integrate the two of them. When the output from the LM324 is fed into the comparator, I cannot seem to get any output out of the comparator.

I have simulated the circuit in LTSpice and the output is what I would expect to see in reality, but I cannot for the life of me get this to work. Images of the simulation are attached below.

  • Red trace is the simulated mic input
  • Green trace is the output from the active filter
  • Blue trace is the output from the comparator

Thanks in advance, any help is appreciated!

Schematic of Circuit

Output Traces

  • \$\begingroup\$ What output are you getting when you try to do it outside of simulation? Do you have an oscilloscope you can measure it with? That information would be helpful. \$\endgroup\$
    – Hearth
    May 4, 2017 at 3:08
  • \$\begingroup\$ Outside of the simulation I am getting the correct output from each of the circuits independently, but when I feed the output from the LM324 into the LM339 I get no output whatsoever from the comparator. Unfortunately I don't have any pictures of the traces right now... \$\endgroup\$
    – chalsey
    May 4, 2017 at 3:11
  • \$\begingroup\$ Where is your schematic? \$\endgroup\$
    – Andy aka
    May 4, 2017 at 7:39
  • \$\begingroup\$ Just to simplify things, the LM392 combines a single LM324-type opamp with a single LM339-type comparator in one package. \$\endgroup\$
    – user131342
    Nov 5, 2021 at 22:37
  • \$\begingroup\$ Your schematic shows a dynamic (coil and magnet) mic, not an electret mic that must be powered. Are you using the Sparkfun electret mic plus preamp module that has a minimum supply of 2.7V? \$\endgroup\$
    – Audioguru
    Jan 26 at 3:03

3 Answers 3


If your op amp output in real life looks how it does in the Sim then I would bet that you are violating at least the single ended input voltage range of the comparator, if not the input common mode range as well. Your comparator negative supply voltage is 0V.


First, I'm going to assume that you have verified that the output of the LM324 is operating between -1 and +1 volts.

With that said, look at the data sheet for the LM339, under absolute maximums. Note that the maximum input voltage range is -0.3 to Vcc - 1.5 volts. You are applying -1 volt to the - input.

Do you see a problem?

You need to level-shift the input to the 339. Make another high-pass network, something like


simulate this circuit – Schematic created using CircuitLab

This will bias your inputs to about 1 volt, and allow a voltage swing of about 0 to 2 volts. Notice that this will violate the max input of 1.8 volts, so you may want to decrease the gain of your LM324 stage.

Secondly, if all you're trying to do is convert a sine to a square, why do you have the phase-shift network R4/C2?


Use a LM311 comparator which can have bipolar +&- voltage supplies and have the output swing between Ground (0V) and the positive supply.


Your Answer

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

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