Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Different output of Amplifier with slightly changes at input side

Hayee

Member level 3
Member level 3
Joined
Mar 4, 2022
Messages
67
Helped
1
Reputation
2
Reaction score
3
Trophy points
8
Activity points
684
Hi Guys,
I am looking at the following 3 circuits. all of 3 circuits are slightly different but their outputs are different.
Circuit A has a scaled down output (full sinewave) with DC shift.
Circuit B has a scaled down output (half sinewave) with no DC shift
Circuit C is giving pulses at output act as a zero crossing.

I want to know that how to mathematically calculate the resistance values and how these slightly difference in configuration make different output. Mean how I know that by doing this I will get these responses
Kindly guide me


circuit_A.jpg

circuit_B.jpg

circuit_C.jpg


Thanks
 
Hi,

The usual way is:
* FIRST you have a task, a problem ... to solve. It is defined by specifications, by requirements, .. usually numbers with units.
* THEN you look for a suitable circuit .. to fulfill your requirements. OPAMP circuits are well documented, all behaviour is explained, formulae are given.
* THEN you do the math according the law of physics.

BUT you do ... FIRST taking random (for us) circuits and .. you seem to test them.
THEM you try to find (backwards) why they act the way they do.
All circuits act like expected.

You give no information where the circuits are from. These sources usually give the necessary context ... to know how they work, the use cases, the limits ...

****
All circuits seem to be randomly modified (by you?) ... and some miss informations.

1st circuit:
* What voltage is R7 connected to?
* why is R7 value different from R13 value?
* What is the use of R3 and R6?

2nd circuit:
* You can not expect negative output voltage while the supply voltage is not negative. In other words: The output voltage can only be within the supply voltage rails.

3rd circuit:
* You simply overdrive the -INP to a non allowed level. --> keep on datasheet
* missing negative output --> see 2nd circuit

***
Again: My recomendation: Do the learning/designing in the right order. From theory to practice.
In times of internet (we did not have) use it. There are so many good tutorials. All for free, all accessable within seconds.


Klaus
 
Input is AC line, R7, R9 connected to neutral ? And for purposes of sim
circuit ground is at same potential as Neutral ?

The mathematical approach is write node/loop equations and model, for your
purposes, the OpAmp as (where A is quite large, 25,000 min for LM258A, Zin also
quite large, I would ignore, eg. let it be infinity) :


1730284367765.png


After you write the equations you will see that large A (gain) in the opamp many
terms in the equations drop out in the limit, and simple equations are left. Do
a simple case to get a feel, ground + input, place a R output to - input, place a R
from input V source to - input, and solve with that model. Then evaluate the
resulting equation letting A go to infinity. Assume Zin infinity (not even in the circuit),
and Zout 0 for simplicity. More exact analysis takes into account those effects,
especially as A drop with increased frequency, and has large effects on OpAmp
circuit at high frequency as OpAmp gain approaches 0. The AC model for OpAmp looks like
a high DC A (gain) followed by a low pass filter, eg, A rolls off as freq increases.
But dont tackle the AC effects as you seem to be doing AC line freq work where
A is still quite large.

 
Last edited:
Here is the original circuit

1st circuit:
* What voltage is R7 connected to?
* why is R7 value different from R13 value?
* What is the use of R3 and R6?
R7 and R9 is connected to 5v.
I was seeing this circuit on internet and just tried to simulate this on the software to check the results.
Then i do changes to see the behavior of the circuits.

2nd circuit:
* You can not expect negative output voltage while the supply voltage is not negative. In other words: The output voltage can only be within the supply voltage rails.
will R7 and R9 not add the DC biasing and shift the waveform?

3rd circuit:
* You simply overdrive the -INP to a non allowed level. --> keep on datasheet
* missing negative output --> see 2nd circuit
overdrive the -INP? How you check it and how i can see all these things by myself?
 
overdrive the -INP? How you check it and how i can see all these things by myself?
My bad: it should be "+INP". You overdrive +INP.
And to check a node voltage, simply connect it to your scope. And look at the datasheet what it specifies for +INP.

Everything is well explained in the site you linked to.
I´ve seen only minor mistakes.

So if you want to understand the circuit --> read the text in the link
If you have problems in understanding the text --> ask a detailed question with referencing the text.

Klaus
 
Guys I tried to understand the circuit but the output voltage by formula is not same as in the simulation. simulation is showing approx 10v output but my calculations showing 24v. Where I am doing wrong?

Applied voltage is 230Vrms (311Vpeak) to the differential amplifier

R1,R2 and R7 are acting like a voltage divider. so the voltage at R2&R7 junction will be
(R7/(R1 + R2 + R7)) * Vin
(4.7k/(3M + 3M + 4.7k)) * 311 = 0.243v

same formula will be applied for R4,R5 and R9 but this is opposite to the R1,R2 and R7 so the result will be -0.243v

if we see R7 and R9 is pulled to 5v.
The input for R3 will be swing along 5v. like 5 + 0.243 = 5.243v, and 5 - 0.243 = 4.757v

The input for R6 will be swing along 5v. like 5 + 0.243 = 5.243v, and 5 - 0.243 = 4.757v but this signal will be opposite to that of R3

Now the differential formula will be applied
Vout = (Rf/Rin)(VR6 - VR3)
Vout = (1M/20k)(5.243 - 4.757)
Vout = (50)(0.486)
Vout = 24.3v

1730708663019.png
 
but still you use a different / modified circuit ... This won´t work.
--> the formula is for a specific circuit ... and if you modify (or use a different one) the circuit .. you need to modify the formula accordingly.

and you do math (which is a good thing) for R3, R6 voltages.. but I miss that you used your simulation to verify your math.

You write about 311V ... but I don´t see any evidence that you indeed simulated with this 311V.
--> if you do the math with +311V (or -311V) ... then do the simulation with the exact values like your math. To see if your expectations match.

Your circuit shows AC input, but -311V is not an AC input. There is no negative AC value.
I understand you tried to "simulate the peak(s) of the 230V AC". Nothing wrong with it.
So you could either use
* +311V DC ... and do the simulation ... then use -311V DC and use the simulation --> to verify your math
* or use 230V AC .... but then focus on the "exact time" when the sine is at it´s peak --> to verify your math
***

Also I recommended to set up your requirements FIRST ... to decide how you want your circuit to operate.
I still miss a description / specification how you want your circuit to operate.

***
Also Dana asked very important questions: like how is AC_NEUTRAL and your circuit_GND related to each other.
(in your simulation AC input is floating ... but your math rather is for the opposite: GND and NEUTRAL being shorted.)

It´s not that we like to annoy you with questions ... we need the informations to help you.

Klaus
 
OK My bad.
What I want is to read AC voltage in microcontroller for this I decided to use Op-Amp (differential mode). The following circuit I want to use for this.

1730715627822.png

1730715656688.png

I just check that in simulation software the Vsine was set to Amplitude 325 and the oscilloscope is showing the Peak of 162.5v which I now corrected and set the Amplitude to 650 (its Peak-to-Peak). so the Vpeak goes to 325v.as this can be seen on oscilloscope.

Now I again test the results.
According to calculations, Vout will be 24.3v and the simulation shows 20.50v (I changed the Vcc of OP-Amp to just verify the output voltage. otherwise if i use 12V then the output will be clipped)
I think its close but you guys better tell me if this is OK or I am again missing something.


Regarding Neutral and Gnd of circuit they both are not connected to each other by any means of Resistance. so yes the AC Neutral is floating.


@KlausST kindly guide me if I want to combine the AC Neutral and Gnd of circuit then how to do these calculations because for this resistance will be required.

Hope this time I transfer the maximum specifications/details to you guys.
 
First things first:

* Define the AC input. Normal usage range ... and extreme values you are interested in.

* Define the expected output. Range: min peak, max peak ...

* define the expected accuracy / precision / resolution. At least a hint in form of a number.

***
GND connected with NEUTRAL:
advantage:
* more simple circuit design
* more simple to simulate
* known voltages differential as well as common mode

disadvantage:
* safety!!
* when connected you whole circuit (ADC, microcontroller) is related to mains. ONLY recommended when you know what you do. Not recommended for a plug that can be inserted the wrong way. Only recommended whren your whole circuit is in an isolating box and no cables, switches, display ... are accessible from outside.

--> Tell us if you want to chose "floating" or "connected"
***

--> again:
* Either use the exact circuit like in the link
* or tell us why you decide to use a different circuit

***
I can not help you if you hide informations.
Keep focussed. Step by step, not 5 steps in advance.
Communicate with us.

Klaus
 
Sim with DC op values shown :

1730720072462.png



Note model speced at 2 mV of offset, which ~ shows up in the sim.

Here DC offset just applied to NI signal path.

1730720907655.png


Here is sim changing DC bias V3 from 0 to 24 V, 5 steps -

1730721878149.png



Regards, Dana.
 
Last edited:
Thanks @KlausST for your time and response.

Here are details

1)
AC Input is 230Vrms.
Normal usage range is 90Vrms to 250Vrms
Extreme values. below 90Vrms or above 250Vrms microcontroller will take action.

2)
Maximum Output Peak of Op-Amp is 10Vpeak at 250Vrms. This peak then given to voltage divider to be in range between 0-5v for microcontroller

3)
resolution of microcontroller's ADC is 10bit
accuracy: microcontroller can read 1v change in Grid voltage. means 230Vrms, 231Vrms, 232Vrms etc

4)
regarding "floating" or "connected" I am still unclear about it. How this works and how to select from this

5)
original circuit's output is full wave with DC bias
and the circuit which I am deciding to use is giving half wave with no DC biasing. so I wanna use that.

Hope by these information I can move further.
--- Updated ---

@danadakk every impressive. Which simulation software you are using?
 
Last edited:
Simetrix, was Analog Devices goto until they bought out Linear Tech .

I think its vastly easier to use, especially probing facilities, than LTC Spice.


Regards, Dana.
 
2)
Maximum Output Peak of Op-Amp is 10Vpeak at 250Vrms. This peak then given to voltage divider to be in range between 0-5v for microcontroller
This is just an amplifer .. it is no sine to RMS converter or similar...
So output is same waveform as input.

Do you want to get RMS values? on the analog side or the digital side (by calculations inside the microcontroller)

But why would you use a voltage divider .. why not directly feed the microcontroller?

Microcontroller 0V ... 5V is good information.

So 250 VAC has the extrems of about +/- 350VPP.
0V (AC side) -->2.5V (Microcontroller side)
+350V --> +5V
-350V --> 0V
(Maybe reversed signs don´t matter)

One comment about the microcontroller input range. I guess that VCC of the microcontroller is 5V. Then maybe your ide is to use this 5V as reference to the ADC.
I never do this, because VCC is neither accurate nor stable. I always use a precise reference for my ADCs. Every inaccuracy of VRef will be 1:1 reflected to the digitial data. If VCC drifts by 2% your digital values will also drift by 2%. This is a no-go for me. But if you are fine with the expectable errors .. then go this way. You have to decide.

3)
resolution of microcontroller's ADC is 10bit
accuracy: microcontroller can read 1v change in Grid voltage. means 230Vrms, 231Vrms, 232Vrms etc
This has nothing to do with accuracy. Accuracy, precision ad resolution are 3 different things.
You just told that you are fine with an 1V resolution on the calculated RMS value.

Accuracy means: that the calculated value is allowed to be a bit off the exact value. Let´s say your analog input is 234.567V .. and the allowed accuracy error is +/-1% FS then the allowed error is+/- 1% of 250V (FS) = +/-2.5V.
This means 234.567V - 2.5V = 232.067V
to 234.567V +2.5V = 237.067V
Therefore valid RMS values are: 233V, 234V, 235V, 236V and 237V ... Everything else is beyond accuracy error of 1%.

4)
regarding "floating" or "connected" I am still unclear about it. How this works and how to select from this
no need to know how it works.
You just have to decide if you can live with the disadvantage or not. It´s just a yes/no decision.
HOW to solve it ... is a next step ... after you decided which way to go.

5)
original circuit's output is full wave with DC bias
and the circuit which I am deciding to use is giving half wave with no DC biasing. so I wanna use that.
This totally is against what a "guessed" from your #2 information.
So let´s first see what your #2 clarification shows .. then get back to this later.

Klaus
 
OK My bad.
What I want is to read AC voltage in microcontroller for this I decided to use Op-Amp (differential mode). The following circuit I want to use for this.

View attachment 195111
View attachment 195112
I just check that in simulation software the Vsine was set to Amplitude 325 and the oscilloscope is showing the Peak of 162.5v which I now corrected and set the Amplitude to 650 (its Peak-to-Peak). so the Vpeak goes to 325v.as this can be seen on oscilloscope.
Do as Klaus said. Make a Design Spec. add more details.

1. measure RMS, Avg, Vpp or samples in hardware
2. Signals must be filtered <= 1/3 of sample rate to avoid aliasing from interference.
3. Transients must be suppressed e.g. >400Vp transients MOV? or better TVS
3. Attenuate to 0V not 5V , it does nothing to bias Vcm. That is done by moving Rin+ to Vref/2 and not gnd !
4. consider how much margin you need for over voltage, resolution , under voltage
5. Add up all the tolerances of resistors that contribute to output error and consider more accurate ratiometric parts.
6. Add caps LPF for 1kHz (where attenuator R's are located to attenuate AM noise line switching transients, unless you want to measure these.
7. Define CMRR from resistor errors. This is where lightning noise is most common.
8. Think of things to go wrong and make a fault detection list for self-test.
9. Consider what indicators you need if it is not working.
10. learn a good simulator and verify with a test plan
keep thinking of more requirements.
 
This is just an amplifer .. it is no sine to RMS converter or similar...
So output is same waveform as input.

Do you want to get RMS values? on the analog side or the digital side (by calculations inside the microcontroller)

But why would you use a voltage divider .. why not directly feed the microcontroller?

Microcontroller 0V ... 5V is good information.

So 250 VAC has the extrems of about +/- 350VPP.
0V (AC side) -->2.5V (Microcontroller side)
+350V --> +5V
-350V --> 0V
(Maybe reversed signs don´t matter)

One comment about the microcontroller input range. I guess that VCC of the microcontroller is 5V. Then maybe your ide is to use this 5V as reference to the ADC.
I never do this, because VCC is neither accurate nor stable. I always use a precise reference for my ADCs. Every inaccuracy of VRef will be 1:1 reflected to the digitial data. If VCC drifts by 2% your digital values will also drift by 2%. This is a no-go for me. But if you are fine with the expectable errors .. then go this way. You have to decide.
Yes I know the output of Op-Amp is same as input. its not a sine to RMS converter. I will do the calculations of RMS inside the microcontroller.
If the amplitude of the output is within the 0-5V range then no need of voltage divider.

This has nothing to do with accuracy. Accuracy, precision ad resolution are 3 different things.
You just told that you are fine with an 1V resolution on the calculated RMS value.

Accuracy means: that the calculated value is allowed to be a bit off the exact value. Let´s say your analog input is 234.567V .. and the allowed accuracy error is +/-1% FS then the allowed error is+/- 1% of 250V (FS) = +/-2.5V.
This means 234.567V - 2.5V = 232.067V
to 234.567V +2.5V = 237.067V
Therefore valid RMS values are: 233V, 234V, 235V, 236V and 237V ... Everything else is beyond accuracy error of 1%.
Accuracy of 0.1% is required.

no need to know how it works.
You just have to decide if you can live with the disadvantage or not. It´s just a yes/no decision.
HOW to solve it ... is a next step ... after you decided which way to go.
ok i will go for connected mode. means neutral will be connected with GND.
 
Accuracy of 0.1% is required.
Then you most probably need to use an external ADC, since internal ADCs do not provide 0.1% accuracy.
And the REFerence is the next problem to satisfy 0.1% accuracy.

I´m not sure you (still) confuse accuracy with resolution. --> In doubt: read about it

ok i will go for connected mode. means neutral will be connected with GND.
This is the "unsafe" and "not recommended" method. Be sure to know the safety regulations and the risks. Please be sure not to hurt or kill people with your application.

But if you chose to do so ... please always do the connections accordingly in your simulation.
It makes a huge difference with the signals and it´s ranges.
In "connected mode" you don´t even need an amplifier. Still you MAY use it if you think it gives you a benefit.

****
Still waiting for clarification on #2 and #5 of your post#14.
I recommend to use a simple sketch to show the expected input waveform and the according expected output waveform.

Klaus
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top