Filter PWM Down to a Usable DC Level
Following on with step 1b from the Mad Scientist Hut 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:

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

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

After the LPKF and some solder

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…
