# Opamp error amplifier problem

Status
Not open for further replies.

#### maicael

##### Member
hello everyone,
i am a bit confused with some issues as i was experimenting on this circuit to understand it more.
i am trying to get a very fine control of Vout from the error amp circuit shown and this Vout is fed to a comparator which then compares it with a triangle wave created using a TL084 opamp and fed to the inverting input if the comparator.
Anyway from the diagram i am using a gain of 10 and with a 5v(ideally it will be 4.5V) reference my problem is figuring out the right resistor values to give a range of input voltage into pin 2 of the error amp so as to have fine control of Vout assuming that the triangle wave starts from say 1.8V to 10V.
Think of it this way-imagine i replaced the whole error amp with just a 10k pot going into pin 3 of the LM393 comprator then i would have very smooth control of the PWM output,but with the error amp i cant quite get it so i am wondering what will be the range of input voltage to pin 2 of the error amp.
hope you get what i am trying to say. thanks.

#### Attachments

• 767.3 KB Views: 120

#### ericgibbs

##### Well-Known Member
hi maicael,

The problem is when you have the divider resistors on the 10K input to the OPA, the gain is no longer 10.

Use a 10K pot in place of the OPA and connect it via a 10K resistor to the input of the LM393.
Also connect your 5V or 4.5V ref voltage via a 10K to the LM393.

E

#### ericgibbs

##### Well-Known Member
hi,
This should work OK for you.

E

#### Attachments

• 43.3 KB Views: 125

#### MrAl

##### Well-Known Member
hello everyone,
i am a bit confused with some issues as i was experimenting on this circuit to understand it more.
i am trying to get a very fine control of Vout from the error amp circuit shown and this Vout is fed to a comparator which then compares it with a triangle wave created using a TL084 opamp and fed to the inverting input if the comparator.
Anyway from the diagram i am using a gain of 10 and with a 5v(ideally it will be 4.5V) reference my problem is figuring out the right resistor values to give a range of input voltage into pin 2 of the error amp so as to have fine control of Vout assuming that the triangle wave starts from say 1.8V to 10V.
Think of it this way-imagine i replaced the whole error amp with just a 10k pot going into pin 3 of the LM393 comprator then i would have very smooth control of the PWM output,but with the error amp i cant quite get it so i am wondering what will be the range of input voltage to pin 2 of the error amp.
hope you get what i am trying to say. thanks.

Hi,

I couldnt help but ask is this supposed to be a true error amp or just a plain amplifier? I ask because a true error amp does not usually have resistive feedback because that limits the gain and less gain means more overall system steady state error. The idea of a true error amp is to compare the output signal to a reference signal and provide a corrective signal to the driver stage so as to reduce the difference between the inputs of the error amp (and thus that is a reduction in error).
However there is usually a capacitor network in the feedback to make the op amp act as an integrator so that it integrates the error over time. Sometimes that's just a single capacitor.

To give you a little example of how this might look on a scope, if the error is +1v then the op amp (integrator) output starts to ramp down to a lower voltage and that makes the driver provide less drive to the output and so the output goes down, and that means the error goes down. Say it does down to 0.1v, that means the op amp output starts to level off ramping down less now. As the error becomes close to zero, the op amp output levels off to a constant value and that is the value the driver needs to provide the correct output. If something changes after that (such as the load or supply voltage) then the error goes up or down which manes the op amp output start to ramp up or down to the new required voltage needed to correct the output again.

Last edited:

#### maicael

##### Member
Hi,

I couldnt help but ask is this supposed to be a true error amp or just a plain amplifier? I ask because a true error amp does not usually have resistive feedback because that limits the gain and less gain means more overall system steady state error. The idea of a true error amp is to compare the output signal to a reference signal and provide a corrective signal to the driver stage so as to reduce the difference between the inputs of the error amp (and thus that is a reduction in error).
However there is usually a capacitor network in the feedback to make the op amp act as an integrator so that it integrates the error over time. Sometimes that's just a single capacitor.

To give you a little example of how this might look on a scope, if the error is +1v then the op amp (integrator) output starts to ramp down to a lower voltage and that makes the driver provide less drive to the output and so the output goes down, and that means the error goes down. Say it does down to 0.1v, that means the op amp output starts to level off ramping down less now. As the error becomes close to zero, the op amp output levels off to a constant value and that is the value the driver needs to provide the correct output. If something changes after that (such as the load or supply voltage) then the error goes up or down which manes the op amp output start to ramp up or down to the new required voltage needed to correct the output again.
Hello Sir,
Yes it is indeed supposed to be a true error amp that will compare the output signal to a reference signal and provide a corrective signal to a driver stage.
i was trying to experiment with input voltages into the opamp to see how it responds.
So do you have any suggestions for me sir.

#### maicael

##### Member
hi maicael,

The problem is when you have the divider resistors on the 10K input to the OPA, the gain is no longer 10.

Use a 10K pot in place of the OPA and connect it via a 10K resistor to the input of the LM393.
Also connect your 5V or 4.5V ref voltage via a 10K to the LM393.

E
thanks for the pic explantion.
i get the part about using a 10k pot via a 10k resistor to the input of the LM393 but where do i connect the 5v or 4.5v ref via 10k into?
from the diagram i think you mistake my 5v ref to be a ramp but i am actually trying to build a true error amp where the ref voltage is a steady DC voltage being compared to an output voltage.
on a side note what is the role of the 10k and 1meg?

#### ericgibbs

##### Well-Known Member
hi,

The LM393's output can 'chatter' ie: switch Hi/Lo at a fast rate when the rise of the input ramp is slow, so we add a little positive feedback to ensure once the output changes state it will not chatter. Thats what the 100K and 10K do

#### maicael

##### Member
hi,

The LM393's output can 'chatter' ie: switch Hi/Lo at a fast rate when the rise of the input ramp is slow, so we add a little positive feedback to ensure once the output changes state it will not chatter. Thats what the 100K and 10K do
it means "chatter" is a something we do not want happening at all.
Now you talked about positive feedback and i am assuming this is because the "RAMP" is connected to the non-inverting input so my question is what if the situation was reversed where the "RAMP" is connected to the inverting input and the 10k pot to the non-inverting input,do we add a little negative feedback like in this pic using the 10k and the 1Meg?
i still await you opinion on the true error amp on how i can improve it.Thanks

#### MrAl

##### Well-Known Member
Hello Sir,
Yes it is indeed supposed to be a true error amp that will compare the output signal to a reference signal and provide a corrective signal to a driver stage.
i was trying to experiment with input voltages into the opamp to see how it responds.
So do you have any suggestions for me sir.

Hello again,

Here is a representative circuit with a true error amp in it. The error amp simply measures the difference between the reference voltage and the divided down output voltage and provides a drive signal to the output transistor.

Study the voltages carefully. Note that the voltages at the input to the op amp (the error amp here) are almost exactly the same. There is a slight difference due to gain only as this op amp has zero offset voltage, but in real life we might have more of a difference because of the offset voltage too. But it is instructive to study the error amp without any offset at first to learn how the gain affects the accuracy.

The most important point however is that the input voltages are nearly the same when the output is at the right level so the error amp no longer detects a difference and so the output signal (5.931183 volts) stays constant.

The reference voltage is 2.5v as shown, so the other terminal of the op amp also has to be 2.5v (or close to it), and that means if we want to get 5v output then we have to use a divider that with 5v at the top the center tap will be 2.5. If we wanted 10v out, then one or both of the divider resistors would have to change. With 10v out and 10k on the bottom of the divider we'd need a 30k resistor for the top resistor of the divider. That would put 2.5v again at the other op amp input when the output was 10v.

Note in the circuit shown the output is not exactly 5.000 volts, but is a little off. That's because the gain of the op amp is not infinite.

Note also this "op amp" has a pullup resistor, not what we usually find. I put that there because you seem to want to use a comparator and as Eric had shown you need a pullup resistor with that.

Note also the capacitor feedback of the op amp. That makes it an integrator so effectively the error gets integrated over time and that is partly how we get such a low error after steady state has been reached. The integration allows the op amp output to go to whatever level is necessary in order to provide enough drive to the transistor to keep the output at the set value of 5 volts (or very close to it). If for example we put a regular si diode in series with the base of the transistor the op amp output would go up by about 0.7v while everything else would stay almost the same.

#### Attachments

• 9.9 KB Views: 108
Last edited:

#### maicael

##### Member
Hello again,

Here is a representative circuit with a true error amp in it. The error amp simply measures the difference between the reference voltage and the divided down output voltage and provides a drive signal to the output transistor.

Study the voltages carefully. Note that the voltages at the input to the op amp (the error amp here) are almost exactly the same. There is a slight difference due to gain only as this op amp has zero offset voltage, but in real life we might have more of a difference because of the offset voltage too. But it is instructive to study the error amp without any offset at first to learn how the gain affects the accuracy.

The most important point however is that the input voltages are nearly the same when the output is at the right level so the error amp no longer detects a difference and so the output signal (5.931183 volts) stays constant.

The reference voltage is 2.5v as shown, so the other terminal of the op amp also has to be 2.5v (or close to it), and that means if we want to get 5v output then we have to use a divider that with 5v at the top the center tap will be 2.5. If we wanted 10v out, then one or both of the divider resistors would have to change. With 10v out and 10k on the bottom of the divider we'd need a 30k resistor for the top resistor of the divider. That would put 2.5v again at the other op amp input when the output was 10v.

Note in the circuit shown the output is not exactly 5.000 volts, but is a little off. That's because the gain of the op amp is not infinite.

Note also this "op amp" has a pullup resistor, not what we usually find. I put that there because you seem to want to use a comparator and as Eric had shown you need a pullup resistor with that.

Note also the capacitor feedback of the op amp. That makes it an integrator so effectively the error gets integrated over time and that is partly how we get such a low error after steady state has been reached. The integration allows the op amp output to go to whatever level is necessary in order to provide enough drive to the transistor to keep the output at the set value of 5 volts (or very close to it). If for example we put a regular si diode in series with the base of the transistor the op amp output would go up by about 0.7v while everything else would stay almost the same.
hello sir,
thanks you for the detailed explanation as i have learnt some new things,so from what you have told me so far i made some observations so help me confirm if these observations make any sense.
1) we could use a variable resistor in place of the 10k divider network and based on the what you said about having a 10V or a 5v output depending on the divider network,it means with a variable resistor we could have a range of output voltages from 5v to 10 v and the opamp input voltages would still stay almost thesame?
from careful studying and based on my interpretation i came up with a possible circuit which i could use but here are the changes i would make
1) a power supply of 12V will be used
2) i will use a 4.7k pull up resistor while the comparator will be an LM 393 since i will use a comparator.
3)reference voltage would be 5V(can i filter this voltage?)
4)10k divider will be replaced by a pot which will receive sample of output voltage using a LED/LDR optocoupler.
you can view the Pic.
Whats your thought on the suggestions and the pic?
on a side note is there any advantage to using a real opamp instead of a comparator?

#### Attachments

• 11.7 KB Views: 95
Last edited:

#### audioguru

##### Well-Known Member

Why are you messing with the DC level of the triangle wave? Instead you need to use the inverter sinewave output as negative feedback for an opamp with the generated sinewave as its input.

When the inverter output sinewave level becomes too small then the negative feedback is reduced which makes the output of the new opamp higher which increases the output of the inverter up to normal.
When the inverter output sinewave level becomes too high then the negative feedback is increased which makes the output of the new opamp lower which decreases the output of the inverter down to normal.

You probably need to adjust the phase of the negative feedback because the inverter output filter will change the phase.

#### MrAl

##### Well-Known Member
Hello again,

The first thing you should note is that the diagram you show in your last post would be used for example for a DC to DC converter not a DC to AC converter. If you intend to use this with a DC to AC converter (or an AC to AC converter) then we need to talk about doing it another way which either involves controlling the amplitude of the reference sine wave or controlling the amplitude of the triangle used to generate the PWM for the sine, or using piecewise dynamic sub-cycle control (as audioguru was talking about i think).

[1]
The input divider could be a pot but the lower resistor value should not go too low because that plays a part in the time constant of the integrator.

[2]
The pullup resistor should not be too close to the value of the parallel combination of R1 and R2. Even 2.2k isnt that great for use with two 10k resistors.

[3]
A DC reference voltage of 5v would not be a problem even if it was filtered with say a cap as long as the op amp common mode range could handle that level.

[4]
If you use a 10k pot then you might want to include a little series resistance with the new resistor connected between the pot arm and op amp input. That will keep the min resistance higher. Note when you use a pot R1 is the upper part of the pot resistance and R2 is the lower part.

[5]
Using an op amp keeps the integrator more symmetrical. Using a comparator means we need a pullup which alters this which means positive errors take longer to correct than negative errors. This problem can be minimized by keeping the pullup resistor much lower in value than the parallel combination of R1 and R2 (plus any additional series resistance). In cases where the response can be slow it may not matter if the integrator is not symmetrical.

[6]
For example say we use a 10k pot and adjust it with 9k on top and 1k on bottom. If we use an additional 10k in series with the pot arm, then we have a total of 9k in parallel with 1k in series with 10k, which comes out to 10.9k (or very roughly 11k). If we use a pullup of 2.2k the ratio of the pullup to the total series resistance is approximately 2.2/11=0.2 which expressed as a fraction is 1/5, and that's about the maximum that should be used. A pullup value of 4.4k would give us 4.4/11=0.4 which is too high, so 4.7k would not be as good as 2.2k unless we increase the series resistance to 20k. That would give us about 4.7/21=0.22 which is still a little high but not too bad. A series resistance of 30k would give us about 4.7/31=0.15 which is better. We dont want to go too high on the series resistance though.
The whole idea is to keep the pullup value comparably lower than the total equivalent input series resistance without going too high with the additional resistance, and a guideline would be 20 percent as a max with 10 percent being better and 5 percent even better., and of course 30 percent being unacceptable.

Last edited:

#### maicael

##### Member

Why are you messing with the DC level of the triangle wave? Instead you need to use the inverter sinewave output as negative feedback for an opamp with the generated sinewave as its input.

When the inverter output sinewave level becomes too small then the negative feedback is reduced which makes the output of the new opamp higher which increases the output of the inverter up to normal.
When the inverter output sinewave level becomes too high then the negative feedback is increased which makes the output of the new opamp lower which decreases the output of the inverter down to normal.

You probably need to adjust the phase of the negative feedback because the inverter output filter will change the phase.
hello Sir,
actually this question is not really concerning the pure sine wave inverter i am building as i perfectly understand what you said i should do by using the inverter sinewave output, but it was more of trying to understand something just like wanting to have a general knowledge of differnt areas as i read a lot.
i picked up a book where error amps were designed and different areas they are used like for so from there i tried to tinker a little bit and build this circuits to see how they work and as they say no knowledge is wasted.
Pardon me if i seem to confuse anyone,i just read alot and ask questions when i dont get something.

#### maicael

##### Member
Hello again,

The first thing you should note is that the diagram you show in your last post would be used for example for a DC to DC converter not a DC to AC converter. If you intend to use this with a DC to AC converter (or an AC to AC converter) then we need to talk about doing it another way which either involves controlling the amplitude of the reference sine wave or controlling the amplitude of the triangle used to generate the PWM for the sine, or using piecewise dynamic sub-cycle control (as audioguru was talking about i think).

[1]
The input divider could be a pot but the lower resistor value should not go too low because that plays a part in the time constant of the integrator.

[2]
The pullup resistor should not be too close to the value of the parallel combination of R1 and R2. Even 2.2k isnt that great for use with two 10k resistors.

[3]
A DC reference voltage of 5v would not be a problem even if it was filtered with say a cap as long as the op amp common mode range could handle that level.

[4]
If you use a 10k pot then you might want to include a little series resistance with the new resistor connected between the pot arm and op amp input. That will keep the min resistance higher. Note when you use a pot R1 is the upper part of the pot resistance and R2 is the lower part.

[5]
Using an op amp keeps the integrator more symmetrical. Using a comparator means we need a pullup which alters this which means positive errors take longer to correct than negative errors. This problem can be minimized by keeping the pullup resistor much lower in value than the parallel combination of R1 and R2 (plus any additional series resistance). In cases where the response can be slow it may not matter if the integrator is not symmetrical.

[6]
For example say we use a 10k pot and adjust it with 9k on top and 1k on bottom. If we use an additional 10k in series with the pot arm, then we have a total of 9k in parallel with 1k in series with 10k, which comes out to 10.9k (or very roughly 11k). If we use a pullup of 2.2k the ratio of the pullup to the total series resistance is approximately 2.2/11=0.2 which expressed as a fraction is 1/5, and that's about the maximum that should be used. A pullup value of 4.4k would give us 4.4/11=0.4 which is too high, so 4.7k would not be as good as 2.2k unless we increase the series resistance to 20k. That would give us about 4.7/21=0.22 which is still a little high but not too bad. A series resistance of 30k would give us about 4.7/31=0.15 which is better. We dont want to go too high on the series resistance though.
The whole idea is to keep the pullup value comparably lower than the total equivalent input series resistance without going too high with the additional resistance, and a guideline would be 20 percent as a max with 10 percent being better and 5 percent even better., and of course 30 percent being unacceptable.
hello,
i am looking at the capacitive feedback and if i used an true opamp then fom the pic i would just get rid of the pull up resistor and connect the cap directly to the output of the opamp and then power the opamp as it is?
i think i will try my hands on this amp circuit to know better

#### MrAl

##### Well-Known Member
Hello again,

Yes that's right. We dont need a pullup with a real op amp.

When you test this circuit force a change in some parameter like the load or even step up (or down or both) the reference voltage as you watch the output of the op amp. The o amp will ramp up or down to try to correct the new levels in the circuit.

You can even use a slow square wave for the reference signal rather than a DC signal. That will make the reference go up and down slowly and with that you can look at the output of the op amp and see it ramp up and down with each change in reference.

A simpler circuit is to take the output of the op amp and feed it back to the top of the divider. Then the defining equation is:

Vout=(Vref*A*(R2+R1))/(A*R2+R2+R1)

where
A is the internal gain of the op amps (usually high like 10000 or more),
R1 and R2 are the divider resistors as in the earlier schematic,
Vref is the reference voltage,
Vout is the output of the op amp.

You can use that to see how the gain A affects accuracy of the output.

Status
Not open for further replies.