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.

Passive LP filter design

Status
Not open for further replies.

ImperfectSeven

New Member
Hi there, I am trying to use a PWM as a DAC to set a reference voltage for my high voltage boost converter. Through my own research I have gathered what information I think is critical to this:
The PWM clock is 24 MHz
I want each bit to represent a 1V increase on the high voltage side and after some math found that I need 2268 bits.
This gives me a PWm frequency of 24 MHz/2268 bits = 10.58 kHz

From what I understand I need my low pass filter's 3dB point to be around 2 kHz
Also I have concluded that decreasing the ripple is more important than the settling time.
The ripple can be no more than 2 mV peak to peak as anything more will cause my high voltage to change.

With these conditions in mind I need to design an RC low pass filter, but my problem comes in that I don't know how to select the values for R and C.

So far I am using a 2nd order ladder configuration and I know that R[SUB]1[/SUB] >> R[SUB]2[/SUB] and that R[SUB]1[/SUB]C[SUB]1[/SUB]=R[SUB]2[/SUB]c[SUB]2[/SUB]

At this point however it seems to be a guess and check game to figure out the values of R and C, is this true?
 
bit to represent a 1V increase on the high voltage side and after some math found that I need 2268 bits.

So you want 0 to 2268 volts?

The ripple can be no more than 2 mV peak to peak

So you want an output of 2000 volts with only 2mV of ripple?
 
Hi,

A formula for the output ripple across the cap with an RC circuit with R1 charging and R2 across the cap is:

VripplePP=(Vs*b*(e^(a*t)-1)*(e^(a*T)-1))/(e^(a*T+a*t)-1)

where
a=(R1+R2)/(R1*R2*C),
b=R2/(R1+R2),
t=on time,
T=off time,
Vs is the source charging voltage,
R1 is the charging resistor,
R2 is across the capacitor C.

If you have no resistor R2 across the capacitor then use:
b=1
a=1/(R1*C)

Depending on the value of your resistors you may need a largeish cap.
 
This gives me a PWm frequency of 24 MHz/2268 bits = 10.58 kHz

At 10.58khz you have noise (5V p-p) that you want reduced down to 2mV p-p.
Why 2mV?

From what I understand I need my low pass filter's 3dB point to be around 2 kHz

Why 2khz?

You need a filter that is -3db at 2khz and -69db at 10.58khz. That's not a a simple RC filter.
 
At 10.58khz you have noise (5V p-p) that you want reduced down to 2mV p-p.
Why 2mV?



Why 2khz?

You need a filter that is -3db at 2khz and -69db at 10.58khz. That's not a a simple RC filter.

The PWM itself doesn't know it is doing anything high voltage.
It is going from 0 to 3.3V in 1.46mV intervals hence that 2268 counts.
I need the ripple to be less than 2mv p-p so that the ripple itself is not higher than each increment.
For example if my PWM is on for 1 count out of 2268 I can expect a 1.46mV on its output,
if it has a 2mV ripple p-p then my output is now anywhere from 0.46mV to 2.46mV which once I get to the end of my boost converter will result in a voltage anywhere from 0-2V
I know it doesn't seem like to much but I need to try to reduce that ripple so the fluctuation in my high voltage is gone.

VripplePP=(Vs*b*(e^(a*t)-1)*(e^(a*T)-1))/(e^(a*T+a*t)-1)

where
a=(R1+R2)/(R1*R2*C),
b=R2/(R1+R2),
t=on time,
T=off time,
Vs is the source charging voltage,
R1 is the charging resistor,
R2 is across the capacitor C.

If you have no resistor R2 across the capacitor then use:
b=1
a=1/(R1*C)

Is this just for a first order RC or for a second order?
 
Last edited:
Hi again,


That is an exact expression for a first order RC filter. If you want to use second order then we can estimate the peak to peak ripple with this:

First calculate V1:
RC=R*C
V1=(Vs/2)*(1-e^(-t/RC))
where
R is the first resistor,
C is the first capacitor,
Vs is the charging voltage,
t is one half of the total PWM period,

then calculate Vpp with:
Vpp=V1*(RC*e^(-t/RC)-RC+t)/t
where
V1 is calculated above,
R is the second resistor,
C is the second capacitor,
RC=R*C,
t is one half the period of the PWM.

This works when the resistors are large enough such as 10k.
The estimate is based on a charging first order RC excited by a rectangular wave, followed by another first order RC excited by a ramp who's amplitude comes from the first calculation. Using a ramp is possible because the time constant is much longer than the PWM period. The Vs/2 factor ensures that we calculate the worst case ripple because the ripple varies with duty cycle.
 
Last edited:
Hi again,


That is an exact expression for a first order RC filter. If you want to use second order then we can estimate the peak to peak ripple with this:

First calculate V1:
RC=R*C
V1=(Vs/2)*(1-e^(-t/RC))
where
R is the first resistor,
C is the first capacitor,
Vs is the charging voltage,
t is one half of the total PWM period,

then calculate Vpp with:
Vpp=V1*(RC*e^(-t/RC)-RC+t)/t
where
V1 is calculated above,
R is the second resistor,
C is the second capacitor,
RC=R*C,
t is one half the period of the PWM.

This works when the resistors are large enough such as 10k.
The estimate is based on a charging first order RC excited by a rectangular wave, followed by another first order RC excited by a ramp who's amplitude comes from the first calculation. Using a ramp is possible because the time constant is much longer than the PWM period. The Vs/2 factor ensures that we calculate the worst case ripple because the ripple varies with duty cycle.

Why is it that the 2nd part of the equation uses a ramp? Shouldn't the signal after the first filter look more like a sinusoidal?
 
Hi,


Actually, no. When a capacitor charges from a constant current a voltage ramp appears across its terminals. A larger resistor in series with the cap acts like a pseudo constant current, so we get a ramp across the first cap. If the time constant is lower we get a wave that looks like a charging capacitor. To get a sinusoid we'd have to use an inductor too.
We could also develop an exact expression for the voltage across the second cap.
 
Ok, that makes sense thank you. I crunched the numbers and found that with the resistors and caps I picked I am getting Vpp = 63uV which should be low enough to not affect a 1.46mV signal.
 
Hello again,


Oh yes that sounds good. Also, since the theoretical model assumes a perfect square wave (rise and fall times equal to zero) when you observe the real life system you should see even a little less ripple because the rise and fall times will be greater than zero.

For a more exact method for a two stage RC filter with first resistor and cap R1 and C1 and second resistor and cap R2 and C2 we have the following...

Defining these four:
A=(sqrt(C2^2*R2^2+(2*C2^2-2*C1*C2)*R1*R2+(C2^2+2*C1*C2+C1^2)*R1^2))
B=R1*R2*C1*C2
Ex1=e^(-(t*C2*R2)/(2*B)-(t*C2*R1)/(2*B)-(t*C1*R1)/(2*B)+(t*A)/(2*B))
Ex2=e^(-(t*C2*R2)/(2*B)-(t*C2*R1)/(2*B)-(t*C1*R1)/(2*B)-(t*A)/(2*B))

Then the worst case ripple peak to peak will be:
Vpp=(Vin*(Ex2*C2*R2-Ex1*C2*R2+Ex2*C2*R1-Ex1*C2*R1+Ex2*C1*R1-Ex1*C1*R1-Ex2*A-Ex1*A+2*A))/(4*A)

where Vin is the charging voltage.

This is still an estimate but here it is based on the exact time analysis for the voltage across both capacitors.
 
Hi,

Yeah i like the first form better :)

Some of these simple circuit have surprisingly complex time solutions.
 
Hi again,


You're welcome. I just thought i would let you know that you can also do a simulation using free software. Might be easier :)
 
Ya i have been using LTspice to simulate it, but I had no issue picking values and plugging them in. I was more looking for a more mathematical way of determining what my resistor and capacitor values should be.
Now I realize that I need to decide which attributes are more important (settling time or ripple) and then pick something that will meet my requirements and make sure that the impedance is good for the application.
 
Hello again,


Yes we never talked about driving or loading impedances. Often the driving impedance doesnt matter as much but the loading impedance almost always does because it appears right across the second capacitor. An impedance that includes a resistance like 10k could even affect the output ripple.

If you know what your loading impedance is we can use that and take it from there.
 
Hi again,

If you've got 500k input impedance (resistive) then you probably want to say equal to or under around 50k for the series combination of the two filter resistors. The second cap has to supply energy to the pin in bursts sometimes so maybe 0.01uf as a max for the second cap. So maybe a 5k resistor and a 50k resistor would do it unless there is a lot of noise in the system and then choose lower values.

I find it interesting how much more effort it takes to produce an exact closed form equation for the ripple output of the second order filter as compared to the first order filter. With the single stage it's not too hard to come up with a series for the peak and the valley of the output and then convert it to a closed form. With the two stage it's harder to do because there are two cap voltages to solve for.
It's so much simpler to use a numerical method for example:
x1=(Vin-X1)/R1/C1-(X1-X2)/R2/C1
x2=(X1-X2)/R2/C2

(x1 is derivative of first cap voltage, x2 is derivative of second cap voltage. X1 is first cap voltage, X2 is second cap voltage, Vin is allowed to vary between the charge voltage level and zero)

and use just about any numerical method for solving this set of differential equations.
 
Last edited:
Also, when I simulate this filter:
View attachment 65248

I get this frequency response:
View attachment 65249

From the frequency response we can see the the break-point frequency is right where I wanted it to be, i.e. 158 Hz
I got the 158 Hz value by saying that the max p-p ripple I wanted was 1.46mV so my max ripple is 730uV
I divide the maximum output of my PWM (3.3V) by 730uV to see that I need to reduce my signal by 4521 or about 73dB at 10.577 kHz (frequency of the PWM)

I then build 2 first order filters with a break-point frequency of 158 Hz which should give me a -40dB per decade slope, however I only see a -20dB per decade slope.
Did I miss something?

Also when I use these values in the equation you gave me I get a max Vpp of 1.47 mV but the simulation gives me a max Vpp of half that at 733.07uV so maybe the 2st equation you gave me is missing a 1/2?
 
Last edited:
Hi,

I'll check that out. In the mean time ignore that equation and you can use the first equation or check this next one out which is much simpler.

But take another look at your plot. Remember you have to look at the straight line segment to see the -40dB/decade. It actually is -40dB/decade.

Also, in view of the fact that you dont mind using the second resistor being equal to 10 times the first and the second capacitor 10 times less than the first cap, we can get to an estimate this way which is much faster...

R1C1=sqrt(sqrt(18081*A^2+4000000*Vin^2)-241*A)/sqrt(200*A*w^2)
where
A is the peak to peak voltage,

So once we calculate R1C1 we divide that by C1 and we get the value of the first resistor:
R1C1/C1=R1

and since R2=10*R1 and C2=C1/10 we have all four components. The only value we have to choose is C1.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top