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.

DC biasing to offset an AC sine wave to a positive values

Status
Not open for further replies.
I will post it soon. It is just a simple opamp with non inverting configuration. but output itself is unpredictable. maybe gain and voltage offset gives me tat result.
It should be 0 when Vin is 0 right?
By "Vin is 0" do you mean Vin connected to ground or Vin open? Vin must be connected to ground for Vin to be 0V.
 
I tried both ways and it gave me unpredictable results. Why max of 0.15V when there is no input? is it because of the 2mV input offset voltage?

My applications is like this
C.T > burden resistor > gain stage > DC bias > ADC

I need the gain stage because at low currents the C.T gives me mV range which needs amplifications before going to the DC bias stage.
 
Hi,


(See attached drawing)

First identify the components:
Vac is the input signal,
C1 the coupling capacitor,
R1 and R2 the resistive divider for DC biasing the AC signal,
R3 the ADC input current limiting resistor,
Vbatt just an arbitrary voltage source somewhere in the system,
Q1 the series transistor in a typical voltage regulator,
D1 and D2 the micro controller pin input protection diodes,
R4 the other load on the power supply (same power supply that connects to the uC chip).

Vac is 5.2vpp which is 2.6v peak and we use this for most of the calculations.
C1 is yet to be determined.
R1 and R2 are chosen, along with R3, to make sure the ADC input leakage
(shown as the plus and minus 1ua source inside the uC chip block)
drift doesnt effect the measurment by more than 1/2 bit over the full
temperature range.
To start, first we are going to place the DC level at v1 at one half the supply
voltage, which would be 2.5v . This requires R1=R2.
Now we'll figure out a decent value for R3.
R3 limits the current through diodes D1 and D2 in the event of a surge by Vac.
The max current of these diodes is usually around 20ma, but we'll use 10ma max
because this issue also requires R4 to have the ability to load the system enough
to keep Vcc from shooting high, as Q1 can not sink current. Also, during this
time R1 and R2 also can not sink current even though they are connected to Vcc
and ground.
Ok, so during the surge C1 is considered a voltage source, R1 and R2 are considered open,
the DC level at v1 was 2.5v but now changes, and Vac is at it's maximum level. Normally
this max level would be 2.6v but if there is a surge we might want to protect the circuit
up to say twice that level, or 5.2 volts. The diode drops are about 0.5v each,
so a surge of +2.6v is only going to push v1 up to 5.1v, so D1 wont forward bias
with only 0.1v across it, but for extra protection up to +5.2v we might see v1 go up to
5.2+5.2=10.4 volts. Now D1 conducts, and the voltage across R3 is 10.4-0.5-5=4.9v.
With 4.9v across it and limiting the current to 10ma, we need a resistor value
of 490 ohms.
However, the negative surge is more harmful so we calculate R3 with a negative
surge. With Vac down to -5.2v that could put -10.4v at v1. With that level and the
drop of D2 that means R3 has 10.4v-0.5v=9.9v across it. Limiting the current again
to 10ma we get a value of R3 equal to 990 ohm but we can use 1k.
Since the negative surge requires a larger value for R3 we use that value, so R3 is
equal to 1k ohms. Note this also allows some variations.
Now the negative surge goes through D2, so R4 is not involved. But the positive
surge does go through R4, so lets calculate that.
With R3=1k ohms and 4.9v across it we have a current of 4.9ma. This means R4
has to draw at least 4.9ma, so that puts the minimum load at 4.9ma. This would
be a resistor of value about 1k ohms, which would be required if there were no
other continuous loads on the system. This is with a series regulator, with a shunt
regulator we dont have to worry about R4 and can forget about that, as long as
the shunt regulator can take the extra 4.9ma.

Ok so we now have R3. Since that adds to the input resistance seen by the ADC, we
have to subtract that from the ADC requirement of 2.5k, and we get 1500 ohms for
the equivalent R1 R2 divider resistance. Since R1=R2, that means R1 and R2 can be
twice that value, which is 3000 ohms, but 3900 ohms would most likely work ok with
only a bit more error than 1/2 bit. Thus, R1=R2=3.9k as you already did.

Now that we have all the resistor values calculated, the only thing left is the
capacitor C1. We need to analyze the circuit for the voltage at v1 in order to
eventually be able to calculate the value of C1. This wont be too hard because
the AC voltage superimposes directly onto the DC voltage level, so the AC peak
simply adds to the DC level to calculate the two extreme levels at v1.
We know the quiescent DC level is 2.5v, and the impedance presented to the source
and C1 is the parallel combination of R1 and R2. This is because the voltage at
Vcc is considered to be supplied through a zero ohm impedance. Since we made
R1 and R2 equal to 3.9k, the combined impedance is simply half that, which is
1.95k, which we'll round up to 2k for simplicity.
Now we need to calculate the AC voltage at v1 given the Vac source alone. To do
this we put R1 in parallel with R2 with the lower end of R2 still connected to
ground. This gives us a circuit with a voltage source Vac and cap C1 in series
with a 2k resistor and the other end of the 2k resistor goes to ground. We
solve for the peak AC voltage level across the 2k resistor, then superimpose that
onto the DC level of 2.5v to get the min and max excursions at v1. We'll call this
new 2k resistor R5.
Since C1 and R5 are in series and we want the voltage across R5, we can use the
voltage divider formula:
v1=VacPk*Zdown/(Zup+Zdown)
where Zdown is simply R5=2k, and Zup is simply 1/(s*C1).
This gives us:
v1=VacPk*R5/(R5+1/(s*C1))
This is the AC component of v1 only.
If we simplify that a little, we get:
v1=(s*VacPk*C1*R5)/(s*C1*R5+1)
Now we substitute s=j*w into that equation and we get:
v1=(j*VacPk*w*C1*R5)/(j*w*C1*R5+1)
Solving that for the amplitude, we get:
v1=(VacPk*w*C1*R5)/sqrt(w^2*C1^2*R5^2+1)
and that is the peak AC component only so we'll write that as:
v1pkAC=(VacPk*w*C1*R5)/sqrt(w^2*C1^2*R5^2+1)
Now we want to express this as a ratio to the input VacPk so we divide both sides
by VacPk and we get:
v1pkAC/VacPk=(w*C1*R5)/sqrt(w^2*C1^2*R5^2+1)
and replace the left hand side that with the letter 'p':
p=(w*C1*R5)/sqrt(w^2*C1^2*R5^2+1)
This is the fractional percentage of the AC input that reaches the node v1.
Solving that for C1 we get two solutions, one of which is negative and since
we dont want a negative capacitance we choose the positive solution:
C1=p/(sqrt(1-p^2)*w*R5)
and recalling that R5 is just the parallel combo of R1 and R2:
R5=R1*R2/(R1+R2)
and subtituting that into the equation for C1 and simplifying we get:
C1=(p*(R2+R1))/(sqrt(1-p^2)*w*R1*R2)
This result allows us to calculate the value of C1 in order to attain a given
percentage of the AC input at v1. Since the input is 2.6v and we would want
(as you mentioned) 4.2-0.4 voltage range, we note that that particular range
does not center at 2.5v so we would not be able to use the same value
resistors for R1 and R2. However, 4.6 and 0.4v does center, so lets use that
for now.

(4.6-0.4)/2=4.2/2=2.1 peak, so p would be:
2.1/2.6=0.808 approximately.
Sticking this into the equation for C1, we get:
C1=0.391uf approximately.

Now if we did everything right, we should get a value of 4.6v peak at v1 with
an input of 2.6v peak. Since we already have the equation for the AC component:
v1pkAC=(VacPk*w*C1*R5)/sqrt(w^2*C1^2*R5^2+1)
we can calculate v1pkAC and check our results.
Plugging all the values into that equation, we get:
v1pkAC=2.1001vpk
and adding that to the 2.5v DC level we get:
v1pkAC=2.5+2.1=4.6 as expected, and subtracting that from 2.5 we get:
v1pkAC=2.5-2.1=0.4 as expected so everything worked out ok.
Lastly, you should check this result with a circuit analysis program
because we still could have made a mistake somewhere.


There's also another way to do this circuit if the AC source is isolated from the
DC supply ground. Usually it isnt, so i didnt include that yet.

Because we used a capacitor for part of the attenuator, the voltage will change with frequency.
This means the frequency can not change, and if it does you'll need to analyze that to see what
kind of error to expect. Alternately, you could measure the frequency too (using the same
input pin) so you could factor that into the algorithm.
 

Attachments

  • ADC-Interface-01.gif
    ADC-Interface-01.gif
    10 KB · Views: 207
Last edited:
Hi,

You could isolate the AC ground from the DC ground with a transformer.

The reason for the output of 0.15v would be yes because of the max 2mv input offset. It may be less for your actual part though.
 
Gracias MrAl!

Hi,
(See attached drawing)

Gracias MrAl for the explanation. I will see how much I can grasp. I always overlooked all related with protection diodes.

Above all, thanks for your time!!
 
Last edited:
De nada (you're welcome).
 
Hi there,

One way to look at this is to calculate the capacitance required to get the resistive divider center tap to respond up to a percentage of the input.
For example, if we have a 1v peak input and we want the center tap to be within 90 percent of that value, it would reach 0.9v peak relative to the center tap dc value and everything else could be scaled accordingly.

The formula to calculate the capacitance is this:
C=(p*(R2+R1))/(sqrt(1-p^2)*w*R1*R2)
where
C is the capacitance in Farads,
p is the percentage,
R1 is the upper resistor (normally),
R2 is the lower resistor,
w is the angular frequency 2*pi*f where f is the frequency in Hertz.

For example, we have an ADC which reads the center tap, and its max input resistance for decent accuracy is 5k ohms. If we choose R1=10k and R2=10k the input resistance presented to the ADC is 5k ohms, so we satisfied that requirement. Next, we need to calculate the capacitance required to couple the signal to the resistive divider, so we use the equation above. Let's say we want 99 percent of the input to appear at the center tap (a reasonable amount). That means we make 'p' equal to 0.99. Since we are operating at 60 Hz, we make f=60, and since R1 and R2 are both 10k we use those values also, so we get:
C=(p*(R2+R1))/(sqrt(1-p^2)*w*R1*R2)
C=(0.99*(10000+10000))/(sqrt(1-0.99^2)*2*pi*60*10000*10000)
and all we did there was replace the variables with their values, and we get:
C=3.72e-6
which is about 3.7uf.

Now if we apply 1v peak to the input we will see 0.99v peak at the center tap, relative to the DC value there, so if we supply 5v DC to the resistive divider we would see 2.5+0.99=3.49 volts peak at the center of the resistive divider. The minimum value we would see at the tap is 2.50-0.99=1.51 volts. We would then make the algorithm to match this by scaling by the appropriate amount.

Note that if you need attenuation in addition to the coupling itself, you may need to insert a resistor in series with the cap to prevent the input from beaning the input to the ADC when the system is first switched on. This would require a few other calculations or some trial and error. Perhaps a better idea would be to use a clamp with some series resistance, or some series resistance and rely on the ADC input pin protection circuit to clamp the signal.
 
hi,

I have the simmilar problem,

I am using a ATMEGA32 to generate pwm signal. The PWM singal pass through a RC filter to produce 1 to 5V, typical pwm to Analog signal.

At the same time I am using a generator 96Vpp. I want to shift the generator voltage up by the analog signal from the RC filter. The current draw from the analog signal is very less.

I am new to electronic circuits can anyone please suggest me which topics or circuits i can use to develop the concept

thank you.
 
Hi,

You should start your own thread for this. In that thread you can mention if you are using AC for the generator and you want to shift that up by a smaller AC votlage or by a DC voltage (offset).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top