Quadracomparatorfuzz!

Started by patricks, September 05, 2023, 01:00:33 AM

Previous topic - Next topic

patricks

New pedal design day!

I've been experimenting with my first designs recently, using an "I found this chip in an old board, what can I do with it?" approach. This one's based around an LM339 chip I pulled out of an LED bar graph board from a mixer I found by the side of the road outside a studio/creative space.
The default for "what can I do with this chip?" seems to be "build a distortion/fuzz pedal", so I did.

The LM339 has four comparators in the one package, so this design is an adaptation of the Anderton Quadrafuzz. Mods/changes are:

  • Converted to a 9V single-sided supply (rather than +/-5V)
  • CMOS switching and the active filter on the output left out
  • Mods from Mark Hammer's three legged quadrafuzz
  • Comparator fuzz replacing the distortion/fuzz section of the Quadrafuzz taken from the application notes for a non-inverting comparator with hysteresis (thanks to PRR for posting the link the link to the app notes in this thread)

I haven't gotten this on the breadboard yet, sharing the schematic in advance for funsies.
Using the application notes replaces the 3.3k resistor at the output of the Quadrafuzz's filter sections with a 330k so I plan to test that on the breadboard, along with the values of the resistors around the comparators to see how it sounds.
I've kept all four frequency bands exactly the same as in the Quadrafuzz. There are 6 pots total, I'll either build it in a 1590BB using full-size pots but I might try designing the PCB around 9 mm board-mounted pots to see whether I can squeeze it into a 125B.
Op-amps are LF353 just because I've got a few of them from the same mixer I scavenged the LM339s from (any dual op-amp will likely do), also because I'm thinking dual op-amps might make for a neater PCB layout than a quad op-amp plus a dual, but I can try another schematic and PCB design if I feel like it and time permits.

See what you think, and any feedback is most welcome :)

Cheers
Pat




ElectricDruid

#1
I think you might have to experiment a bit with the values around that comparator.

The datasheet example is set uo with 100K Rload, but you have a 5K pot in the same position. Well, *almost* - you actually have no DC load, since the pot is separated from the comparator with a capacitor. To keep it closer to the datasheet, you could put the cap on the pot's wiper instead.

The 5K pot means that the maximum output is going to be much lower with Rpullup of 3K (3K/5K vs 3K/100K divider) . That might well not matter - we don't *need* a full 9V logic signal. The datasheet also say the feedback resistors should be >> the load, so with the lower load, you could drop the values of the 1M/330K to something more typical, say 100K/33K. I'd probably try 1K for the pull-up too.

YMMV - this is all guess work from a quick flip through the datasheet.

patricks

#2
Oh, good catch! Thank you :)

I'll adjust the values and experiment from there. Would it also work to replace the 5K pot with a 100K pot (with the capacitor also after the wiper) or would that affect the impedance at the input of the mixer (I'm guessing not with the capacitor in between)?

I'll also try going back to the original 3.3K resistors after the filters per the original Quadrafuzz, and changing the feedback resistor to 10K and pull-up to 100R (still with the 5K pots) and see how that sounds.

That's a good reminder, too, pot taper is something I'll need to experiment with

ElectricDruid

Quote from: patricks on September 05, 2023, 06:56:15 AM
I'll adjust the values and experiment from there. Would it also work to replace the 5K pot with a 100K pot (with the capacitor also after the wiper) or would that affect the impedance at the input of the mixer (I'm guessing not with the capacitor in between)?
It'll affect the mixer. It'll change the pot taper. Since the -ve input is a virtual ground node, the 10K input resistors are effectively from the wiper of the pot to ground (that's still true for the AC, even with the cap). The original 5K pots won't be *so* badly affected by a 10K input resistor, but they will still be affected. I generally try and use "input resistor x10 of pot value" as a rule of thumb, but even x3 or x4 isn't bad. x2 is not great. 100K into 10K is *entirely* the wrong way around!


duck_arse

some things. you need an input cap - it might be off drawing, but you can't have Vref exposed to the outside world. you need to mark C3/R3 as Vref, otherwise ....... C14 as 470uF? that's too big, I think. C13 shows as 2200nF - that's 2u2 in anyone's language. is that the right value?
" I will say no more "

antonis

Quote from: duck_arse on September 05, 2023, 10:48:10 AM
C13 shows as 2200nF - that's 2u2 in anyone's language. is that the right value?

Have you anything against a LPF of 7Hz cut-off frequency..?? :icon_mrgreen:
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

ElectricDruid

Quote from: antonis on September 05, 2023, 11:04:52 AM
Quote from: duck_arse on September 05, 2023, 10:48:10 AM
C13 shows as 2200nF - that's 2u2 in anyone's language. is that the right value?

Have you anything against a LPF of 7Hz cut-off frequency..?? :icon_mrgreen:
Lol, perhaps that's not great in an audio mixer...;)

Ben N

Quote from: ElectricDruid on September 05, 2023, 11:37:36 AM
Quote from: antonis on September 05, 2023, 11:04:52 AM
Quote from: duck_arse on September 05, 2023, 10:48:10 AM
C13 shows as 2200nF - that's 2u2 in anyone's language. is that the right value?

Have you anything against a LPF of 7Hz cut-off frequency..?? :icon_mrgreen:
Lol, perhaps that's not great in an audio mixer...;)
Isn't that just a guitar speaker?
  • SUPPORTER

Mark Hammer

I think this is a clever idea.
The Anderton EPFM collection includes his Ultra-Fuzz, which is also a comparator-based design, except since that comparator is applied to the entire signal, he just uses a dual op-amp.  What you've done is essentially merged the Ultra-Fuzz and Quadrafuzz.

The one thing I'd be mindful of is that different frequency bands have differing amounts of energy, such that one or two bands might meet the threshold for the comparator to trigger, while the others don't
In the case of the Quadrafuzz, the signal is preserved, at level, even if that level is too low to clip.  But in this application, if it doesn't meet threshold, there's no output.  In which case, some means needs to be available to adjust either the threshold of that band's individual comparator, or the amplitude of the signal hitting it.
And, oversized feedback caps aside, remember that each of those stages yields a square wave output, such that turning down the level of the upper bands and maxing the lowest band won't get you a mellow grunt.  It will be chockful of all the harmonics produced by squaring that passband.  So some means of rolling back the highs to a tolerable level is called for.  Certainly begin with a suitably-chosen feedback cap for U3.2, but consider adding a variable treble-cut of some sort between the output of that mixing stage and the final volume control.  I'm confident you'll have more than enough signal level that a bit of passive loss won't hurt.

ElectricDruid

#9
Quote from: Ben N on September 05, 2023, 01:26:11 PM
Quote from: ElectricDruid on September 05, 2023, 11:37:36 AM
Quote from: antonis on September 05, 2023, 11:04:52 AM
Quote from: duck_arse on September 05, 2023, 10:48:10 AM
C13 shows as 2200nF - that's 2u2 in anyone's language. is that the right value?

Have you anything against a LPF of 7Hz cut-off frequency..?? :icon_mrgreen:
Lol, perhaps that's not great in an audio mixer...;)
Isn't that just a guitar speaker?
Given Mark's point about all the input signals being square waves (which is totally true but which I'd somehow overlooked) then it's quite possible that having a -6dB/Oct charateristic on the final output mixer might help keep the fizz under control. It's a basic slope over the whole audio band to counteract the effect of the square wave fuzz. It will also compensate in some degree for quiet higher harmonics suddenly turning into full-volume square waves, since the higher you go, the more cut you get.





antonis

That particular filter will keep everything under control.. :icon_wink:
(by diminishing them..)
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

patricks

Quote from: ElectricDruid on September 05, 2023, 08:25:16 AM
Quote from: patricks on September 05, 2023, 06:56:15 AM
I'll adjust the values and experiment from there. Would it also work to replace the 5K pot with a 100K pot (with the capacitor also after the wiper) or would that affect the impedance at the input of the mixer (I'm guessing not with the capacitor in between)?
It'll affect the mixer. It'll change the pot taper. Since the -ve input is a virtual ground node, the 10K input resistors are effectively from the wiper of the pot to ground (that's still true for the AC, even with the cap). The original 5K pots won't be *so* badly affected by a 10K input resistor, but they will still be affected. I generally try and use "input resistor x10 of pot value" as a rule of thumb, but even x3 or x4 isn't bad. x2 is not great. 100K into 10K is *entirely* the wrong way around!

Ah, good to know. I'll experiment with higher values for the 10K input resistors too, I'm making text notes on the schematic in Diptrace as this thread evolves :)


Quote from: duck_arse on September 05, 2023, 10:48:10 AM
some things. you need an input cap - it might be off drawing, but you can't have Vref exposed to the outside world. you need to mark C3/R3 as Vref, otherwise ....... C14 as 470uF? that's too big, I think. C13 shows as 2200nF - that's 2u2 in anyone's language. is that the right value?

The input cap has fallen off the edge of the image, new schematic image uploaded below.
I've marked C3/R3 as Vref too, thanks for that (the input prior to U1.1 and the power supply are from the Rat for simplicity).
C14 is 470nF, taken from Mark's mods (the three-legged quadrafuzz)
Good catch on C13! It's meant to be 2200 pF (also from Mark's mods), I've updated it now.

Quote from: antonis on September 05, 2023, 11:04:52 AM
Quote from: duck_arse on September 05, 2023, 10:48:10 AM
C13 shows as 2200nF - that's 2u2 in anyone's language. is that the right value?

Have you anything against a LPF of 7Hz cut-off frequency..?? :icon_mrgreen:
LOL! That would've had me searching for hours wondering why there was no output


Quote from: Mark Hammer on September 05, 2023, 01:42:52 PM
I think this is a clever idea.
The Anderton EPFM collection includes his Ultra-Fuzz, which is also a comparator-based design, except since that comparator is applied to the entire signal, he just uses a dual op-amp.  What you've done is essentially merged the Ultra-Fuzz and Quadrafuzz.

The one thing I'd be mindful of is that different frequency bands have differing amounts of energy, such that one or two bands might meet the threshold for the comparator to trigger, while the others don't
In the case of the Quadrafuzz, the signal is preserved, at level, even if that level is too low to clip.  But in this application, if it doesn't meet threshold, there's no output.  In which case, some means needs to be available to adjust either the threshold of that band's individual comparator, or the amplitude of the signal hitting it.
And, oversized feedback caps aside, remember that each of those stages yields a square wave output, such that turning down the level of the upper bands and maxing the lowest band won't get you a mellow grunt.  It will be chockful of all the harmonics produced by squaring that passband.  So some means of rolling back the highs to a tolerable level is called for.  Certainly begin with a suitably-chosen feedback cap for U3.2, but consider adding a variable treble-cut of some sort between the output of that mixing stage and the final volume control.  I'm confident you'll have more than enough signal level that a bit of passive loss won't hurt.

Thank you!  :)
Yes, that was the aim exactly.
Good call on the threshold on each band's comparator, what would be the best way to add a threshold control for testing? Comparing the basic comparator circuit on page 5 with the version with hysteresis on page 9 I can't quite marry the two. The datasheet says "The trip voltage, VA, at the positive input is shifted about VREF as VO changes between +VCC and ground"
Would I vary the values of the 1M/330K resistors around the comparators (with proportional adjustment of the pull-up resistor), put a pot or trimpot from Vref to GND and adjust until the band trips, or find the bands that aren't tripping reliably and put a transistor boost stage between the filter and the comparator for the band?

Thanks Mark and Ben for the input on the high harmonics and a treble cut, I'll see how it sounds coming out of the mixer and try adding in a filter too :)



patricks

I've been thinking more about the trigger threshold for each of the bands - if I wanted to boost the gain of the filter stages could I increase the value of the 100K resistors in the feedback loop between the output and inverting input?
I'm guessing this would change the frequency band, though, correct?

Mark Hammer

One possibility is to use the multiple-ground-leg strategy on U1.1.  As you've shown it, there is variable gain applied in uniform manner to the entire passband.  At maximum gain, things are essentially flat from around 150hz on up.

The challenge is that there is generally less energy in lower notes/strings than in higher ones.  The ideal might be to have adjustable comparator thresholds, to compensate within each band, but that can get complicated.  A simpler, although perhaps not as "surgical", a solution is to use multiple ground legs on the initial gain stage to provide differing degrees of gain.

As an example, if what you show as C14 were 1/10 the value (i.e., .047uf), then that path would provide max gain for content above roughly 1500hz.  Run a second ground leg in parallel, using 470nf and 10k (instead of 470nf and 2k2) and LESS gain is applied to content below 1500hz.  Because the two rolloffs would change as the gain pot is adjusted, I'd recommend moving the gain pot to the feedback loop of that stage.  So R20 and its counterpart would go directly to ground, and R13 would be replaced by, say, a 100k fixed resistor in series with a 500k Gain pot.

That's not the only way to do it, and one could also explore use of three ground legs, but the basic principle is to compensate for where an optimal trigger threshold resides for each of the bands, by providing different degrees of boost up front.  That way, no changes to the bandpass filter stages or comparator stages would be required.  Not likely to be perfect, but could be better than what you have

Make sense?

patricks

Thank you :)
I think I understand, is it similar to the multiple ground paths from the op-amp in the Rat, that gives us two high pass filters, one at around 1,500 Hz and another at 60 Hz? [url]https://www.electrosmash.com/proco-rat#link32/[url]
Except in this example with the new values the cutoffs for the high pass filters would be around 1,500 Hz and 33 Hz, as compared to a single high pass filter with a cut-off of 150 Hz?

If there's less energy in the lower notes and we're applying additional filtering to lower frequencies, aren't we talking away more energy from those frequencies, though?

Mark Hammer

Your understanding is correct.  I have no idea what the relative amplitude of the different passbands are, that you're using.  My suggestion of the different groundlegs was as a way of adapting the input signal so that further adjustment of the individual thresholds would not be necessary.

Ideally, you turn the output level of three comparators fully off, and play your guitar, taking note of how easily it triggers.  Too easily, not easily enough, or just right?  Do this for all four comparators, one at a time, and use the results to determine IF there are sensitivity issues to be attended to, and if there are, where any appropriate attenuation/filter should be applied.

patricks

Quote from: Mark Hammer on September 13, 2023, 07:06:48 PM
Your understanding is correct.  I have no idea what the relative amplitude of the different passbands are, that you're using.  My suggestion of the different groundlegs was as a way of adapting the input signal so that further adjustment of the individual thresholds would not be necessary.

Ideally, you turn the output level of three comparators fully off, and play your guitar, taking note of how easily it triggers.  Too easily, not easily enough, or just right?  Do this for all four comparators, one at a time, and use the results to determine IF there are sensitivity issues to be attended to, and if there are, where any appropriate attenuation/filter should be applied.

Great, thanks very much :)
That was going to be my basic approach, it'll be a few weeks until I can set it up on the breadboard (moving house) but that was the plan, using either the pots on the output or resistor dividers if I need to.
Playing with more than one ground leg will help me to really fine-tune the response, I'll tweak and experiment and report back!

patricks

#17
Well it's on the breadboard finally :)

A bit of a rat's nest, and I'm having to troubleshoot the breadboard now and then. A nudge here or there easily creates a short between the legs of two components.

What I've found so far:
  • There's not enough gain to drive the comparator without additional gain.
    I tried testing it with just the connection from the input gain stage to a comparator stage and it wouldn't trigger.
    Only the upper two bands trigger the comparator, the lower two just as background hum when turned up -
    Wait a minute, I've just realised I haven't connected the feedback resistors on the lower three bands properly!
  • In current configuration it needs a lot of gain to trigger the comparator.
    It only drives the comparator with the gain/attack pot (pot 4 in the current schematic) almost all the way up
  • I had to use 10k trimpots for the output level controls for each comparator stage, experimented with 10K (per current schematic) and 100K input resistors for the mixer, and the 10K have a much greater output level. I would've thought the 1:1 ratio was all wrong, based on Electric Druid's previous post?

Thinking of what to experiment with next, either adding feedback resistors on the lower three filters and increasing the value of the feedback resistor on the upper band to push the comparator, versus experimenting with the 1K/100K/33K resistors around the comparator stages. I'll probably start with the latter.



patricks

Quick update, I've configured the feedback resistors around each of the gain stages as they should be (updated schematic to follow) and now each band drives the comparator, but again only with the gain/attack pot almost all the way up.
Adjusting the level of each of the bands doesn't seem to do much, but I suspect that's because the maxed gain/attack pot is providing "wide band" distortion, as the PAIA circuit analysis calls it.

I'll test the resistors around the comparator next, and then might try increasing the value of the feedback resistors around the filters. That'll probably change the frequency band so I'll need to do some work understanding how the filters work to change the caps to suit  :)

patricks

There has been much progress! Thanks again everyone who's contributed.
Updated and corrected schematic below - there were a number of errors, and some changes between the previous posted version and suggestions made along the way.
Finding these errors/discrepancies and troubleshooting the breadboard itself (things connected in the wrong places, short leads not making connection in some holes, etc.) have taken up most of time dedicated over the past week or so, but now it's built as designed and written and... it's great! A spitty, gated fuzz with wide tonal variation; dialling the different bands in and out changes the "weight" or "emphasis" of the fuzz in fun and flexible ways.

Thanks to @MarkHammer for suggesting moving the gain pot (Pot 4 in the schematic) to the feedback loop of the first gain stage, that made a huge difference. With the pot on the ground leg it had to be turned up almost all the way to get the comparator to trigger, whereas in the feedback loop it gives a wide range of adjustment (including extra juicy distortion at high settings).

Options tested have been:
  • Changing the network of resistors around the comparator stages (e.g. R7/R12/R4) from 33K/100K/1K to 3.3K/10K/100R - I prefer them as written (and it raises a question, below)
  • Moving the capacitor from the output of the pot prior to the 10K to before the pot (e.g. moving C7 to before Pot 1) - I prefer it  as written, after the pot
  • Changing the value of these output pots (e.g. Pot 1/3/5/6) from 10K (that's all I had on hand) to 5K or 1K by putting resistors across pins/legs 2 & 3 - I prefer 10K as tested, log taper gives more useful adjustment than linear
  • Changing the value of the resistors on the input stage of the mixer (R11/19/27/34) from 10K to 50K or 100K - I prefer it with 10K as written
  • Experimenting with removing C5 (output cap from the first gain stage) - I prefer it in place

Issues and questions I'm requesting some help with are:
  • The lowest frequency band oscillates/squeals. It's kind of a cool thing, and I might leave it as-is, but some troubleshooting would be good. Do you think it could just be a breadboard thing, with the number of flying leads all over the place, or something in the circuit that I could tame?
  • The LM339 sinks current in its "off" state, I didn't notice any difference in sound between the two options tested (33K/100K/1K vs 3.3K/10K/100R), is one option (or other similar combination) better to limit current consumption?
  • I prefer the sound with C5 in place, which isn't in the original quadrafuzz design, and haven't tested the switching options yet to change the Q for each band (the switches introduce R22, R29, or R36). I'll test these next, but do you think the inclusion of C5 in the circuit is likely to affect these?

I also liked the sound as-written, without a treble cut (at least in the small Ruby amp I'm using on the benchtop), but might experiment with a treble cut or maybe a tilt EQ (the latter might be redundant, though, given we're individually boosting or cutting the various frequency bands) :)