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.

PWM DAC RC Low Pass Filter

Status
Not open for further replies.

drkidd22

Member
I'm working on designing a passive LPF to use with the PIC PWM output. I have the frequency set at 20Khz, 3.3V right now just for testing purposes. First I need some clarification into my understanding of how a LPF should really work.

I understand that we want to eliminate the high frequencies, so does that mean that the lower the cut-off frequency is from the LPF the more accurate the average output will be.

For example I have a LPF with R = 1K and C = 1uF. This will be a Fc = 1/(2piRC) = 159Hz.
I've attached what the simulation looks like for two different scenarios, the second one uses 100nF for C. I've done a couple of different simulations and noticed that the ripple of the output is worst with with lower capacitance, but rise time is faster. With higher resistance the ripple is better, but longer rise time for vout. So my question is how low of a cut-off frequency is a "good" cut-off. Any input will help. I've been reading a lot a still don't really get, but I think I'm almost there.
 

Attachments

  • LPF_RC_Sim.png
    LPF_RC_Sim.png
    46.6 KB · Views: 212
  • LPF_RC_Sim1.png
    LPF_RC_Sim1.png
    30.4 KB · Views: 198
Hi,

It depends on how much ripple your application can put up with. For low ripple, use larger resistor or larger cap or both. For faster rise use lower. For both you'll have to use a better filter, possibly with inductance or active filter.
 
Well I'm just going to use it to set the voltage reference for a motor control IC, so I don't think the ripple has to be that so accurate. Is there a "rule of thumb" for acceptable ripple?
 
Well I'm just going to use it to set the voltage reference for a motor control IC, so I don't think the ripple has to be that so accurate. Is there a "rule of thumb" for acceptable ripple?
Not really. It depends upon the effect of the ripple in the application circuit. If the motor control IC's reference input can respond to the frequency of the ripple than that could be a problem. If the frequency is higher than the frequency response of the reference input then it shouldn't be a problem.

If you don't know the frequency response of the reference input, then you may need to measure it to determine the acceptable ripple it can tolerate.
 
You should design the RC filter to cut off all the frequencies you don't need.. so design the cut-off frequency as low as possible. You should also use as high pwm frequency as possible. That is a trade-off between resolution and frequency (output ripple).
 
Last edited:
How would I measure the frequency response of the input? There is no spec in the data sheet.
What is the motor controller IC part number? What does it do with the reference voltage? What does it regulate or control? From that you should be able to determine how much ripple you can tolerate.

A big part of engineering is generating a good design without having direct access to all the facts. Some of them you have to infer or estimate. If you always have all the facts then a computer could do the design, you wouldn't need a human engineer.
 
So you want to control the current limit setting by feeding the filtered pwm signal to the Vref pin of the A3979?
 
Yes, this way I will have control of the current limit in software instead of having to use a pot or a fixed value.
 
Are you planning to just "find a good value for Vref and then let it be", or are you planning to dynamically change the current limit while the motor is operating (according to load etc.)? What kind of resolution you need for the Vref?

If you don't have answers to these questions, I think you should just build a test circuit and experiment. It is easy to play with R and C and the PWM frequency.. and to see what works and what does not is very educational.
 
Last edited:
It will be used to set a fixed current depending on the motor used and load applied, but it will not be dynamically adjusted while the motor is operating.
So I'm looking at the op-amps for everyone notes and I'm trying to figure out equation

A(s) = ((1 / RC ) / (s + (1 / RC))
A(s) = 1 / ( 1 + sRC)
s = jw

A(s) = (1 / (1 + s))

So my question is how would I use this equation and what will s be, what is s?
 
It will be used to set a fixed current depending on the motor used and load applied, but it will not be dynamically adjusted while the motor is operating.

Use a passive RC filter with long time constant (low cut-off frequency ~10Hz, R=16k, C=1uF). You will get a nice soft start for the motor current and small ripple for Vref voltage.
 
Last edited:
Ok, so my question now is for the example you posted 16K and 1uF, the response time will be 5*RC?
So basically it will take the circuit 80ms to be stable? Is this the correct way of doing it?
 
Ok, so my question now is for the example you posted 16K and 1uF, the response time will be 5*RC?
So basically it will take the circuit 80ms to be stable? Is this the correct way of doing it?

Something like that. It will take the signal to reach 63% of the final value in 36ms. After 80ms it has reached around 99% of the final value. But why are you concerned about this? Why is the rise time important when all you need is a dc voltage reference?
**broken link removed**
 
Last edited:
I just want to figure out how to calculate the rise time of the output to be stable just in case I need to design something faster later.
Basically trying to refresh my mind on how this the LPF works.
 
For faster and more accurate output you can also use a "pullup resistor" to set a low-limit to the output. This way you won't get zero output voltage, but why would you in this kind of application:
 

Attachments

  • stepRCpullup.png
    stepRCpullup.png
    26.9 KB · Views: 196
Last edited:
Hi,


The time constant is also important for times when you go to change the motor speed assuming you use this voltage to drive the motor controller. If you change the speed, it takes about 5 time constants to reach the required speed. It's good to know that in case you want fast speed changes. If you dont need fast speed changes then you can use a high value RC and that will give you a nice clean DC and steady motor speed.
The motor may not be able to respond to the small ripple anyway because of other factors.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top