Help understanding this CMOS oscillator

Started by MrStab, July 13, 2014, 08:44:41 AM

Previous topic - Next topic

MrStab

hi,

so i found this circuit, and a variant thereof, interesting and decided to build it:


also: http://zpostbox.ru/g102.gif (... appears to have been blocked by host! wtf!)

i used the values in the first schematic, though i used a 33nF cap instead of 22nF, as somehow i couldn't find the bag with "22nF" written on it at the time. at first i couldn't get anything, till i poked around with a cap between the 3rd and 4th 4049 inputs. i figured this was wrong, and showed some issue elsewhere in the circuit, and eventually found that a 10uF cap in parallel with the 33nF (feedback loop?) cap made things work. weird.

it pretty much works, but i can't find much written info on this particular circuit - just common elements described in other circuits, and i can't figure out why this change in value makes everything work. i've figured out how to change speed, fast/slow switch, depth (roughly), but i don't like not knowing why the stock circuit isn't working for me. i get what seem to be clear and even square and triangle waves, but can't tell if the third output is truly "sinusoidal" or not. look at me with my big words.

i've altered the circuit to use a 4069 since, as i have more of those, but it worked the same with a 4049 (pin differences accounted for). i'm using a basic NPN-LED setup to visualise, before i get too in-depth working out the waveform, but that works independently of the rest of the circuit and doesn't interfere (no difference when i remove it).

any ideas? links? explanations? anything would be really appreciated as always!

cheers!
Recovered guitar player.
Electronics manufacturer.

anotherjim

Hi,
It looks like a basic Schmidt trigger + integrator. The same circuit you normally see done with 2 op-amps is contained in the first 3 inverters.

It should work with components shown but at fairly high frequency  . Maybe your scope timebase was too slow and it wouldn't display?

When you put a bigger cap on the 3rd inverter (integrator), you lowered the frequency, but now maybe the coupling cap to the 4th inverter (waveshaper) is too small to cleanly pass the triangle? It's actually quite a problem to AC couple LFO frequencies if it isn't already a sine wave.

To my mind, the resistor values are low by at least x10 (or even x100!) to use the advantages of the CMOS high input impedance and  also allow smaller non-electrolytic caps at low frequency operation. Assuming you want an LFO BTW ;)

I like using CMOS 4069UB in linear mode too, but unless there's a better use for the last 2 inverters (here doubled up for current drive) I see no advantage over a quad op-amp for the job.

MrStab

#2
thanks for the info, Jim.

all 3 waveworms seem to work symmetrically, whether or not they're "right" i can't really tell just yet. but they seem to be. i'm guessing the stock value of 22nF was for frequencies too high for general LFO use.

so you think i should lower the resistor values by 10x? using a polarised elecro cap on the 3rd inverter makes me uneasy, if i could use a smaller film cap it'd probably be better. currently i have all 10k resistors and the feedback cap is 10uF - think i should try 1k resistors and a 1uF non-polar cap? just making sure i understand.

i've been messing around with NPNs and LDRs in the signal path, does sound pretty cool so far. i have no scope btw, will be relying on a soundcard & possibly a prescaler when i get things working better. just using ears & an LED to see for now.    

thanks again!
Recovered guitar player.
Electronics manufacturer.

MrStab

ahh! i mis-read and put 1k resistors when i should've put 100k or more. i get that part now. oops. lol
Recovered guitar player.
Electronics manufacturer.

anotherjim

Hi,

No, I mean the resistors are too low. So where you see 10k, try 100k. Many CMOS inverter linear circuits use 1meg as maximum or even as high as 10meg! For an LFO, the self noise produced by large value resistors isn't a problem. Audio circuits tend to use around 10k values for this reason. You do need to keep the board clean with high value resistors, since any dirt that's even slightly conductive getting between the connections will change the circuit noticeably.

Large resistors means small capacitors. For timing, use the idea of the resistor value multiplied by the capacitor value (not as an accurate prediction but to help fudge toward what you want on the breadboard). So for a given time delay or frequency, a 1meg with 100nF equals a 10k with 10uF. Since cheap large value caps are usually polarized electrolytic which need to go the right way round (there isn't always a right way round), if you can avoid them it's a good thing (I think).

Jim

MrStab

thanks for the further details, Jim. i changed all resistors for 1M (and 1.5M), and reduced that cap to 100nF, but the wave now seems to be asymmetrical, ie. the signal is trem'd for longer than it is un-trem'd. i'll need to tweak some more. i'm now using a 1M resistor in series with a 1M pot between 1st inverter input and 2nd inverter output for the speed control, doesn't seem to be as effective as it once was.

FWIW, the electrolytics only work with the negative lead on the inverter input. not that it matters anymore. just in case you're curious!

i want a square+triangle+sine capable LFO with minimum parts and easy to customise between circuits, i suppose - there's actually too much info out there, i couldn't figure out what to settle on!

cheers
Recovered guitar player.
Electronics manufacturer.

duck_arse

Mr Stab,

I have a copy of "301 circuits" from elektor magazine. Nr.6, page 13 is a "cmos function generator", very similar, yet also different, to your shown circuit. it is accompanied by a complete theory and build notes. if you go here:

www.scribd.com/doc/224792624/Elektor-301-1-Circuits
or here maybe:
www.scribd.com/doc/203023492/Elektor-301-Circuits

and can be bothered waiting for the download, you can get a copy for yourself. as a bonus, you'll get 300 other circuits, some will be useful.
You hold the small basket while I strain the gnat.

anotherjim

Your speed control can quite easily be a 10k in series with a 1Meg pot. You'll find that a common combination.
As for symmetry, a DC offset could mean what you're controlling is going full on or off at one limit before the waveform reaches it's upper or lower limit. The 22uF in the middle is removing the DC offset there, but if it's an electro it's leakage current could be forcing an offset it's meant to correct! You could try 2 large electro's in series (negs together in the middle, pos to outer and connect those in the circuit) they'll probably need to be large though - 100uF as a start.

MrStab

thanks for the link, Duck - loads of cool projects there for a rainy day. which is every day in Glasgow.
the explanation under the "Block Diagram" heading makes your comment about symmetry make more sense, Jim. i think i'm starting to grasp it, at least.

i'm apprehensive about doing the "series electro trick", based on the fact i've never seen it in commercial circuits - or should i stfu and just try it? a plain, single 100uF electro doesn't seem to make much difference.

Duck's article says at one point "This difficulty is overcome by means of P2, which allows symmetry adjustment." I'm still trying to make sense of it, and admittedly most of the preceeding text is lost on me, but P2 seems to offer some kinda biasing from the power supply to the first inverter input. think i should try that?

was i right to multiply all those 10k resistors by 100? is there some relationship i've missed? if i can't make this circuit usable with sensible values (ie. to avoid polarised caps), i may start on the one in the article. if i can make out all the labels.

thanks for the help, guys
Recovered guitar player.
Electronics manufacturer.

anotherjim

A typical way of injecting a bias is as simple as say, a 10k trimpot across the supply and the wiper feeding (say) a 100k resistor to an input pin. Effectively, the same kind of thing you see as Vref supply to an opamp  input pin but variable.
When I've made LFO's, I've used opamps with a variable Vref as a means to get symmetric sweep. The depth control would be a volume pot terminated to the variable Vref - not ground. The pot wiper feeds whatever your control element is.

I'm pretty sure I've seen 2 electro's in series in Boss LFO circuits (2 x 33uf). That's the integrator timing cap (3rd inverter on your diagram).

Jim

anotherjim


Been at the breadboard. Started the idea from scratch and came up with this. No waveshaping needed to get a Sine wave since the CMOS inverter doesn't seem to like pointy waves when biased to linear mode.

A variable DC bias can be injected via 1M to pin 1. This allows wave bending and the sine will readily turn into the so-called "hyper triangle". It does shift the frequency though.

Hmmm - 2 inverters left over. What could I make? Perhaps a cheeky little Tremolo?

Jim

duck_arse

no no no, no cheeky. use the extra to invert the square and integrate again for outta phase triangles. will that work?

what is your circuits current draw, another? the elektor article noted 6V max and 18mA, or something.
You hold the small basket while I strain the gnat.

anotherjim

A good idea but if you use another integrator, I think it would need a 2 gang Rate pot on the inputs to each so that the extra one tracks the existing one at all frequencies. You could drive this from the middle of the Trigger( Pin2) so it would be 180deg off? Or follow the existing integrator with the same thing as the last (Sine) stage but with equal value input and feedback resistors.

I think 60, 90 or 120 degree spread would be better for multiple LFO so you don't get that side to side seasick effect, but how to do that easily?
Simple phase shifts are easy - at fixed frequencies. But if you want to go from say 0.3 to 10Hz, well....

I'm thinking along the lines of counter/staircase circuits sequenced by a master counter to get  proper multiphase LFO's. Or program those AVR's I've got lying around ;)

I'll measure the current -  it is a concern if you want battery operation. The chip I've got (HEF4069UBE) seems warm, but it's been scorching hot here lately. It's not such a problem with the CMOS as an oscillator that's always running as it is with an audio circuit that's spending most of it's time sat at mid supply.

I've used these chips in Linear mode at over 12volt. It matters who made it. I think (ancient memory) it's Motorola (and second source from Hitachi) MC14069UB is one to avoid. They contain lower R(on) transistors and they will go up in smoke!

anotherjim

Current Consumption. Rounded up values.
Stopped = 10mA
Running = 20mA peak
@9VDC

anotherjim


Added a unity gain inverter after the sine to give antisine. Not too shabby as this is just from slightly clipping the CMOS and nothing more.

No-Talent-Wanker

Hello, long time lurker but due to the fact that I am just an idiot that happens to be able to read electrical schematics (for the most part) I mostly don't have much to contribute.

Until I saw this...

My latest project is a ribbon controlled synth that is inspired by Tim Escobedo's "Synthstick" except the the ribbon controller is fashioned from copper slug repellent tape and and VHS tape and I'm using a CD4047 for the oscillator as opposed to the CD40106...

So, what has this got to do with helping you understand this CMOS circuit? Well, the raw square wave from the 4047 is really boring (and harsh) so I have been lurking for inspiration in the Lunetta's section on the Electro-Music.com forum (as well as here) looking for simple, low parts count wave shaping circuits and I just got through reading this thread:

http://electro-music.com/forum/topic-43897.html

A little more than half-way down the page, DGTom posts a schemo of a linear State variable Filter and the idea "...but with the inverters replacing the op-amps."

On the second page of that thread is a schemo posted by Silesius and that circuit is similar to the one posted by the OP in that it has multiple waveform outputs... except it only uses 3 inverters and it's a VCF (and an oscillator) using only 1/2 of a 4069 and those mA sucking LED's are not to be found.

Any way, lots of discussion about what's going on in the circuit which may help set off light bulbs for y'all...

Back to lurk mode.

commathe

This thread has made me really happy since I love CMOS so much. I haven't tried this myself but I've seen it a few times:



I believe this also puts out a sine

duck_arse

Quote from: No-Talent-Wanker on July 21, 2014, 08:22:03 PM
Hello.
Back to lurk mode.

I have nothing (as usual) useful to add, except "^ that's a cracker of a name, best I've seen this week".

and anyone who hasn't yet read this, probably should:
http://www.fairchildsemi.com/an/AN/AN-88.pdf
You hold the small basket while I strain the gnat.

anotherjim

For a synth, you need a a controlled oscillator.
The 3 inverter circuit above does indeed make a sine -  it's a phase shift oscillator. A standard idea but realized with the CMOS. ~it's major drawback is that it's hard to change the pitch from a single control over a useful range.

The basic CMOS Schmitt trigger oscillator on a 40106 (one cap & 1 resistor) does in fact produce 2 waveforms. There's a pretty good triangle wave on the input of this oscillator as well as the square wave from the inverter output. The Triangle is only about one third of the supply voltage in peak to peak amplitude. You can amplify the triangle but it must be with a high input impedance amplifier so as not to load the timing capacitor. I've already shown how a 4069 or 4049 un-buffered inverting amplifier can make a reasonable Sine from a Triangle simply by driving it partially into clipping. This sine shape can be varied by changing the gain (from the clean triangle all the way to square) . It's the same as with an inverting op-amp circuit -  gain = Rfeedback/Rinput.

The Schmitt oscillator can be "played" by varying a single element. Either the feedback resistor or the timing cap. The easiest way is to fit an LDR in series with a fixed timing resistor and have an LED on the LDR with the LED brightness controlling the pitch. You can also vary the pulse width by having a variable DC bias feeding the inverter input.

If instead of 40106 you use 4093 (quad Nand Schmitt), you can gate the oscillator on & off. Use another oscillator as the gate control and you can chop it from slow LFO thru to fast ring mod or oscillator sync effects.

The main complaint against the Schmitt trigger oscillators is poor stability. They are very sensitive to power supply voltage - but that's what voltage regulators are for. In fact you can make a disco drum by letting the supply voltage drop to zero. No don't!

Lots of fun on the breadboard - go to it!


anotherjim

That AN88 is a copy of the National Semiconductors AN88 from their Linear Applications volume 2 (I have a Radio Shack edition - 2 dollars and ninety five cents). In case anyone's wondering, the 74C series were 4000 series CMOS with 74 series TTL compatible functions and pinout. I don't think they're around anymore?