Op-amp as a comparator.

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is my circuit.
I'm actually confused about its practical action.

 

Also a bit afraid!

শূন্য  - The ZeRo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You will be applying a negative voltage to the + input of the OP Amp during half of the AC cycle.

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Op-amps, generally, make poor comparators. The reasons are pretty subtle.

 

1. Op-amps tend to be pretty slow, going from + saturation to - saturation, or visa versa. The internal circuit is simply not designed to function this way.

 

2. The input offset will tend to change, over time, due to being held at a large differential voltage. An op-amp is designed to operate with the two inputs at very close to the same voltage. That does not happen with a comparator. 

 

If you have access to LM324, you probably can also get LM319, which is a far better choice.

 

That said, frog_jr is absolutely correct. Input on pin 3 is subject to negative input voltages when the device has one power supply terminal grounded. This will result in voltages that exceed the Absolute Maximum ratings. The device will fail, and probably sooner rather than later. A different circuit is needed.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Of course one could put a diode in series with the Pin 3 input to block the neg  1/2 cycles, so there is an easy fox for that.

One then biases the input to be off when there is no + 1/2 cycle.

 

The output, however, wont be 50% duty cycle, but often, when one simply wants a clock signal, 50% duty cycle isn't needed.

 

Although one should never argue with Jim !!, know that the 324 was often used as a comparator in the past.

Back in the day op-amp App Notes sometimes included comparator applications.

 

Know that the real concern is that the circuit is connected directly to the Mains.

It is easy to kill yourself.

It is easy to blow up your O'scope, (which is a problem, but better than killing yourself).

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Come on, please don't ever say not to "argue" with me. I am as capable of errors as anyone!

 

If you add a diode, as JC suggests, do it at the top of the divider. That way, the effect of forward drop of the divider also gets reduced by a factor of 100 (the divider ratio). JC is also correct that this circuit exposes you to full AC line hazard. Unlike the U.S., where the 220 line is balanced around a neutral (ground) point, that is often/usually not the case in other places. It is also very hazardous when you try to use an oscilloscope. I hope that you value your life and the function of your limbs!

 

Jim

 

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When using an AVR, any voltage level over one digit is something to avoid.  Hand it off to the electricians.  Hopefully the certified, competent union ones. 

 

For example, how do you know that the point that is selected as "ground" is actually going to be zero volts and stay at zero volts when you apply +400 volts to it?  220VAC is about 350 volts DC.  Electrical shocks at this level are like piranha bites.

 

Start with a transformer that reduces the 220VAC to about  9-12VAC.  Then test the circuit with 4.7K as R1 and 47 as R2.  Do a Google search on "safe zero-cross detector for 220VAC" and learn why the engineers who have managed to keep alive while working with 220VAC daily decided to implement a circuit design that is different from the first prototype rough draft that you have shown us.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks to all smiley

শূন্য  - The ZeRo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Putting say, a 100K Ohm to 10Meg Ohm resistor between non-inverting input (pin 3) and the output (pin 1) to the circuit above, will add hysteresis and a measure of protection against oscillation at the op-amp output as the sine-wave input transitions thru zero volts - especially for a very slow moving voltage levels around zero volts.

 

The rule of old, back in the vacuum tube days was... you ALWAYS mess with the wiring with the mains OFF and you take measurements with one hand in your back pocket to avoid becoming a victim of electric shock!

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

microcarl wrote:

The rule of old, back in the vacuum tube days was... you ALWAYS mess with the wiring with the mains OFF and you take measurements with one hand in your back pocket to avoid becoming a victim of electric shock!

 

But it still smarts!

The largest known prime number: 282589933-1

In my humble opinion, I'm always right. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

...

2. The input offset will tend to change, over time, due to being held at a large differential voltage. An op-amp is designed to operate with the two inputs at very close to the same voltage. That does not happen with a comparator. 

...

 

Jim

 

I agree that opamps are not very good comparators but I don't think reason (2) applies to bipolar devices, just CMOS versions.  The bias causes charges to migrate into the gate oxide.

 

kevin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

okay dear frog_jr,

 

I'm applying a negative voltage to the +input of Op-Amp during half of the AC cycle.

So thats why is Op-Amp's Output goes low during the negative voltage in +input pin?

শূন্য  - The ZeRo

Last Edited: Sun. Jun 5, 2016 - 02:10 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The main issue is that you may have exceeded the op-amp's input voltage rating.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the above schematic, one thing you are missing is input protection to the LM324 op-amp.

 

What do you think will happen if the 4.7K Ohm resistor (R1-R2 voltage divider) just happens to open?  It does happen - all too often.

 

What happens if the solder connections go rogue and open on either side of R2?  It happens - all too often.

 

Kirchhoff's voltage open-loop voltage rule comes into play at that point.

 

Basically, if R2 opens up, there will be approximately 170 VAC (peak-peak) applied to pin 3 of the LM324 op-amp.

 

I don't know if you've ever seen a semiconductor pop when 120 VAC RMS is applied to any of it's pins.

 

It'll be an early Fourth Of July at your house!

 

You should seriously consider some form of input protection for the LM324 op-amp!

 

 

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston