# The need for a Comparator

Hello i have an op amp shown here:

If i connect a speaker to the output of it the audio signal is amplified. So far so good. But if i connect an LED to the output of the amplifier it doesn't turn on.

And if i feed a comparator from amplifier's output, and connect the LED to the output of the comparator this time the LED turns on.

What is the function of comparator here? Why doesn't LED turn on just after the amplifier?

-
Because the LED and the amplifier have different voltage and current requirement. Check the output of the op-amp, if its peaks are below the turn-on voltage of the LED, or if they are higher only for a short time, probably you're expecting too much. – clabacchio Apr 3 '12 at 7:43
datasheets for your op-amp and LED would help us give you a better answer to your question. – The Photon Apr 3 '12 at 18:49
Voted to close until the questions in my answer are answered. – stevenvh May 11 '12 at 8:33

There's a lot you're not telling us. In fact we hardly know anything:

• What's the audio signal (level, DC bias)?
• What type is the opamp?
• How is the LED connected to the opamp (to ground or Vcc)?
• What type is the comparator?
• What's the comparator's threshold?
• How's the opamp connected to the comparator (+ or - input)?
• How is the LED connected to the comparator (to ground or Vcc)?

I'll assume the audio signal is pure AC, without DC bias. That means that you'll only amplify the positive part of the signal, so what you hear through the speaker will be very much distorted. If the input signal is at line level (about 500mV RMS) anything above 50mV will be clipped to Vcc, and you'll have little of your signal left. Add to this that a typical opamp only supplies 20mA, then you'll have 3mW in an 8$\Omega$ speaker. That's not much, but should be audible if the signal didn't clip like that. Anyway, if your output is most of the time at 5V a LED connected to 5V will only light very faintly.
When you add a comparator you'll be above the threshold almost all the time, so it makes sense that the LED lights up.

If the input signal is from a microphone it will be only a few mV, amplifying 100-fold will give a few 100mV at the output. That's low enough to light the LED if it's connected to Vcc, but too low to light it if connected to ground. If your comparator threshold is low enough (0V?), again you'll be above that for much of the time, and the LED will light.

So depending on your setting it can be explained that the LED doesn't (or hardly) light at the opamp, but does when connected to the comparator. Answer the questions and we'll be able to tell you more. In the mean time I'll vote to close the question until you're more specific.

-

RED/Yellow LED's are 1.2 ~ 1.4V , Green/ Blue/White 3~3.4V at 20mA typ. The comparator is just an amplifier that clips at 5V here with a gain of 100. Your audio just wasn't loud enough so you needed gain to drive the LED .... & current limiting resistor. THats all.

-
red or yellow are more like 2.1V. Lower than 1.5V is usually infrared. See this chart – stevenvh Apr 11 '12 at 7:17

An audio input is an "ac" wave form. It has both positive and negative voltage values. The amplifier shown in the image is an inverting op amp. The sound you are getting from the speaker is more than likely the inverted negative levels above 0 volts. I am guessing your comparator is functioning as an inverter. You might try adding an inverter IC at the output or use a CMOS inverter to double check. Is the output from the amplifier reading positive or negative? The diode needs a positive voltage around 1.4 volts to 'turn on'.

-
As of the moment I write this, the schematic in the question shows a non-inverting configuration, and this answer doesn't apply. – The Photon Apr 3 '12 at 18:47
There are several issues: first, it's a non-inverting amplifier; second if it's ac-coupled it doesn't make almost any difference; third, LEDs need different voltages to turn on, but usually it starts from 1.8 V. – clabacchio Apr 3 '12 at 20:28
My fault, I misread the op-amp. But please... learn proper English if your going to speak it, then correct my answer. Let me help you, maybe what you meant to say is "It doesn't matter if a voltage source is ac-coupled when the frequency is greater than 40Hz. But if the frequency is less than 40 Hz the LED TURNS OFF once every cycle." That almost makes sense. – atomSmasher Apr 4 '12 at 2:17
Would be glad to remove dv if you edit the answer. But its your answer, and your responsibility to edit it. I don't want to put words in your mouth. – The Photon Apr 4 '12 at 3:37
Also, even if the frequency is less than 40 Hz and the LED turns off every cycle, it doesn't matter if the signal is inverted or not. It turns off for half the cycle whether its the first half of the cycle or the second half of the cycle, and the end result is 50% duty cycle either way. – The Photon Apr 4 '12 at 3:38