Dumpy filter

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

Reply to
bitrex
Loading thread data ...

I'm so-o-o-o unimpressed.

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.
Reply to
Jim Thompson

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

Reply to
bitrex

When did this part first go on sale, anyway? Likely at least decade before I was born I'd figure

Reply to
bitrex

The internal feedback bypass cap is probably too large, I think one could get away with a ceramic there

Reply to
bitrex

A Butterworth response has ringing in the time domain, Bessel is better.

George H.

Reply to
George Herold

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.

Reply to
bitrex

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!

Reply to
bitrex

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
Reply to
John Larkin

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.

--
Bill Sloman, Sydney
Reply to
bill.sloman

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.

No silk purses out of sow's ears

Reply to
bitrex

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.

It doesn't look as if Bitrex needs to go there.

--
Bill Sloman, Sydney
Reply to
bill.sloman

ut

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.

formatting link

Reply to
Lasse Langwadt Christensen

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

Reply to
bitrex

Raise those resistor values!

--
 Thanks, 
    - Win
Reply to
Winfield Hill

Can't raise them too far, or the voltage divider created by the second resistor and the internal ~50k on the '386 kills the response.

2.2k, 4.7k, and two 470n capacitors seems an OK compromise
Reply to
bitrex

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.
Reply to
Jim Thompson

a ramp and a sample and hold triggered on opposite edges, but how do you get the right slope? are you relying on the signal being exactly 1kHz?

--
This email has not been checked by half-arsed antivirus software
Reply to
Jasen Betts

Released on Aug 26, 1983 according to Wikipedia

formatting link

Reply to
Pimpom

If you use both edges (dual slope) do you care?

Reply to
krw

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.