Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

operational amplifier ---comparator

Status
Not open for further replies.

boro3

Member
Hello to all,
i have a question about op amp circuits.
is it possible to use an comparator to compare an ac sinal with a dc signal?
OPamp.png

lets say the circuit is going from a plug board 110V rms,
to a transformer with 5V rms on the second side.
If i make the circuit as shown in the picture ive uploaded, and if R1 is =R2, so Vr is 2.5V.
would Vout be high if the potential at point X is greater than 2.5V?
what makes me unsure is, that the transformer doenst have a ground, so there is no reference point for X,
i hope you understand what i mean, and sory for my painting skills :D
 
Yes it is possible. Your circuit has a few issues though:

1. The op-amp needs to share it's ground (0V) with the ground of the DC reference on the inverting input as well as the transformer secondary (i.e. a center-tap if it has one). If the transformer doesn't have a center-tap, then you need to work around that like using a symmetrical resistive/capacitive divider (or both in parallel) to simulate a center-tap. That is one way to provide a reference for point X.

2. If a transformer says 5V on the secondary, that's 5V RMS, which means a peak voltage of 7.07V which is too high for your 5V op-amp. If you get a transformer that steps down to 3Vrms, then it will produce 4.24 peak voltage which is better.

3. I'm not sure what those 3 components are at the non-inverting input are supposed to be resistive dividers or something else but if you have a 3Vrms output transformer then you don't need them, and if you have a 5Vrms output transformer then you don't need them either. Just use a series resistor followed by rail clamp diodes.

4. Consider rail clamp diodes to on the non-invertting input of the op-amp even if you have a 3Vrms output transformer.
 
Last edited:
There needs to be "ground" or ref. point on the transformer/resistor divider.
Now. from the amplifier's point of view, it is looking for something that is 2.5V above its ground. (actually the 5V battery circuit needs a ground)
So the way things are drawn neither input of the opamp has a ground and you have double troubles.

Maybe we need to know what you want to do. Are you just trying to see if the 110VAC is there.
 
No it makes no sense because you have two systems without a common ground. That basically means - because of stray capacitance, the circuit may seem to work fine (not in a simulation but on a bread board, and because it works for the wrong reasons and therefor your assumptions so to speak) but when unpluggin from main, it will likely behave very erratic.

You may just do this:

[edit]
a little late answer due to drawing and some other thing to to in meantime. I think averyone trying to tell the same anyway.
 

Attachments

  • OPamp_customlinesadded.svg.png
    OPamp_customlinesadded.svg.png
    29.1 KB · Views: 118
See attached. The rail diodes clamp the voltage if it gets higher than 5+0.7V or below -5-0.7V and protects the op-amp. The series resistor limits the current through the diodes so they don't burn out. These are not optional if you are using a 24:1 transformer or a transformer that has a 5Vrms output since it will actually output a peak of 7.07V.

The resistive and capacitive divider make a virtual center-tap to provide a 0V from the transformer. It can't supply much current so it can only be used as a reference voltage (can't draw power through it). It's connected to the ground of the 2.5V reference and the op-amp so everything has the same reference voltage. You need this so all three parts of the circuit have voltages that make sense to every other part.

Also ignore the op-amp text...it supposed to be a comparator.
 

Attachments

  • Capture.PNG
    Capture.PNG
    111.1 KB · Views: 122
Last edited:
what makes me unsure is, that the transformer doenst have a ground, so there is no reference point for X
You are very close with your drawing, but you are correct - the circuit will not work without some kind of connection between the transformer secondary and the comparator circuit. Here is one way to do that. If the transformer secondary is 5 Vrms, then its positive peak voltage is 7.07 V. Dividing this by 2 reduces it to 3.54 V, which is within the power supply voltages of the opamp. Diode D1 protects the opamp from the transformer's -7.07 V negative peaks.

Notice that there is no -5 V supply to the opamp. You don't say what your opamp part number is, so you might need one. The LM358 is designed specifically to operate with a single +5 V supply.

ak
AC-Comparator-1.gif
 
For your interest, below is the LTspice simulation of AK's circuit:

upload_2018-3-2_15-54-28.png
 
Here we are trying to make the best circuit with out more feedback from Boro3.
so there is no reference point
This give me the idea we need a opto isolator. A opto-isolator + resistor can read the voltage on the transformer side. Send that data across the isolation to a op-amp. This way the two different circuits can work with out a common ground.
 
Thank you all for the answer,
this Forum is awesome,


so i can just connect the transformer with the ground of the op amp supply ?
wouldnt this Kind of Connection be dangerous (short circuit etc)
 
If you deal with bare transformer where you can potentially touch the terminals on primary side - yes then it is potentially dangerous and you should consider dropping the project if you doesn't feel completely safe about it.
 
Some transformers do not have insulated wires coming out of the windings. they have pins that wires are soldered to. The exposed pin is dangerous on the primary side, because you can make direct contact with the 120 Vac.

The schematic as shown is safe for the circuit. Transformer current into the circuit is limited by the 10K resistors, and the R1/R2 voltage divider attenuates the peak voltage to a value that the opamp can handle.

Based on the information you have given us, there can be no "short circuit". One of the big advantages of transformer-isolated signals is that they can be connected together like this. If the output of the opamp goes off to some other circuit with its own power supply, then we need more information to evaluate any potential problems.

ak
 
i just want to make some experiments and learn electronics,
ronsimpson has wrote about optoisolator and resistor,
could you please write how the connections would be?



and whats about this circuit, is it right ?
this time i want to use the opamp as a differential amp.
the output of the amp. could go for example to an oscilloscope .
dif.amp.png
 
this time i want to use the opamp as a differential amp.
Why do you want it differential?
What is its purpose?
 
Last edited:
A opto isolator is a device with a LED on the left and a photo transistor on the right side. When current passes through the LED, it makes light, which turns on the transistor. Because the LED and transistor are not connected together there is isolation. (just light connects the two half's of the part)

U1 LED is connected backwards compared to U2 LED. So one turns on when the transformer is positive and the other turns on when the transformer is negative. On the "OUT" put you will see U1 pulling up OR U2 pulling down . That should be a square wave (more or less)
upload_2018-3-3_14-45-12.png
 
@crutshow
for security reason,
in case the secondary side has more the 5v rms,
if i use a 1:1 transformer,
it wold be possible to connect the oscilloscope with resistive divider directly to the secondary side to measure the voltage over the resistor,
but this could be a bit dangerous i think.

if i use a diff.amp and there is an error, the max voltage going to the osci would be the supply voltage of the diff amp, wich is much less than 100v.
am i right?



osci.png

ronsimpson
thx for the explanation,
i thought you meant, it would be possible to track the sinusoidal curve of the transformer output with the optoisolator :D
 
Hello Guys,
Nobody has an Answer?
is it necessary to have a common ground between secondery side and opamp if i use it as differential amp?
because the difference schould be independent of ground, so i can use it without connecting secondary side of the transformer with the ground of the opamp right?
 
Hello Guys,
Nobody has an Answer?
is it necessary to have a common ground between secondery side and opamp if i use it as differential amp?
because the difference schould be independent of ground, so i can use it without connecting secondary side of the transformer with the ground of the opamp right?
Yes, still necessary. Differential inputs only means that the MEASUREMENT is independent of ground. It doesn't mean that the signal is independent of ground. The internal function of the amplifier itself still needs currents to flow into the inputs and through ground and it still relates ground to the inputs in some way. An example of this is the way that the differential signal can't stray too far from ground or the amplifier won't work anymore, like how you can't apply 30V and 29V and still have the amplifier measure 1V because the common mode voltage at the differential inputs is too far away from ground.

Differential measurement just means that ground is not used as the reference in the measurement. It is not the same thing as saying ground is no longer needed. It's a bit like measuring the distance between the 3rd and 4rth floor of a building:
1. You can measure the floors with respect to ground and then subtract them to find their distance between each other (non-differential).

2. Or you can measure the distance between the 3rd and 4rth floor directly (differential measurement). The ground doesn't play a role in the measurement, but the ground still needs to be there for the building to sit on. Without the ground for the building to sit on, everything stops working.

If you're trying to measure the distance between the 499th and 500th floor, you might not be able to measure it at all even though your measuring tape is long enough to measure the distance between the floors directly (differential measurement) because you don't have a crane that can reach high enough for you to use your measuring tape (the diifferential input voltage is within op-amp limits but the common mode input voltage is too high).

Everything still depends on ground to function even though the measurement doesn't depend on ground and nothing is being measured with ground as the reference.

For it to be truly independent of ground, the differential inputs of the op-amp would have to be floating, which it is not.
 
Last edited:
Thank you very much,
my thought was to connect it like this ?
Because the 5 Vac secondary is completely floating, that probably will work.

What is it you are trying to do? What is the output of the opamp used for?

ak
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top