Help understanding this CMOS oscillator

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

Previous topic - Next topic

Mr. Lime

May someone have the frequency calculation of the CMOS LFO for me?
Can't find a formula anywhere..

Is there a significant output drop between the different waveshapes?
Thanks a lot!

Thanks for help

anotherjim

That's one of my concoctions. No way did I calculate anything. Designed on breadboard and tweaked until it worked how I wanted. However, its a standard type of oscillator really but done with inverters instead of op-amps.
It is hard to search for these things. There is no snappy descriptive name for this type. Many sources just call it a "Function Generator" which isn't exactly helpful. Then they tell you everything about it except the frequency formula, which is a well kept secret ;)


In the inverter version, 1/6.3RC, where R is R3+Vr1 and C is C1, might get somewhere close, but with these things, I've never known calc's to hold up to reality. But if it actually does 10Hz when the calc said 6Hz, at least it's in the right range and you know what kind of values your components need to be if not exactly.





Rob Strand

#22
(Jim's drawing: R1, R2, R = R3+VR1, C=C1)

Period,

T = 4* (R2/R1)  C R

Frequency,

f = 1/T

With Jim's values that calculates to 0.7Hz to 6.5Hz which agrees with the values on the schematic.

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

Mr. Lime

Thanks a lot guys!

QuoteThat's one of my concoctions. No way did I calculate anything. Designed on breadboard and tweaked until it worked how I wanted. However, its a standard type of oscillator really but done with inverters instead of op-amps.
It is hard to search for these things. There is no snappy descriptive name for this type. Many sources just call it a "Function Generator" which isn't exactly helpful. Then they tell you everything about it except the frequency formula, which is a well kept secret ;)

Yeah I agree, as much as I love CMOS ICs, it's hard to find some useful reading.

I think a rough calculation is good enough and that helps a lot.
As some may have seen in my other posts I'm looking for available options for oscillators with wide range and this one looks very tasty and cheap.

According to the formula, replacing the cap gives us a nice range!

470n:  0,7Hz - 6,5Hz
47n: 7,8Hz - 65Hz
4n7: 78Hz - 650Hz
470p: 780Hz - 6k5Hz
100p: 390Hz - 3k7Hz
47p: 190Hz - 1k8Hz

If I did my math right..?
Are there any audible limitations to consider when the cap values are changed?
Thanks for help

Rob Strand

#24
Quote470n:  0,7Hz - 6,5Hz
47n: 7,8Hz - 65Hz
4n7: 78Hz - 650Hz
470p: 780Hz - 6k5Hz
100p: 390Hz - 3k7Hz
47p: 190Hz - 1k8Hz

If I did my math right..?
Are there any audible limitations to consider when the cap values are changed?

Overall OK, but there's a small error in that you should add 1M and 120k for the low frequency side.

You might find the frequency starts to deviate from the calculations when the cap values are low, like 47pF.  That's because the gate capacitance and stray capacitances creep into the behaviour of the ckt.

At the high frequency side you might also see some deviations and perhaps some rounding off of the waveform.  If you see that try reducing the values of R1 and R2 but keep the R1/R2 ratio the same eg.  100k and 68k  but you might not need to go that low to kick it back into shape.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Mr. Lime

#25
QuoteOverall OK, but there's a small error in that you should add 1M and 120k for the low frequency side.

You might find the frequency starts to deviate from the calculations when the cap values are low, like 47pF.  That's because the gate capacitance and stray capacitances creep into the behaviour of the ckt.

At the high frequency side you might also see some deviations and perhaps some rounding off of the waveform.  If you see that try reducing the values of R1 and R2 but keep the R1/R2 ratio the same eg.  100k and 68k  but you might not need to go that low to kick it back into shape.

Of course, the 120k has to be included, you are absolutely right, Rob!

I wouldn't go lower than 100p but good to know where care has to be taken, thanks!

One last thing I'd like to add perhaps is a "resolution" control to pulse width modulate the square wave. This is essential for a bit crusher kind of circuit to me.
Haven't seen something like this with triangle or sine wave outputs included. The Parasit Studio New Wave Generator has such a circuit for it's square wave LFO using CMOS.

Is there anything speaking against something like this?




Thanks for help

Rob Strand

QuoteHaven't seen something like this with triangle or sine wave outputs included. The Parasit Studio New Wave Generator has such a circuit for it's square wave LFO using CMOS.

Is there anything speaking against something like this?
It's not quite what you want.   

When you feed square-wave into the "integrator part the input signal is always full level 0 or Vcc.  So when you have a diode circuit in there the diodes are always on or off.   The only things you have control of is resistance in series with the diodes and the fact you can choose different resistances for positive and negative diodes.

So as you have drawn the circuit, suppose the resolution pot is at one end.  One polarity will charge the integrator quickly through the lowest resistance part of R3 and the other will charge the integrator more slowly through the series combination of R3 and resolution pot.  Since both of those paths have resistances much lower than your timing resistors (R2 + RATE pot) you will find the Rate pot is ineffective.

If you look at the Parasit Studio New Wave Generator they use a switch so only one of the diode paths is effective at any one time, the other time the signal passes through the larger Rate pot resistance.   The have a coarse switch instead of a resolution pot.

I understand you want to use a single Resolution pot for the shape and a Rate pot for the frequency.  Unfortunately a solution isn't so simple.   In order to control the shape the Resolution pot needs to be the larger value pot. Imagine pulling your Rate pot and putting in a 1M Resolution pot.  The shape/duty control works fine but the problem now is the frequency is fixed!     

The ultra-simple solution is to put a different pot in each diode arm but that's really annoying to use.   Another simple solution is to keep the frequency pot wired as is, keep the switch, but put a pot in series with the diode arm.   This is a little easier to use.  A centre-off switch will let you keep the triangle shape.

There's another way where you feed DC into the point where R1 and R22 join but this method is only good when you want the waveform to be kind of trianglular.

Another way is to wire the resolution pot like you have now and the frequency pot like the CE2 does it,
Quotehttps://www.electrosmash.com/images/tech/ce-2/boss-ce-2-lfo-circuit.png

You will need to create a Vref.     I have a feeling if your Vref doesn't match the CMOS gate threshold it might not work that well.  Also the range of frequency adjustment is likely to be poor compared to the original circuit.

So I guess there's no easy solution with that circuit.    Each solution is a move in the right direction but none really working 100% as you like.   That's why Parasit Studio New Wave Generator did what they did.   

Things like the old 8038 function generator let you adjust the duty/shape independent of frequency but inside they use a completely different scheme.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Mr. Lime

Thanks for those insights!

Indeed things getting to complicated for a CMOS Oscillator when it comes to Vref. Circuit wise it isn't elegant either having so many pots or switches and I guess a dual pot won't help?
I already discussed the ICL8038 somehow but can't find a useful formula for it's frequency output in relation to the pot on pin 8 in the datasheet.  Sure the 8038 has low parts count and fulfills the requirements. On ebay they are seller who carry them and I ordered 5 pieces but I have no idea if they are going to work..
There seem to be almost no guitar effect pedals using that chip so I have no references how to set them up correctly.



Thanks for help

Rob Strand

#28
QuoteI guess a dual pot won't help?
I can't see an easy way.   What you want is to be able to do is set the two duty resistors using a Resolution pot, more or less like you had.    The problem is for frequency you want to scale *the value* of the Resolution.   but you physically can't do that.   Another angle is to change cap but trying to make that variable isn't so easy.

QuoteI already discussed the ICL8038 somehow but can't find a useful formula for it's frequency output in relation to the pot on pin 8 in the datasheet.  Sure the 8038 has low parts count and fulfills the requirements. On ebay they are seller who carry them and I ordered 5 pieces but I have no idea if they are going to work..
There seem to be almost no guitar effect pedals using that chip so I have no references how to set them up correctly.

There's some formulas on page 7,  (more info on page 10)
https://electronic-engineering.ch/radiocontrol/datasheets/xr8038.pdf

After looking at that data sheet  I'm afraid it might not do what you want either!    My apologies, after 30 years or so my memories of the chip details aren't as clear as they once were.

So if you look at figure 5 it has the variable duty scheme.    At the bottom of the left column on page 7,
"If the duty-cycle is to be varied over a small range about 50%, the connection shown in  Figure 5  is slightly more convenient."  In other words that scheme  has the same problems as the CMOS oscillator.

The circuit on fig 7 where the duty is set by resistors and the frequency set using a control voltage might work.  However, there's not a lot of info on the how the FMSI pin works.

I have a feeling the old XR datasheets and applications notes explained a lot more.   Let me see if I can find something.

So here's one note,
https://www.renesas.com/www/doc/application-note/an013.pdf
(more formulas in https://www.mit.edu/~6.331/icl8038data.pdf)

The first page says 100:1 range in frequency using voltage control.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

diffeq

Get a VCO with triangle output. Feed the triangle wave into a comparator, varying reference voltage will vary duty cycle of the comparator output. VCO will need a stable reference for Vc. Maybe 5V regulator or zener (buffered) can be used for that.

Fig. 32, p. 18 shows a simple enough VCO:
http://www.ti.com/lit/ds/symlink/lm2904-n.pdf

ElectricDruid

Does it have to be single supply? (That schematic you posted for the 8038 was +/12V)

If you've got +/-12V, get a 3340 (AS3340 or V3340). It's got a triangle wave output, and a pulse output with variable width already. Pulse Width CV runs 0-5V on a +/-15V supply, so probably proportionally less on +/-12V.


anotherjim

On breadboard at the moment, a 4046 VCO with 3Hz to 30kHz control range at 15v and 1Hz to 10kHz at 9v.

ElectricDruid

Quote from: anotherjim on October 13, 2019, 04:43:26 PM
On breadboard at the moment, a 4046 VCO with 3Hz to 30kHz control range at 15v and 1Hz to 10kHz at 9v.

Lol, even the datasheet for the 4046 doesn't commit itself to any frequency range formula. They vary *so* much it's amazing. I've never used such a variable chip as that one. The differences from one to another are huge, and between different versions by different manufacturers, they can be as much as x10.

Since it was intended to lock to an incoming frequency, I suppose it didn't really matter. So it's our fault for trying to use it as a VCO!

Rob Strand

QuoteLol, even the datasheet for the 4046 doesn't commit itself to any frequency range formula. They vary *so* much it's amazing. I've never used such a variable chip as that one. The differences from one to another are huge, and between different versions by different manufacturers, they can be as much as x10.
Back in the day I don't remember them being so bad but I do rememeber keeping the control voltage 0.7 to 1V (can't rememeber exactly)  from below supply rail and above ground ground.  Maybe that helps make the range more consistent.

FYI, one of the manufacturers had a graph of control voltage vs freq.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Mr. Lime

So much input, I really appreciate that.

Too bad things aren't always that simple.
All this discussions about different waveshapes, resolution and frequencies got me thinking about Druid's VCDO.

It has a wide range, different wave shape outputs and a bit crusher section which I think is doing the resolution part..
If we take a guitar signal, form it into a gate and go into a 4046 PLL, the frequency of the VCDO oscillator can be determined by the guitar played note, right?


Maybe that's even more interesting sounding.
Thanks for help

anotherjim

I think the CD4046 is a bit crippled by using very weak MOSFET channels. Minimum Ron is relatively high and upsets the switching speed especially in the timing capacitor control and range of the control circuit. The different performance between brands of 4046 might be explained by differences in MOSFET geometry?

I've been having a go at bypassing some critical parts of the VCO.

Pin 9, 11 control MOSFET disabled by connecting both pins to 0v.
Frequency control by current sink out of pin12 only. This pin is usually left disconnected in most control schemes. To get a fine enough control, I'm using a Darlington PNP pair (x2 2N3906) controlled by a 10k trim pot across the supply, but this is obviously too crude other than for testing.

Internal N-channels used to discharge timing cap pins 6,7 assisted by NPN (2N3904) transistors controlled by the square wave from pin 4 and an inverted output from pin2 using the XOR phase comp. This speeds up the cap discharge helping the ramp wave on the timing cap maintain shape and amplitude and help match the pins6,7 waves if wanted to form saw/triangle waves. Without assistance, the internal arrangement clearly fails to completely discharge the cap at high frequencies.

Using 2 timing caps. One each of same value from pins 6 and 7 to 0v. This stops the negative-going pulse in the chip when the caps are discharging and again improves the ramp wave shape. The caps should be a good match for 50% duty cycle, although they can be different.

Schematic, and probably its own thread, when I'm done.
Yes, once again, I'm trying to polish a turd ;)



Mr. Lime

#36
Finding no peace of mind..  ;D

Taking a closer look at the Sonic Reducer circuit, there's a simple oscillator that's set up different as the common used LFO.
I saw this oscillator circuit was used to have triangle and squarewave outputs.

Details can be found here: https://synthnerd.wordpress.com/2018/12/31/synth-diy-the-relaxation-lfo/

I marked the section of the Sonic Reducer in red.
Any other problems to consider, if we take the unused inverter and buffer the triangle output?
(the 4066 switch has to be replaced by a transistor)


Thanks for help

Rob Strand

QuoteFinding no peace of mind.
The requirement of variable freq + variable duty + triangle makes life more difficult. 

You have to separate duty from frequency.   The case were the frequency is done using a voltage control, or a divider like the CE2 + duty control example I mentioned above, are really the best avenues.    The CE2+duty control case has the right structure but isn't so great in practice. So that leaves some sort of VCO + duty.

If you have a solution where the triangle level varies with frequency you could add some sort of leveling circuit make the level correct.   The crudest version of that would be a dual-gang pot which adjusts the gain!
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Mr. Lime

QuoteThe requirement of variable freq + variable duty + triangle makes life more difficult.

Haha, as long these are my worst problems in life, I'm fine  ;D

QuoteYou have to separate duty from frequency.   The case were the frequency is done using a voltage control, or a divider like the CE2 + duty control example I mentioned above, are really the best avenues.    The CE2+duty control case has the right structure but isn't so great in practice. So that leaves some sort of VCO + duty.

I thought the duty cylce control and frequency control were somewhat seperated in the Sonic Reducer schematic I attached as second. I guess the range of the CE-2 oscillator is way too small to really fit the bill..
Thanks for help

Rob Strand

QuoteHaha, as long these are my worst problems in life, I'm fine
:icon_mrgreen:

QuoteI thought the duty cylce control and frequency control were somewhat seperated in the Sonic Reducer schematic I attached as second.

Maybe that's the shot.  It gets around the need to use a triangle output directly.  I like solutions like that since they remove one of the problem areas.   The Schmitt level gets pretty small when the rate pot is at 1M but if it works, it works!
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.