Filtering 0-5V 1kHz PWM square wave to get ~1 volt to 10 volts DC output proportional to duty cycle, an LM386 as two-pole Sallen Key "Busselworth" filter:
Faster settling and better drive current than an RC filter, almost as cheap. It's not glamorous but gets the job done
At least three (maybe six ;-) of us here could output a DC level proportional to duty-cycle ON A CYCLE-BY-CYCLE BASIS. ...Jim Thompson
--
| James E.Thompson | mens |
| Analog Innovations | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| STV, Queen Creek, AZ 85142 Skype: skypeanalog | |
| Voice:(480)460-2350 Fax: Available upon request | Brass Rat |
| E-mail Icon at http://www.analog-innovations.com | 1962 |
It's what you learn, after you know it all, that counts.
I have a big reel of LM386s I got for about 10 cents per, they're a humble part but the output automatically biasing to around half the supply voltage is a nice perk, their main flaw at the moment is not earning me any money
It's a Butterworth/Bessel 0.50 transitional filter transfer function; sort of a compromise between the better ideal settling time of the Bessel and ideal steeper frequency domain cutoff of the Butterworth. Bustleworth.
With an "open loop" gain of only 200 from the bypassed but still-not-an-opamp LM386 the performance of a strict Bessel in Sallen Key didn't look so ah good.
BTW the reason for this exercise is the LM386 has a lot of drive current available and can be used to drive small motors/servos directly - even says so in the datasheet!
One more RC gets you a 3rd-order filter, and avoids the shoot-through problem of the first cap whacking the opamp output impedance, which is the real problem with Sallen-Key filters.
--
John Larkin Highland Technology, Inc
picosecond timing precision measurement
jlarkin att highlandtechnology dott com
http://www.highlandtechnology.com
Use a pair of counters to evaluate the duty cycle over one cycle, digital n umber crunching to turn that into a number, and a D/A converter to push out that voltage over the next cycle. If the period of waveform being looked a t is stable, you can use a phase-locked loop to lock the period-counting cl ock to some (high) multiple of the frequency of the waveform being looked a t, and save yourself the digital number crunching.
It's really only practical in an ASIC, which is to say for high volume appl ications (which are the only ones Jim get to hear about).
A fast-settling multi-pole low pass filter can do almost as good a job in m ost application.
Taylor and Williams list some equi-ripple approximations to the perfect fas t-settling filter which give better carrier attenuation at the price of sma ll excursions from the ideal phase-versus-frequency plot.
That's a good idea. The gross part about how it is now is that the '386 output bias stage seems to run extremely lean class AB, maybe it's even straight class B for all I know. So every time the crosses over between output devices there's a glitch that the meager 30 dB of "open loop" gain isn't able to correct, and the glitch "rings" the filter on each pulse transition. ping ping ping ping. A heavy load improves that a bit
The situation can be improved more and the drive current reduced by increasing the R values and lowering the cap values, but can't increase the R values too much as there's an internal ~50k to ground on each '386 input. Increase R2 too much and its Thevenin impedance in combination with the internal resistor screws up the frequency response.
Taylor and Williams list some equi-ripple approximations to the perfect fast-settling filter, which offer slightly better carrier frequency attenuation for the same number of poles. You do need more than two poles of filtering to get into that territory.
number crunching to turn that into a number, and a D/A converter to push o ut that voltage over the next cycle. If the period of waveform being looked at is stable, you can use a phase-locked loop to lock the period-counting clock to some (high) multiple of the frequency of the waveform being looked at, and save yourself the digital number crunching.
This is the output into an 8 ohm load with 1 kHz 5 volt PWM in at 30% duty cycle, Rs increased a bit and Cs decreased:
The "Bustleworth" time-domain response seems good enough for rock and roll to me. With a dumpy LM386 the strict Butterworth rings like mad and the strict Bessel is dog slow
Leave it to Slowman to not see the obvious (and easy) analog solution. ...Jim Thompson
--
| James E.Thompson | mens |
| Analog Innovations | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| STV, Queen Creek, AZ 85142 Skype: skypeanalog | |
| Voice:(480)460-2350 Fax: Available upon request | Brass Rat |
| E-mail Icon at http://www.analog-innovations.com | 1962 |
It's what you learn, after you know it all, that counts.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.