The comprehensive phase shift oscillator thread

Started by midwayfair, March 19, 2014, 02:46:31 PM

Previous topic - Next topic

samhay

^-See the wikipedia article for a PSO that uses an op amp. You can vary the negative feedback resistor to change the oscillation. I can't remember ever seeing this used, but it seems like it would be a sine wave from an op amp, so I'm not sure why it isn't.

I have this working on the breadboard - looks ok, but nothing spectacular.  It's a viable alternative if you want a single op-amp LFO that can drive an LED or two.
It's not quite a sine wave though as the waveform is still hitting the op-amp's power rails.  
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

tca

#21
What is the typical period of oscillation of a tremolo?

P.S.
I've been looking for a bias tremolo, without using a variable resistor that is, using a LDR or a diode, made with transistors but no luck. Similar to some old Fenders.
"The future is here, it's just not evenly distributed yet." -- William Gibson

R.G.

A phase shift oscillator is an amplifier with an inverting gain which has a feedback network attached that
(1) changes the phase of the signal passing through it to either +180 degrees or -180 degrees at some frequency
and
(2) provides just enough signal passing through it to drive the input to produce that much output or more.

The amplifier type does not matter as long as it can provide an output which is properly phase shifted and fed back. An opamp makes a great PSO because you can set the operating gain simply and easily to give the right loop gain, and loading doesn't affect it much.

PSOs naturally produce sine waves if and only if the forward gain through the amplifier exactly compensates for the attenuation through the phase shift network. If the product of forward gain (as AT said, 29 for the classical three section equal-parts value PSO) and the attenuation of the network is exactly one, the output is a pure(ish) sine. If it's 0.9999999... the thing will eventually quit oscillating. If it's a nano-bleem bigger than 1.000000..., the output size will build up until something distorts and it's not a pure sine wave any more. So every practical PSO has some mechanism to keep gain higher than 1 and deal with or live with the distortion that much extra gain causes.

The one-transistor (or one FET) PSO was used because it's about the cheapest way to make one. You pay for that with it being temperamental. The gain of a single transistor varies with loading, so you can't drive much of a load without running the risk of the loop gain being decreases until the oscillator won't start or if started continue to run. Single transistor PSOs are not reliable if they have good, low distortion sine waves, and are not low distortion if they can withstand much loading. It's a delicate balance.

You can make PSOs with more than three phase shift oscillators - but not less, there's not enough phase shift - and this can help some with the frequency variation range if you want to change the frequency. PSOs can be made with non-identical phase shift stages, which helps with some conditions.

There are almost infinite variations on the theme, but they all have a similar three-or-more-section phase shift network providing a phase shift to reinforcing by the time the signal gets to the input, and a gain that almost exactly makes up for the feedback network loss. That is what a phase shift oscillator is. Everything else is implementation details.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Kipper4

where does the led go in the op amp version please?
Ma throats as dry as an overcooked kipper.


Smoke me a Kipper. I'll be back for breakfast.

Grey Paper.
http://www.aronnelson.com/DIYFiles/up/

samhay

#24
Quote from: Kipper4 on March 21, 2014, 09:46:34 AM
where does the led go in the op amp version please?

From the output via a limiting resistor to ground, V+  or V-.
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

midwayfair

Here's how I did the LED drivers. This works way better than what's in the Magnavibe:



It's a bit hard on/off at higher depth settings, so an LDR with super fast turn on times can be really choppy.

Drives at least two superbrights really well, can probably get away with three.
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

PRR

> A phase shift oscillator is....

All good points, and most applicable to other oscillator forms (Wien, L-C, etc).

LFOs have some "special" problems.

> If it's 0.9999999... the thing will eventually quit

Or never even start.

> some mechanism to keep gain higher than 1 and deal with or live with...

The start-up time can be an issue. 'Specially with LFOs.

At turn-on it is not oscillating. Some stray wobble gets amplified around and around. Output builds-up gradually.

If we assume the initial wobble is thermal hiss, around 1 microvolt, and we want say 10V output, then we must build-up 10,000,000 times or 140dB.

If the excess gain is 12% over, 1.12X, then the output rises about 1dB every go-around, every Cycle.

We must run 140 Cycles to build-up.

MegaHertz oscillators will start "instantly". A 1KHz oscillator starts in well under a Second.

But a 1Hz (slooow vibrato) oscillator takes over 2 *Minutes* to build-up at 12% excess gain.

Even if we let the LFO free-run all night, a 2-minute startup is annoying. And in systems with poor PSRR there is a tendency to kill the LFO when not needed so the "clean" sound does not throb.

Though in fact, for once the natural perversity of the Universe works in our favor. Everything has 1/f noise rise. For many audio devices the noise rises below ~~200Hz. So my "1uV" assumption may be more like 200uV. So we only need 94dB build-up, ~~90 Seconds instead of ~~140 Seconds. Not a thrill but it helps.

Alternatively: if you throw a "thump" into the CRCRCR network at start-up it will build up faster. If you hit a magic value it will start at full output. Fender tube trems, the fancy models, took -50V from bias supply to hold-off the LFO. When the -50V was released, the resulting 50V kick-start throws the LFO to full level.

However these and lesser Fender tube LFOs did not use a mere 1dB excess gain. More like 4dB-5dB. So a 94dB build-up takes only 20 cycles. "Only" 20 seconds at 1Hz, a couple seconds at more usual ~~10Hz rates.

Now if you start with 5dB excess gain, and come to your limit level, your first full swing wants to be almost twice the maximum level. Typically it will be very distorted.

> An opamp makes a great PSO because you can set the operating gain simply

But it becomes difficult to get the gain to change from ~~50 to 29.0 when limit level is reached.

You can use Zeners in the gain-set but they have no memory. Every cycle they idle up to a point, then reduce the peak. To loss-off several dB excess gain they have to clip brutally. The effective gain shifts from 50 around zero to 10 above threshold, every half-cycle. Distortion is typically pretty bad.

We can do much better with an AGC loop. This can be as complicated as you like, but rarely simple or small.

> The gain of a single transistor varies with loading

In this world of 19 cent opamps we can (finally!) laugh at loading.

In RF work it is widely accepted that all but the cheeziest oscillators want buffers, even if only electron-coupling a pentode. VFO for transmitter control usually run a separate stage so whatever happens downstream does not affect the oscillator.

And it is the fact that a one-device gain-stage IS variable-gain which makes it a useful tool in oscillator design. Especially when finding a trade-off between low frequency, reasonable start-up time, and reasonable distortion. You rig the gain-stage so that large signals beat the device bias down. This reduces gain. You find a way to hold that down-bias between cycles. The gain can be more constantly 29.1 over all of each cycle.

And in vacuum tube work this happens semi-naturally. The grid diode sucks when over-driven, which charges-up (down) a coupling cap, which holds down-bias between cycles. All these parts are already in there! And the grid (or cathode) voltage gives information about the oscillator's health.

This can be done with junction transistors but it needs a bit more care.

It works with JFETs, except that it is hard to get a starting gain of 50 with JFETs at reasonable supply voltage (<40V). You could rig your buffer for make-up gain.

But all said or done..... the Phase-Shift oscillator's major claim to fame IS that it is as cheap as you can get. Once you start gussying it up, other paths make as much or more sense.

And you do have to ask how allergic you are to non-Sine waveforms. The Function Generator approach gives INSTANT start-up, linear tuning (instead of third-root as when only one R of a CRCRCR net is varied), *fixed* output level. The drawback is that triangle-Sine converters always have pips or flats.

Merlin found that super-clever Wien which tunes with one pot. There's a wacky one-pot bridge-Tee in some Roland(?)BOSS(?) pedals.
  • SUPPORTER

midwayfair

Based on some of PRR's suggestions in another thread, I updated the PSO for driving LEDs. It has a smoother wave form than the one I posted earlier.



I know it probably looks a little wasteful to keep R3, but it doesn't sound the same no matter how I play with the values if I take it out. So it stays. I don't think the values of R1 and R2 are exactly critical, but I think you'd have to play with them to use diffused LEDs. Those looked a little dim. R1 does have to be at least 15K to get any real depth. Lower R2 will make the depth a lot, well, deeper.

PRR also suggested decoupling the collector from the LEDs, so if you want to try that, put a 22uF or 47uF cap between Depth 2 and R2. However, I found that to be a lot touchier. His version has a trimpot to handle the touchiness; I think 10K works pretty well for the trim. Here's his version:

My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

R.G.

Note that using a dual opamp in this circuit lets you have a much more predictable PSO and a much less intrusive LED driver in the same 8-pin package. It extends the ability to embellish by a lot at only minor cost.

Failing that, an emitter follower on the transistor collector helps insulate the PSO section from the vagaries of the world - a lot.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

PRR

> using a dual opamp in this circuit lets you

++1.

But I assumed he had a no-chips philosophy.

And I think there's virtue in the one-transistor LFO.

Assuming you *don't* crap it up with heavy loads like LEDs.

Even Fender turned to an LFO buffer for many of his less-cheap tube amps.

A chip would be a wonderful buffer. Even handle the DC+AC summing he is groping toward, and avoid large (LFO-worthy) coupling caps.

> looks a little wasteful to keep R3

No. Do the math.

The Collector is probably around 4.5V. The LEDs alone sit at 3.2V. So they glow just fron the DC.

R1 R3 inject 1.6V added to LED voltage, 4.8V. Higher than the ~~4.5V at collector. Now the LEDs *don't* glow from the DC.

And looking at the numbers, you might wonder what-if you stuck in a third LED. The voltages are about the same. LED costs more than R3 but is affordable. And now you have a throbing light, always good gear bling.
  • SUPPORTER

midwayfair

Quote from: PRR on March 30, 2014, 03:13:03 PM
But I assumed he had a no-chips philosophy.

Well, I've certainly used a lot of chips for LFOs ... and I can understand why someone would sooner go with a dual op amp rather than torture themselves with a single discrete device doing something it's not good at. I've never claimed that anything I do is the best way to do something. Runoff Groove's Tri Vibe oscillator is certainly a far more robust way of generating a sine wave, and the lope in this can probably be duplicated with a diode across the speed pot in the tremulus lune's oscillator, and for a straight tremolo effect, the EA tremolo's use of a FET makes things a heck of a lot easier.

But this DOES sound slightly different in the tremolo I just used it in from many other tremolos I've built, so I don't think it was a total waste of my time.

RG, I don't suppose you have an example off the top of your head of an emitter follower for driving the LEDs? I tried it and a I got a VERY hard waveform, pretty much completely square. Basically, this:

        +9V
          |
         C
LFO->B
         E
         |
        LEDs (any color)
         |
        470R
         |
        G

I used a voltage divider from the LFO before it hit the base, like in the EA Tremolo.
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

R.G.

Quote from: midwayfair on March 30, 2014, 04:58:27 PM
But this DOES sound slightly different in the tremolo I just used it in from many other tremolos I've built, so I don't think it was a total waste of my time.
Not at all. Just that if you get frustrated, there are other ways.

QuoteRG, I don't suppose you have an example off the top of your head of an emitter follower for driving the LEDs? I tried it and a I got a VERY hard waveform, pretty much completely square. Basically, this:
...
I used a voltage divider from the LFO before it hit the base, like in the EA Tremolo.
I don't, but a little thought would turn up some useful information.  LEDs' light output is proportional to forward current. Forward current goes from nearly zero to massive when you drive the LED with a low impedance voltage source. However, if you drive it with a very high impedance current source, the light output follows the current and the *voltage* jumps from near 0 to the LED forward voltage, where it only wobbles a little.

So if you want on/off drive it from a low impedance source. If you want variation, drive it from a high impedance source.

An emitter follower on the collector of the main oscillator does two things. (1) it buffers the collector, preventing the collector from being loaded down by the outside world and (2) it presents a solid, low impedance voltage output to the outside world. This is what you want if you want a voltage-output LFO.

If you want a current-output LFO, there are some tricks you can play. I developed a liking for differential amplifiers and current mirrors a long time ago. If you want to drive the LEDs with a *current* proportional to the conditions on the collector of the LFO transistor, one sneaky way to do it is to put a PNP current mirror on the positive supply and use the output of the current mirror to drive the LEDs.

This takes some doing, as you now have to make the LFO not only oscillate, but oscillate with the right current, but there are other tricks that can be played on that issue too. Ignore that for now.

To do this, you would take two PNPs, and connect both their emitters to the positive power supply. Both bases are shorted together, and one collector connects to the joined bases. This collector is the input. The other collector is the output. The collector resistor from the LFO transistor  is disconnected from the + power supply and connected to the input collector on the mirror. The LFO should now still run as before.

However, an LED from the output collector of the mirror to ground will have a current in it that is very nearly the same current as flows in the collector of the LFO transistor. All the voltage is dropped across the output PNP from emitter to collector, and the PNP forces a controlled current in the LED. As long as you have enough voltage, you can stack LEDs in line, and they all have the same current in them. The necessary voltage is about 2V across the PNP, so as long as your power supply is greater than two volts bigger than the sum of the LED forward voltages, this works for series LEDs.

There are many tricks to play with this, but it's a handy way of using a current mode buffer on the LFO collector instead of the voltage mode buffer of the emitter follower.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

midwayfair

duck_arse linked to this in another thread today, and I've seen a video since then that is also very informative. Among other things, it omits the point I failed to make in my original post that the R-C network inverts the phase 60 degrees each time, resulting in a 180 degree phase shift between the collector or plate and the base or grid. Uncle Doug is awesome.



My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

R.G.

The PSO is amazing - but it's being rapidly overtaken by uCs. The latest low-end uCs from Microchips have built-in numerically controlled oscillator hardware, A-Ds, and PWMs.

That means you can read a pot with the A-D, have that number run the NCO, and output it as an analog(ish) voltage with the PWM, all in one package with the only outboard components being a pot and some step-filtering on the output. And this comes with a range of HUGE and a hardware development cycle of about nil.

And you get any waveform, including a sine, or what the ear wants, which is a hyper-sine.

Just sayin'...
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

midwayfair

Quote from: R.G. on June 23, 2015, 06:45:15 PMThe latest low-end uCs from Microchips have built-in numerically controlled oscillator hardware, A-Ds, and PWMs.

Well, yes. I use the TAPLFO all the time, and Slacker made us an 8-pin ucontroller program with multiple waveforms and an unused digital input that could be tap tempo. I'm also aware that there is something from ... Pedal Sync maybe? ... already programmed for every LFO function imaginable.

But not everyone can or has an interest in programming. You can count me in that group ... even though I've done some coding, it's one more thing I'd have to learn that's a distraction from actually playing my guitar. :)

And PWMs aren't perfect, either: they seem to require a lot of support circuitry for anything except optical devices, and they tick in harder waveforms (which, to be fair, PSOs can't do).

I have yet to encounter anything that's flat-out SIMPLER and SMALLER than the PSO, so I think it's worth everyone understanding it for when those are the qualities they need. When I need something that goes beyond simple and tiny, I reach for something else. :)
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

R.G.

I fully understand. Just pointing out for the audience:
Good, fast and cheap: you may pick any TWO.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

PRR

#36
> the R-C network inverts the phase 60 degrees each time, resulting in a 180 degree phase shift

Vocabulary clarification:

60 degrees is not "invert".

Just a "shift". (Where have I seen that word around?)

I'm DIY-ing a curved wall out of discrete blocks.



Just-say that I laid each block at 60 degree angle from the one before it. Then after three blocks I would have a 180 degree change of direction. Left (normal) view.

Human language is funny. When I bend a wall we do not say "invert". However if I put the first block face-down, the next block at 60 degree angle (with something to hold it up), and keep going, after the 3rd block it would be face-up, "inverted". Right (sideways) view. While these blocks won't sit at 60 degrees to each other, if I keep going at 20 deg bend(*) they will come out "inverted" from where I started.

That's just our language for blocks and gravity. In fact in everyday language, "invert" is a lot about gravity. I invert the trash-can, trash falls out, a very significant change. In electronic signals we don't have gravity so "invert" does not have an absolute direction. However if we 'scope the input and output of a simple 1-stage amplifier, one trace is upside-down, inverted.

(*) BTW, you do not HAVE to plan for 60 degrees in each R-C stage. That's just the simplest way. Two stages won't work (shift only goes to 179 degrees and then at high loss). 4 stages work fine, and will sing where each stage is adding 45 deg. 5 and 6 stages can also work. The many-stage networks have lower loss so do not need as much gain in the amplifier. But it is diminishing returns, and the added R-C costs soon exceed the decreased amplifier cost. 3-stage is common, 4-stage is rare, anything else is just odd.
  • SUPPORTER

Rob Strand

QuoteI have yet to encounter anything that's flat-out SIMPLER and SMALLER than the PSO, so I think it's worth everyone understanding

Yes,  that's why you see them a lot as well.

They are fairly easy to get working (no pots to tweak the feedback level) because the transistor distortion regulates the loop gain in a "nice" way.  Moreover you can adjust the frequency with a single-gang pot.

There's a couple of details you should check in a PSO design:

- Make sure it works when the battery is low

- Make sure it works when the transistor gain is on the low side of spec.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.