Filter PWM Down to a Usable DC Level

Filter PWM Down to a Usable DC Level

Following on with step 1b from the article: Making a high resolution ADC from an Arduino Mini Pro

Starting with simulating the filter, I found that a fourth order RC filter would suit my needs for getting a nice DC level out of the PWM signal. I am expecting less than 1mV peak to peak with this filter.  The filter is a little slow for large steps but for what I am doing it should be fine. The filter bandwidth is  fc = 15.9154943092[Hz]

There is a nice filter calculator page here: http://sim.okawa-denshi.jp/en/PWMtool.php

Here is a look at the filter in LTSpice:

4th order RC filter for PWM signal
4th order RC filter for PWM signal

 

 

 

 

 

 

 

 

 

This is what each section of the filter looks like in the simulation:

4th order RC filter for PWM signal response
4th order RC filter for PWM signal response

 

 

 

 

 

 

 

 

If you want to play with this in LTSpice, you can download this file here: PWM_131Hz_filter

 

Now it is time to go cut it on the LPKF

RC Filter in Eagle
RC Filter in Eagle

 

 

 

 

 

 

 

 

 

After the LPKF and some solder

 

LPKF PWM Filter board
LPKF PWM Filter board

 

 

 

 

 

 

 

 

Actual DC output from the filter. I programmed a PWM to 10000, wait for 2S then set the PWM to 15000, wait 2 seconds again, repeat. It settles in less than a half second with this filter, very close to the simulation values, see above.  I was expecting around a 409mV change in voltage but was only getting 374mV. Something to look into…

 

PWM Filter DC output switching between a setting of 10,000 and 15,000 every 2 seconds
PWM Filter DC output switching between a setting of 10,000 and 15,000 every 2 seconds
Comments are closed.