Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LM311 comparator input from Colpitts oscillator questions

NigthMoth

Member level 1
Member level 1
Joined
Aug 28, 2023
Messages
36
Helped
0
Reputation
0
Reaction score
6
Trophy points
8
Activity points
760
Hello all

I was studying how to use comparators, so decided to feed LM311P comparator with 10kHz sinusoidal waveform generated by Colpitts oscillator to confirm the comparator behaviour. But (as you've probably already guessed) LM311P didn't behave as I expected (and Colpitts oscillator as well).

Here is what I've done, and questions at the end of this post:

Colpitts oscillator design for10kHz ~5Vpp oscillations

Actually I don't know how to estimate Colpitts oscillations Vpp, so decided to set power supply as +5V

Transistor biasing:
- R1, R2, Rc, Re for voltage divider configuration bias selected so @Vcc = 5V, Ic~=1mA, Vce~=0.5*Vcc;
- Ce selected so X_Ce @10kHz < 0.1*Re => Ce > 0.34uF, 0.47uF is OK;
- Cin selected so X_Cin @10kHz < 0.1*(R1||R2) => Cin > 0.69uF, 10uF is OK;
- Cout selected so X_Cout @10kHz < 0.1*Rload and Rload will be at least 10xRc => Cout > 0.009uF, 47uF is OK;

Tank circuit
C = C1*C2/(C1+C2) ~= 0.025uF;
f = 1/[2*pi*sqrt(L1*C)] ~=10.1kHz;

I estimated Av for this confirguration as described here
r'e ~= 25mV/Ie = 25mV/1mA = 25 Ohm
Av ~= Rc/r'e = 1800Ohm/25Ohm = 72
Criterion for oscillations to start from as described here:
beta = C1/C2 = 0.082 and 1/beta = 12
72 >= 12 so Av >= 1/beta so it is ok for oscillations

and

According to Datasheet
- Vcc(min) = 3.5V - OK, my Vcc is 5V
- Vi(min) = Vcc- +0.5V = 0+0.5V= 0.5V - OK, expected Vin(min) is 1.43V, minimum of sin wave from Colpitts oscillator Setup 1
- Vi(max) = Vcc+ -1.5V = 5-1.5V= 3.5V - OK, expected Vin(max) is 2.76V, maximum of sin wave from Colpitts oscillator Setup 1
- Icc+(max) = 7.5mA - OK, R3 = 2.7kOhm to ensure supply current <7.5mA
(I have +5V and +18V power supply, I'm affraid to use +18V by mistake, so select 2.7k resistor)

Here is what I got:

Setup 1: Colpitts oscillator - OK, but frequency is not as I expected
Setup 1 circuit.png

Setup 1: Circuit diagram​
изображение_2024-01-04_233652245.png

Setup 1: Realisation​
Setup 1 Colpitts Test 1.jpg

Setup 1: Test​

Setup 2: Colpitts oscillator & LM311P (Emitter output) - OK, but output voltage less than expected
Setup 3 circuit.png

Setup 2: Circuit diagram​
изображение_2024-01-04_234121151.png

Setup 2: Realisation​
Setup 3 Colpitts and LM311 emitter Test 1.jpg

Setup 2: Test​

Setup 3: Colpitts oscillator & LM311P (Collector output) - Fail
Setup 4 circuit.png

Setup 3: Circuit diagram​
изображение_2024-01-04_234529749.png

Setup 3: Realisation​
Setup 4 Colpitts and LM311 collector Test 1.jpg

Setup 3: Test​

My questions:

1) Colpitts oscillator frequency question (Setup 1)

I was trying to setup 10kHz frequency for Colpitts oscillator
I checked values for C1,C2 and L1 in tank circuit with RLC meter and they almost as specified (within +/-5%)
But I got 13.69kHz instead of ~10kHz.
And i cant figure out why?

My first guess was that my Lchoke inductivity is too high, and, as I undersand, It appears in parallel with C1 in AC equivalent circuit,
so tank circuit becomes more complicated?
And, for example, if I substitute (L1||Lchoke) = 5mH into tank circuit equation i get 14kHz, almost as 13.69kHz measured with oscilloscope.

When I simulate this oscillator with Micro-Cap 12, I got ~11.7kHz
It is as close to 10kHz (expected) as to 13.69kHz (received), so I'm confused..

Also, if Lchoke < 10mH, there is no oscillations. I picked up 10mH value manually, not by calculation.


2) Question regarding "Emitter output" from LM311P (Setup 2)
Almost as I expected, but why amplitude of square wave is only +2.24V but not ~Vcc(+5V)?


3) Question egarding "Collector output" from LM311P (Setup 3)
Why there is no square wave from comparator's collector output regardless of Pot1 referrence voltage in my Setup 3?
It works rather like some kind of flip-flop: always LOW when Vref(IN-) <0.22V and always HIGH when Vref(IN-) >0.22V,
even if IN+ is a sinusoid oscillating from 1.86V to 3.86V.
 
Any luck yet? Try this.

1704906715659.png


This what I call a 2 diode active clamp high-Q Colpitts Oscillator.
Low amplitude, low sensitivity, low current, very stable. It uses forward Vf of CB junction and Vf of Vbe to generate about 1Vpp signal.
(not as stable as a MEMs or Crystal or tuning fork, but GEFGW.

The Vbe PN junction is one diode to amplify peak voltage then the collector saturates and reduces hFE with the other diode being Vcb forward biased. Since the circuit with 10k on the collector can only draw 0.5 mA peak, Vbe will always be slightly less than 600 mV which normally occurs around 1mA. (remember this) But if you reduced Rc from 10k to 1K, you must also maintain Rc/(Re) ratio and reduce Re from 270 to say 56 Ohms. This ignores rE so I won't add any complication but this fairly low since the negative feedback reduces Base impedance and emitter impedance is rE= Rb/hFE) while Rb is what I call the base input impedance. Similar to a Op Amp inverting input virtual null but with much lower gain.

Re-arranging your parts now looks like this tuned to 10.0 kHz Since Vce ~ Vbe (except for IR drop on coil DCR)

This will work with any transistor with Rc= 10k simply by adjusting Re for gain to start oscillating. Almost any hFE 20 to 200 Vcc = 1V to 12V.

This is because Vbe rising boosts the base current and Vce neat saturation cuts the current so the high Q parallel Colpitts Oscillator is now very clean and stable, but still dependent on Rc/Re and DCR.

The limiter is trivial now for both CE and CC outputs since the PNP inputs have guaranteed head room even at Vcc =3.3V This compared average DC with DC+AC to compare the zero-crossing. ( see previous post for Duty cycle error due to any Vio offset or signal asymmetry.)

1704909073042.png

my SIM design 10kHz

Next you can try 1 uH, reduce Re to 0 and see if you get 1MHz.

Adjust values with mouse wheel over part. Adjust Vcc and hFE sliders at will. Mouseover part to see measurements in BR corner.
 
Last edited:
Any luck yet?
I't looks like luck is not on my side with this project.
Thank you for guiding me through design process (including example of clear definition of project demands) amd for
explanation of inner schematic of LM311.
Now I'm understanding that main problem of this project is that I'm trying to use LM311 almost at it's lowest possible power supply levels, and
therefore, very narrow allowed window for Vin, and (together with all disadvantages of my breadboarding) it gives bad output.

I tried setups from your Reply #20 and #21:
- Indeed I got colpits sin wave output at almost 10kHz as required and sinwave Vpp and Vdc level as in your design.
- However comparator output is still not as expected (actually there is a little progress: 12mVpp square wave around 0.9Vdc level appears).

There is some pictures for history:
Trying "Reply #20" setup
Reply 20 schematic.png

Reply 20 BB.png
Reply 20 Real.jpg
Reply 20 Waveform.jpg
Reply 20 Square.jpg

Trying "Reply #21" setup
Reply 21 Schematic.png

Reply 21 BB.png
Reply 21 Real.jpg
Reply 21 Waveform.jpg
Reply 21 Square.jpg
 
Op amps may be able to drive an NPN (which requires definite positive bias current). However comparators which I've used are unable to drive NPN. For a while I was unaware that a comparator (conventional comparator) only sinks current. This means it either provides a path to ground or it is high impedance.

You have choices:

a) Give NPN an amount of positive bias via resistor from positive supply (thus turning On NPN). The comparator then grounds the bias and turns Off the NPN.

or b) Change to PNP. Include safety resistor in bias wire. The comparator pulls current from the PNP bias terminal, thus turning it On. When it changes state it goes high impedance, stopping the draw of bias current from PNP.
 
Last edited:
LM311 is OK with Vin max < Vcc-2 Use Vo colpitts = 1V avg then compare with >1.5Vpp ac
- diodes for compression. Collector output. Emitter to gnd.
- not optimal , but works http://tinyurl.com/ywjxkmyj

For 10 kHz its ok, but not much higher.

1705123970206.png

--- Updated ---

it even works with an LM741 used badly as a a comparator.

 
Last edited:
it even works with an LM741 used badly as a a comparator.
Hello
I confirm: LM741 works! I tried your setup as in Reply #24.
Also I tried LM339 instead of LM311 in my setup from reply #8, and it also works.
But LM311 still fails to produce square wave.
Now I'm believe that my LM311 chips are bad (there was some other strange behaviour with them - in some experiments it seemed like my LM311's emitrer output pin somehowinternally connected to it's input pins).
I ordered some LM311 chips from other vendor to try, hope it will help to close this problem finally.

There is some pictures showing replacing of LM311 with LM741 and LM339

Replacing of of LM311 with LM741 as comparator
15 sch.png

15_BB.png
15 Setup.jpg
15 test.jpg



Replacing of LM311 with LM339
14 sch.png

14_BB.png
14 Setup.jpg
14 Test.jpg
 
55% d.f or 10% error on square wave on 741 is due to input offset for V and I plus any signal asymmetry.

There is 15 mV tuning range only on offset V can reduce somewhat, but now there are better CMOS op amps which also work OK as comparators over 10 MHz which is better than the LM311. Then you may use high Z Vin+ for higher Q. on LC tank.

1705347247606.png

by adjusting DC bias you can null the d.f. error.

I think your error was using a differentiator AC coupled with 2.71 Vdc and 2.5V OpAmp Vref. from Vdc/2

1705347929916.png

1705347875772.png

So the integrator approach negates the DC error on duty factor V{R.in - R.lpf)
 
Last edited:
Buffer (IC1) input needs positive bias.

I think your error was using a differentiator AC coupled with 2.71 Vdc and 2.5V OpAmp Vref. from Vdc/2

Hello, I have a question regarding necessity of input buffer biasing because of which I used this 2.5V OpAmp Vref. from Vdc/2
(i replaced not biased input buffer with positive biased 1x gain inverting op-amp in my circuits).

I found this application report for LM358 op-amp, and in Table 2 I found this:
изображение_2024-01-19_001624833.png


Am I correct in understanding that for LM358 Op Amp I used there is no need to provide positive bias to make unity gain buffer?
(or maybe reading this report i misunderstood context where data from Table 2 appliable?)
Or according to your expirience, even if Op Amp specification does not demand positive bias it is better to have it?
 
Last edited:
Hello, I have a question regarding necessity of input buffer biasing because of which I used this 2.5V OpAmp Vref. from Vdc/2
(i replaced not biased input buffer with positive biased 1x gain inverting op-amp in my circuits).

I found this application report for LM358 op-amp, and in Table 2 I found this:
View attachment 188016

Am I correct in understanding that for LM358 Op Amp I used there is no need to provide positive bias to make unity gain buffer?
(or maybe reading this report i misunderstood context where data from Table 2 appliable?)
Or according to your expirience, even if Op Amp specification does not demand positive bias it is better to have it?
This assumes Vs/2 bias. so it must have bias meaning above Vee. = -ve supply = 0V on single supply applications.
i.e. if Vs = 5V use 2.5V for Vin+ for reference bias
or use Vref= Vin-= 1.5V if using Vin+ with signal on 5V single supply use.

The LM358 datasheet says its good with 2V of "headroom" to V+ ( some comparators and Op Amps need more )

But 2.5V bias on 0 to 5V is OK using the inverting input.

If using the non-inverting input then you must allow room for both inputs to swing < V+ -2V so bias for the gain Rin to say 1.5V gives you a Vin+ input swing from 0 to 3V.

1705621952279.png


Bottom line
- always check Vcm in datasheet
- Consider using Rail to Rail input and output (R2R IO) with some CMOS types..
 
Hi,

Side note: Maybe off topic, but may help to find suitable OPAMPs.

I find the terminology of "single supply OPAMP" and "split supply OPAMP" misleading, because (as long as the OPAMP has no dedicated GND pin) every OPAMP can be operated with single supply as well as split supply.

Example:
Wheter an OPAMP is operated with -15V, +15V supplies and a common mode voltage of 0V ... is exactly the same as
an OPAMP operated with 0V, 30V and 15V common mode voltage.
or an OPAMP operatied with -30V, GND and CMV of -15V.
The Opamp can´t determine the difference.
In either case the output voltages will be within the rails.

Indeed it´s not the OPAMP, but the application that determines the power supplies and the signal voltage levels (input, output).

There are OPAMPs designed to be operated on low voltage (like 5V) or battery operated. These often are named as "single supply OPAMPs".
But every single one of them could be operated on split supplies.

So don´t be stressed by this terminology.

Klaus
 
That's a good point @KlausST . In fact, all Op Amps (OA) have no ground reference although comparators usually do for a logic output.

Some OA's and comparators have PNP inputs which enable the inputs to use 0V reference while NPN differential inputs cannot.
Then Instrument Amps (BJT types) cannot approach either rail and must be biased to V+/2

So bottom line is always meet the criteria for Vcm range and CMRR of inputs in the datasheets.
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top