DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: ricothetroll on March 31, 2012, 06:46:58 AM

Title: Square LFO filtering
Post by: ricothetroll on March 31, 2012, 06:46:58 AM
Hi,

I'm implementing Electric Druid's Tap LFO on my recently built MFOS subcommander. To proceed the PWM -> analog conversion, I put a triple RC filter (330R-1u-330R-1u-330R-1u). This corresponds to a FC of 90Hz. It seems quite low but still satisfying to my ears, I first experimented with 1kHz and the reduced the Fc by increasing the caps. But I still hear the LFO ticking pretty loud with the "brutal transitions" waveforms (ramp, square, random...). Taking a look at the filtered waveform with my scope, I can see that for the square signal, one side of the "cliff" is rounded, and the other stays sharp. I understand that it actually makes sense and corresponds to the charging/discharging of the filtering capacitors.

Is there a way to have soft transitions on both sides of the waveform ? What I'd like to achieve is something like a sine/tri signal through a diode clipping network (R + 2x diodes to gnd).

Maybe I'm just dreaming of something impossible...

Best regards.

Eric
Title: Re: Square LFO filtering
Post by: ricothetroll on March 31, 2012, 06:57:58 AM
Here's an illustration of the filtered squarewave :

(http://img826.imageshack.us/img826/7168/filteredsqr.jpg)
By ricothetroll (http://profile.imageshack.us/user/ricothetroll) at 2012-03-31
Title: Re: Square LFO filtering
Post by: CynicalMan on March 31, 2012, 12:44:40 PM
For a triangle wave, you want a 1-pole low-pass filter with a much lower Fc. I'd use an Fc of at most half your LFO's frequency. Try a 10k/4.7uF filter for the 10Hz signal in your sim.
Title: Re: Square LFO filtering
Post by: PRR on March 31, 2012, 11:41:17 PM
It is a LOW frequency oscillator. I'd think you'd want the low-pass below 16Hz, not 90Hz. As Alex says, you may need to go much lower to really round-off the sharpness.

Also depending on source and load, 330r may be too low for good driving. Alex's 10K+4.7u may be good trial values.
Title: Re: Square LFO filtering
Post by: ricothetroll on April 01, 2012, 06:18:35 AM
Hi,

Thanx for your answers !

Filtering with a lower Fc could help me getting rid of the ticking, but I'd like to keep the square nature of the LFO ! The goal is to have a multiple waveform LFO, who will modulate the VCF and the VCA of the MFOS subcommander. If I filter too low everything will sound like a sine modulation !

Here's an illustration of the kind of result I'd like to obtain, compared to the RC filtered square :

(http://img716.imageshack.us/img716/8043/filteredsqrvsclippedsin.jpg)

V(diode) keeps the "squarish" nature, with quite abrupt transitions between a low value and a high value, but both its edges are soft and so I guess the generate a lot less high harmonic that would feedthrough the output of the modulated circuit.

The only solution I see is to reprogram the uC with lookup table corresponding to this waveform, but I don't know if I'm willing to do it (won't have the time either...)

Any other idea ?  ::)

Best regards.

Eric
Title: Re: Square LFO filtering
Post by: CynicalMan on April 01, 2012, 09:23:59 AM
Filter it to a triangle wave, amplify it, then clip it with the diodes.
Title: Re: Square LFO filtering
Post by: merlinb on April 01, 2012, 11:30:18 AM
A standard triangle wave oscillator produces both square and triangle outputs. Clipping and filtering the triangle will also make a reasonable sinewave. Much easier than trying to filter a square wave...
(http://www.play-hookey.com/analog/images/square_triangle_gen.gif)
Title: Re: Square LFO filtering
Post by: ricothetroll on April 01, 2012, 12:54:52 PM
Hi,
I tried with a 4 pole Bessel filter and got some better results ! I'd like to keep the tap LFO because of the tap tempo option and also because the RANDOM mode sound soooo cool with the VCF, similar to Maestro FSH-1 (this mode also does tick at the output).
I think I'll live with that for the moment...
Thanx again for your advices !
Best regards.
Eric
PS : Merlin, I own your book on guitar toob preamps, one of the best musical/electronics book I've ever read ! That's the book I was looking for, for years. It sits right next to Boscorelli's "Stompbox cookbook". Thanx a lot for sharing your knowledges, here and in your books. Is the power amp part planned yet ? I can't wait to read it !
Title: Re: Square LFO filtering
Post by: ricothetroll on April 01, 2012, 12:57:33 PM
For a reason I ignore, the word "t-u-b-e" is automatically replaced by the word "toob"... Maybe that comes with the new "girly" display... ::)
Title: Re: Square LFO filtering
Post by: ElectricDruid on April 07, 2012, 05:01:12 PM
To curve the corners without damaging the 'square' shape, you need a filter with better rolloff. For that reason, the 4 pole bessel is a better option.
You can experiment with different values with the tool I originally used to design it. Inevitably, the design is a compromise between clean sharp edges and smooth response. You may feel that a different balance of those parameters is more to your taste. Try it:

http://designtools.analog.com/dt/filter/filterW.html

Enjoy!

Tom
Title: Re: Square LFO filtering
Post by: ricothetroll on April 08, 2012, 05:35:46 AM
Hi Tom,
Thanx for the link !
Best regards.
Eric
Title: Re: Square LFO filtering
Post by: ElectricDruid on April 19, 2012, 02:45:08 PM
Thinking a bit more about the cascaded passive RC filter, I can see some improvements. If you look at this:

http://www.electronics-tutorials.ws/filter/filter_2.html

It suggests that to avoid each subsequent stage loading the previous one, the resistor values should increase x10, and the capacitor value should decrease to 1/10th.
This would mean that your 330R/1u x 3 filter would be better implemented as 33R/10u + 330R/1u + 3K3/100n. But that gives a very low impedance on the first stage. So maybe we should try 3K3/100n + 33K/10n + 330K/1n instead.

This filter should give a 18dB/oct response even with only 6 components. The result won't be as good as an active filter, but it might well be good enough, and it's too simple not to try.

Good luck!
Tom