Ta-dah! I present: a voltage-controlled Sallen/Key filter for audio! - Page 1
Forum section: electronics / projects

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 29, 2017, 08:50:20 pm
content: So - I've been working on this for a while; even asked some somewhat stupid questions in hereAnd after going on tangents (OTA filters, or using photoresistors and LEDs for the voltage-controlled resistance)......I finally struck a bit of a gold-mine; instead of doing a straight voltage-controlled filter with JFETs in their ohmic mode, why not do a current controlled filter using bog standard NPN BJTs in reverse saturation mode? I checked it out, simulated it, and wound up with some values that made sense. And, tonight, I finally got around to actually constructing the thing on a stripboard, and well, it absolutely works like a charm.Now, being a filter mostly for audio - i.e. music production - it doesn't necessarily have to be really linear or "clean". In fact, resonance is a great thing, and most of all, it has to be fun, and, if possible, full of character. And I think I've succeeded in this.I've attached an MP3 - recorded using my iPhone's microphone, so the quality isn't exactly stellar but you'll get the idea. First, 3 bursts of high resonance (near self oscillation), then 3 + 3 bursts of medium and low resonance, on a simultaneous 50Hz and 400Hz sawtooth wave. It certainly works as a low-pass filter, and the voltage control bit works too; I haven't got the exact resistor values right for a totally practical voltage control, but currently, it's controllable in the range from 0 to ~3 volts. Above that, the cutoff is outside the audible range.But, it sounds great and can certainly be used for music production. When I've got it boxed up in a nice enclosure with proper audio jack plugs, anyway...I've also attached a circuit schematic and a photo of the actual "analog board". Feedback is more than welcome - as are improvements and what not!Thanks for the help to everyone who contributed in the earlier post!EDIT: Just for extra info - it uses a 9V alkaline battery as its power source, and draws a current of between 3.5 and 9.5 milliamperes (depending on the audio content). The actual control current to the BJTs is really small (hundreds of microamps at most), so it's just a bit of MC34063 wasteage and the opamp...

author: Zero999
author_rank: Super Contributor
timestamp: July 29, 2017, 10:36:32 pm
content: Why not use a switched capacitor filter and VCO? You didn't like it when I suggested it in another thread but it's bound to be better than the crappy old LM358 with its horrible crossover distortion.https://www.eevblog.com/forum/projects/op-amp-variable-high-and-low-pass/msg1264105/#msg1264105If you were concerned about the clock in a switch capacitor filter being noisy, the buck-boost switch mode supply will be just as bad.This isn't a terrible idea, just the implementation. Use an op-amp with a class AB output stage, get rid of the negative supply and make Rin higher, so the signal level in the filter is lower, thus minimising the distortion due to the non-linearities of the transistors: you can always add gain later.A switched capacitor filter would certainly have less distortion but that might not be what you're after. You may think this distortion sounds good, which is fine too.

author: Kalvin
author_rank: Super Contributor
timestamp: July 29, 2017, 10:40:53 pm
content: Quote from: Hero999 on July 29, 2017, 10:36:32 pmYes, check this nice video from w2aew about LM358 cross-over distortion:

author: amspire
author_rank: Super Contributor
timestamp: July 30, 2017, 02:27:05 am
content: The way the transistors are used is certainly different from any circuit I have seen. The first transistor Q1 looks like the collector is used as an emitter to make a really low gain transistor - perhaps a HFEof 5? The second transistor is the same, but there is no DC path on the emitter (acting as a collector) at all.I would expect the distortion would be high unless the signal level is very small (probably less then 1mV). I would also expect the kind of distortion to be unmusical, but I am guessing.The transistor DC current path can only go through the source, so it will be affected by the source impedance and I assume will not work if the source has a capacitor coupled output.I have to admit, it is a very original solution and I am amazed it works at all. About the crossover distortion of the opamp, there are many IC's that are much better, but the 358 can be substantially improved by adding a 3K3 to 10K resistor from the output to the negative rail so the output stage becomes a Class A stage that is only sourcing.

author: Audioguru
author_rank: Super Contributor
timestamp: July 30, 2017, 03:19:47 am
content: The lousy old LM358 also has a poor high frequency slew rate which causes trouble with frequencies above 2kHz which is many audio sounds. But with your very low frequencies it is fine.

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 30, 2017, 07:02:01 am
content: Quote from: Hero999 on July 29, 2017, 10:36:32 pmTo be completely honest, I have a truckload of LM358Ps lying around, and I wasn't sure that this would actually work. It would work in principle (and in simulation), but, well, as Bob Pease said, SPICE lies to you, all the time. I didn't want to (potentially) waste a nicer opamp on it, if something blew up (unlikely but, eh...)I will probably desolder it and use something nicer (LMC6482IN or something). At least, the 358 isn't the absolutely worst opamp I've gotQuote from: amspire on July 30, 2017, 02:27:05 amThe signal level is okay with 1Vpp stuff. There should ideally also be a unity gain buffer on the input to ensure that this does not cause problems with some hardware.

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 30, 2017, 07:32:19 am
content: Quote from: Audioguru on July 30, 2017, 03:19:47 amIt also depends on the size of the signal. In this case, it gets at most 1Vpp, so it's not into its "large signal" frequency response. I can't say I can see the problem on a scope - with the filter cutoff frequency at > 20KHz, I see all the harmonics of, say, a sawtooth wave, until the cutoff frequency, are as expected.Again, the LM358 was out of an abundance of supply. But it's not /that/ bad.Also, regarding the MC34063, at these low current draws, there is not much harmonic content, and it can be filtered out nicely with a passive RLC filter since it's at 50KHz+. This can happen /before/ the voltage rail hits the opamp. In a switched capacitor setup, the switching is intrinsic to the signal path, so the distortion is potentially much worse.

author: Zero999
author_rank: Super Contributor
timestamp: July 30, 2017, 08:08:42 am
content: Quote from: DrGonzoDK on July 30, 2017, 07:32:19 amIt's the output stage changing from sinking to sourcing and vice versa which causes crossover distortion. In your circuit, the op-amp is driving a fairly high impedance, so the current will be minimal. If you load it with say 2k to 0V then the cross-over distortion will become more noticeable.

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 30, 2017, 08:14:37 am
content: Quote from: Hero999 on July 30, 2017, 08:08:42 amYeah. Obviously, for an output stage, there has to be a buffer in-between. It's never a good idea to drive outputs directly from the active filter's own amplifier. It was okay, since in this case, I was driving very high impedances, so not a problem. And, I'm thinking of replacing it with the LMC6482IN which I've found to be a good quite cheap op amp generally.

author: Zero999
author_rank: Super Contributor
timestamp: July 30, 2017, 08:27:03 am
content: The LMC6482IN is only rated to 15.5V, 16V absolute maximum. Your circuit has a total power supply voltage of 18V.Why not use the cheap and cheerful NE5532, which is normally the first op-amp of choice for an audio amplifier?

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 30, 2017, 08:36:12 am
content: Quote from: Hero999 on July 30, 2017, 08:27:03 amWell... the negative rail can be tweaked so the max voltage isn't exceeded. And - the 9V battery was for convenience anyway. I have a bunch of the flappy 9V holders and currently only have a single variable lab DC power supply which I used for the control voltage. I didn't fancy cobbling something together as it was getting late, and my cat needed a bit of playtime.I've got a handful of NE5532's. I didn't pick it since it consumes quite a lot more current (what, about 15 milliamps instead of hundreds of microamps) than the LMC6482 and even the LM358. But it does have a nice 10MHz GBW product. Isn't it a completely BJT opamp - i seem to remember this... anyway, it should certainly be possible to pop it in and see how it does relative to the others.Also got a TLC061 and some horrible STmicro parts

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 30, 2017, 08:46:54 am
content: What's the point of Q2? There's no DC path out of that node except through Q1...Tim

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 30, 2017, 09:06:13 am
content: Quote from: T3sl4co1l on July 30, 2017, 08:46:54 amIt's working as a current-controlled resistor. Essentially, a 1:1 replacement from the standard Sallen-Key architecture. They aren't perfect - thus, resonance applies mostly to the <0V section of the input wave.When operated in reverse saturation mode, their equivalent resistance is (roughly) proportional to their base current, which, then, is determined by the control voltage.And, if you were to remove Q2, it wouldn't work since there has to be an interposed resistance between C1 and C2. If you just substituted a fixed resistor, this would change the parameters of the filter across its frequency range (as well as mess up the Q - make this change too much over the frequency range).The BJT's equivalent resistance is less susceptible to the signal, which was the problem with the earlier JFET design. It isn't linear, but with small (~1Vpp) signals, it's certainly useful - and some in the music community might call it "characterful".I got the inspiration from a 1970s synthesizer voltage controlled filter. I simplified it a bit, and changed quite a bit of the base current sourcing and the feedback. They had a separate discrete JFET/BJT cascode-like configuration before the opamp, and some of the feedback gain was applied here; the opamp part they used had a really low G*BW so I assume they did this to compensate for this.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 30, 2017, 09:13:08 am
content: Base current can't just go into a node endlessly though....Tim

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 30, 2017, 09:14:26 am
content: Quote from: T3sl4co1l on July 30, 2017, 09:13:08 amTrue, it probably goes through Q1. I just expanded my earlier reply, too.

author: DrGonzoDK
author_rank: Regular Contributor
timestamp: July 30, 2017, 09:30:30 am
content: Quote from: T3sl4co1l on July 30, 2017, 09:13:08 amAlso - I don't know if this answers your question (I'm obviously not an electrical engineer, only a hobbyist), but applying more control voltage does impose a DC offset to the signal. That's why there's a passive RC high-pass block before the non inverting input of the opamp (C3/Rhp), because this offset does of course mess up the filtering action somewhat (especially the Q...). The HP filter has a very low cutoff frequency (1.6Hz) so as to not affect audio-range content, but remove this offset.

author: KubaSO
author_rank: Contributor
timestamp: October 14, 2023, 12:10:20 am
content: LM358 is basically an "analog phone" quality op-amp, but still... all it takes to get rid of crossover distortion is a pull-down to V- or pull-up to V+ on the output. Let's not make a mountain out of a molehill.And this particular circuit would work just fine on a +9V single supply without trying hard. Hell, it can be made to work on a +5V "TTL" supply. TI has an app note by Ronald Michallick that covers low-voltage operation in such applications. Seehttps://www.ti.com/lit/pdf/sloa277.As "crappy" as it may be, it is still an excellent op-amp for some applications, and basic filter demonstrations for speech frequency range are OK. Not HiFi by any stretch of imagination, but usable in many cases.I've been using that op-amp in what some people consider precision applications. It's all a matter of willingness to fine-tune the design - operating points, load currents, buffering between stages, etc. Some consider it a pain. I consider it a challenge, at least as far as hobby stuff is concerned.

author: KubaSO
author_rank: Contributor
timestamp: October 14, 2023, 12:18:42 am
content: Quote from: Zero999 on July 30, 2017, 08:08:42 amLM358's output stage was designedexpressly and specificallyfor loads terminated to V- or V+. If V- is 0V then a 2k load to 0V is fine. Otherwise, it needs to be a 2k load to V-.LM358 was not meant to be loaded to mid-supply!- at least not when the output voltage needs to cross mid-supply.The reason that LM358 has cross-over is basically its whole claim to fame: class B output stage operation - very different from pretty much every other op-amp at the time. It can't be used well without understanding how it works and what it is meant to do. In the 70s, it was LM358 or LM10 if you wanted low-voltage operation without voltage conversion, and pretty much that was it.For "speech" and lower frequency use from low supplies, it still is an op-amp that can do quite a good job.

author: jonpaul
author_rank: Super Contributor
timestamp: October 14, 2023, 06:40:11 am
content: see THAT VCAshttps://thatcorp.com/blackmer-voltage-controlled-amplifier-ics/Jon