Refer to this question I had asked a few days back: PWM DAC Filter explanation

Hi, It is getting extremely difficult for me to create the PT0 and PT1 signals as given above. I am using a dsPIC30F device. Two PWMs are created with independent duty cycle control, however, the duty cycle change happens by controlling falling edge, where as the above demands that PT0 must have fixed falling edge and variable rising edge...how to achieve that?

On the other hand, I am thinking of using a simple 4th order sallen-key LPF to filter out most of the PWM fundamental...and set its cut-off to say less than half of the PWM fundamental. My sampling frequency for the DAC output (yes, I am sampling my own DAC output) is LOW about once in every 25ms.

Can I remove the left over ripple, by using a small LC filter in line with the DAC output...this works in voltage regulators...will it work here. The output is going to drive a high input impedance OpAmp...so current drive capacity is not in question.

Any pointers?

  • 1
    \$\begingroup\$ I wonder if an integrator configuration of an op-amp into a capacitor filter output would work? so the voltage on the output would accumulate based on the average time on/off of the PWM cycle.. I'm just throwing out ideas here, maybe try breadboarding it \$\endgroup\$ – KyranF May 7 '14 at 10:33
  • \$\begingroup\$ here ya go, here is a dodgy example of what i mean.. avdweb.nl/arduino/hardware-interfacing/simple-10-bit-dac.html \$\endgroup\$ – KyranF May 7 '14 at 10:36

From your previous question, it sounds like Dave does not recommend using that method.

There likely isn't a point in using an LC filter in line after the 4th order sallen-key. Depending on the quality of your sallen-key, you may not get any more benefit out of an LC filter.

With such a low sampling frequency, and no need for high output impedance, why aren't you maximizing the PWM frequency and filtering it with an appropriate RC filter?

From your datasheet: "PWM Frequency for 11-bit resolution (@ 30 MIPS) = 29.3 KHz for Edge-Aligned mode"

Your sample frequency is 40 hz which is 3 orders of magnitude different. A single RC filter gives you a single order filter which gives 20db/Dec. With 3 decades of drop-off, you should get a pretty smooth signal out relative to your sample rate.

  • \$\begingroup\$ We are using a dsPIC33FGP710 part, which runs default at 25MHz. Our RTOS is programmed to use this clock frequency. Our ADC is 12bit, Since I have to share a certain signal information using an analog voltage signal, with other controllers...which may not have serial connectivity, I must use a DAC which is also 12bit to faithfully reproduce our signal information. So for 12bit resolution my PWM signal frequency has to be 25e06/4096 = 6KHz. I am thinking of having a cutoff at 4KHz for the sallen-key 4 order LPF. \$\endgroup\$ – Vishal May 8 '14 at 8:50
  • \$\begingroup\$ Now, my sampling frequency has increased...owing to change in algorithm...its 250Hz now. still much lesser than PWM frequency of 6KHz. so If I setup the cutoff at say 2.5KHz, I will get good enough noise immunity, but the signal itself is also attenuated a lot and settling time will be increased. If the cutoff is at 6KHz, so that only the fundamental sine is allowed, the ripple is HUGE..almost equal to the signal itself. I am therefore trying to find a middle ground...and 4KHz seems to be good enough. it is so difficult to get the DC part from a PWM signal...i am preplexed at this juncture. \$\endgroup\$ – Vishal May 8 '14 at 9:06
  • \$\begingroup\$ My solutions come from the excellent answers to this question: electronics.stackexchange.com/q/34843 \$\endgroup\$ – Vishal May 8 '14 at 9:08
  • \$\begingroup\$ What kind of chip uses an accurate, fast analog signal these days for communication? With the design issues you're having to go through, I'm wondering why you're not paying an extra dollar to get a built in DAC and just use that? This is one PIC with a built-in DAC that might set you back 1 extra dollar: microchip.com/wwwproducts/Devices.aspx?dDocName=en532310 \$\endgroup\$ – horta May 8 '14 at 19:57
  • \$\begingroup\$ Horta, 'these days' is an unlikely situation in our field. We have DC motor drives working since the 80s, (discrete analog controllers...which can easily be repaired in field without much hassle)...and our digital controller is going to work with them. so you can imagine the "backward-compatibility" tussle that is going through our heads. By the way, we still manufacture these DC Motor drives and they sell because of their field worthiness and reliability. \$\endgroup\$ – Vishal May 9 '14 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.