Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

comparator basics

Status
Not open for further replies.

kdg007

New Member
Hi,
I know that comparator will give oV output if both the inputs are same.What if the currents are different? imagine i kept 100k to inverting terminal and 1k to non-inverting terminal.What will the effect on output ????

lets take lm339 for example.

i`m trying to understand the basics so that i can built my own circuit soon :) hopefully someone could help me out

thank you.
 
This will keep you busy. You will find a wealth of information in that little link. :)

Read the link and return with questions.

Ron
 
Last edited:
thank you for the link :) its great... before asking my questions,i would like to clear off one basic question.
some of the pictures in the link ,LM339- comparators are given +v to 0v but some of them are given +v to -v ..... is 0v and -v are the same? where is the ground terminal ?
 
1)According to the datasheet,LM339 is safe work upto 50mA of current.so i can keep any resistances i want as long as the current is with in the limit(less than 50ma)? am i write?All i ahve to do is concentrate on the Voltages of the inputs of COMPARATOR.
am i right ?
 
Last edited:
OK if we look at the LM339 family as covered in this data sheet we see a few interesting things.

These were designed specifically to operate from a single power supply over a wide range of voltages. Operation from split power supplies is also possible and the low power supply current drain is independent of the magnitude of the power supply voltage.

Then we also see this:

Wide supply voltage range
LM139/139A Series 2 to 36 VDC or ±1 to ±18 VDC
LM2901: 2 to 36 VDC or ±1 to ±18 VDC
LM3302: 2 to 28 VDC or ±1 to ±14 VDC

What that tells us the comparator can operate from what we call a single ended power supply as in 0 and 15 volts or for example a dual supply of -15 / 0 / 15 volts. For starters and an introduction to comparator circuits I suggest you download and save the data sheets for the comparators in the initial link. Then start with basic circuits using a single ended supply like a simple 12 volt power supply. Ground is 0 volts or the negative supply voltage depending on if a single or dual supply is used.

Hope that helps...
Ron
 
1)According to the datasheet,LM339 is safe work upto 50mA of current.so i can keep any resistances i want as long as the current is with in the limit(less than 50ma)? am i write?All i ahve to do is concentrate on the Voltages of the inputs of COMPARATOR.
am i right ?

No, not the way it is. This is where you need to begin working on understanding the data sheet(s) on all components. That 50 mA you are seeing is under Input Current as in note 3.

Note 3: This input current will only exist when the voltage at any of the input leads is driven negative. It is due to the collector-base junction of the input PNP
transistors becoming forward biased and thereby acting as input diode clamps. In addition to this diode action, there is also lateral NPN parasitic transistor action
on the IC chip. This transistor action can cause the output voltages of the comparators to go to the V+ voltage level (or to ground for a large overdrive) for the time
duration that an input is driven negative. This is not destructive and normal output states will re-establish when the input voltage, which was negative, again returns
to a value greater than −0.3 VDC (at 25°)C.

Also note these comparators have what is called "Open Collector" outputs so you need to watch how you load them. They are not made to supply large output currents. If I want to drive a relay coil for example I would likely have a pullup resistor on the output and let it drave a small switching transistor that in turn drives a relay coil.

Ron
 
1)When u say driven negative? u mean supply of -ve voltage to one of the input terminal ?
2)I have downloaded the data sheet ,so it says under electrical characteristics SUPPLY CURRENT 0.8mAdc typ and 2.0 mAdc - is this the proper current we should maintain for the safety of the comparator ?
3)NPN TRANSISTOR ACTION : I might need more understanding in this :
for example if i have grounded the inverting terminal and gave a signal to the non-inverting terminal.Can you please explain me with this picture :)
View attachment 61333

Thank you for helping me :)
 
the picture might have technical errors,please correct me if i made any mistakes.i am willing to learn
 
the picture might have technical errors,please correct me if i made any mistakes.i am willing to learn

Not bad for a start. Attached is a screen shot of your circuit with a few modifications. I used a dual supply as you did, I also am using a 10KHz sine in. You should be able to figure it out. :)

Here in Cleveland Ohio USA it is about time I ate and caught some sleep as I get up for work about 3:30 AM.

Ron
 
wow...think i need to learn pspice more :O ur circuit is a lot different from mine :D and also i am still learning how to see a sign wave and give a proper signal in pspice .....
 
I want to understand the electrical characteristics first before i go into the circuit :
SO coming back to the electrical characteristics of LM339 :
1) input offfset voltage = 2.0mVdc(typ) or 5.0mVdc(Max) : there are lot of explanation i found( i`m a newbie so please be patience)...what i understood is... even if the voltages are almost same on both the input terminals, there will be a voltage difference of 2.0mVdc. am i right ?

2)Input bias current = 25nAdc/250nAdc : This is the current which present even when the voltages are not applied for input terminal of COMPARATOR.The value shouldnt be effected in most cases but it will effect in some cases.if we are driving the currents in nAdc-> that might effect because it is equal to the input bias current ?

3)input offset current = 5.0nAdc/50nAdc : even the currents are almost equal in the bot the input terminals,there will be a small difference,and that difference is input offset current.

4)input common-mode voltage range : :( cant understand it

5) voltage gain : its the singal gain ,input signal multiplied by the gain = output singal

6)large singal response : 300ns : the speed response for the large signals

7) response time : :( what is the difference between point 6 and 7 ?

8) output sink current : the output of lm339 can only sink upto 6ma to 16 ma, so we have to make sure to keep a resistor at the output so that it wont go more than this limit?

9)saturation voltage : the voltage need for comparator to start working.

10)o/p leakage current : even though the comparator is in off stage,there will be a small leakage current.


phewwww... hope my understanding is right :D
thank you
 
Last edited:
1. Pretty much correct. Input offset voltage (Vos) is the differential DC voltage required between the inputs of an amplifier, especially an operational amplifier, to make the output zero (0 volts with respect to ground, or between differential outputs if they exist, for voltage amplifiers). So what they are saying is if we want 0 volts out for example that two inputs of 0 volts may not do that. The inputs, however are allowed to be within 2 mV in this case. Really high end operational amplifiers have much smaller numbers that reflect in their cost.

2. Correct. One of the golden rules of op amp analysis says this: no current flows into either input terminal. This concept is key for analyzing an amplifier's signal gain. However, in reality, a small current flows into both inputs to bias the input transistors. Unfortunately, this bias current gets converted into a voltage by the circuit's local resistors and amplified right along with the signal. The result is an output error in your circuit. What can you do about it? A clever choice of resistor values can help you cancel most of the output error. The remaining error can be adjusted to zero if necessary.

The above taken from this link and there is more.

3. Correct. Input current (and input offset current) will affect the offset voltage unless low impedance signal sources are used. Typically we want the source impedance to be low with respect to the input impedance.

4. The input common mode voltage is defined as ViCM=( V(+) + V(-) )/2. The input common
mode voltage range (ICMVR) is defined as the range of input common mode voltage. Nice way of saying the maximum voltage difference between the (+) and (-) inputs. This should help.

5. Correct. Just remember within limits. Also note the LM 339 when they spec the voltage gain they also specify that Vl (The Load Resistance) must be greater than 15KΩ.

Note: Keep in mind at this point the LM339 Comparator is an operational amplifier designed with comparator in mind. Thus a constant reference to Operational Amplifiers. The old and ancient LM741 can be used as a comparator. It makes a lousy one and there are much better op amps designed as comparators but long ago that op amp was used as a comparator. You choose parts based on what you need the circuit to do. :)

6 & 7. This is where "slew Rate" figures into things. Additionally the upper frequency response of the op amp. You may want to give this a read. and you can discount some of the more advanced math.

8. Correct. The LM339 family use what is called an open collector output so think tiny transistor in the case. That output transistor can only handle so much current so we need to design and work within that current range and we never want to design depending on maximum values.

9 & 10. Correct.

There are forum members much better at explaining all this than I am. I am far from a young enterprising engineer. My first schooling in electronics was vacuum tubes. :) Unfortunately over the years my area has become very specialized leaving little time to learn other areas and forgetting quite a bit. Given a few years I'll retire. Maybe then as I keep electronics as a hobby I can play catch up? :)

Ron
 
An LM393 is a dual comparator. Each comparator in it are the same as the comparators in an LM339 quad comparator.
The LM393 has 8 pins.

They are low power comparators so their minimum output current is only 6mA when the saturation voltage loss can be as high as 1.5V.
Then you should not use a 1k load and a 10V supply.
 
wow,thank you for the breif explanation :)
http://www.ecircuitcenter.com/Circuits/op_ibias/op_ibias.htm

1)offset voltage : So, If i take a lm339 and kept 1v to the pin 6(inverting terminal)and 1v to pin 7 (non -inverting terminal,i wont get a 0voltage at the output pin 1.I have to maintain the difference 2mVdc.i.e pin 6 = 1v and pin 7 = 1-2mv = 0.998v => then i will get a output of 0v ?
-

-
2)input bias current : 25nAdc for lm339 at VCC = 5v. what is the minimum value of the resistors i should take for both pin 6 and 7 ? if i take R1 & R2=1k ; R3=0.5K ,will that effect ?
From the condition = R3=R1//R2
R1 and R2 = 1k and R3 = 0.5 k. -> will that be cancelling the bias currents ?
-
-
3)Common-mode-voltage range = (V(+)+V(-))/2 = (1+0.998)/2 = 0.999V

-
-
4) how much is the voltage gain ? since it shows in the data sheet of 10kohms for load ,i will keep 10k at the output.but can i keep 2k ? since it cant take upto 6ma at the output.

Finally, will i circuit work properly according to this calculations ? please let me know,if i am missing anything.
 
Last edited:
1)offset voltage : So, If i take a lm339 and kept 1v to the pin 6(inverting terminal)and 1v to pin 7 (non -inverting terminal,i wont get a 0voltage at the output pin 1.I have to maintain the difference 2mVdc.i.e pin 6 = 1v and pin 7 = 1-2mv = 0.998v => then i will get a output of 0v ?
No.
When both inputs have exactly the same voltage, the comparator amplifies its input offset voltage by its voltage gain which is very high.
Its input offset voltage can be negative 5mV, nothing, positive 5mV or anywhere in between. Therefore the output can be open or at 0V.
To make the output go to 0V then the (-) input must be more positive than the (+) input plus the offset voltage.

2)input bias current : 25nAdc for lm339 at VCC = 5v. what is the minimum value of the resistors i should take for both pin 6 and 7 ? if i take R1 & R2=1k ; R3=0.5K ,will that effect ?
From the condition = R3=R1//R2
R1 and R2 = 1k and R3 = 0.5 k. -> will that be cancelling the bias currents ?
No.
The "typical" input bias current is 25nA but you cannot buy a typical one. You get whatever they have which might have the max input bias current of 250nA as shown on the datasheet.
If both resistors are the same value then the input offset current (plus the input offset voltage) will determine what the output will do.
use Ohm's Law to calculate how much input offset voltage will ghe made and its polarity if the input resistors have different values.

3)Common-mode-voltage range = (V(+)+V(-))/2 = (1+0.998)/2 = 0.999V
I do not know what your numbers mean.
The input common-mode voltage range is from 0V to the supply voltage minus 1.5V. That is the range that the inputs work normally.

4) how much is the voltage gain ? since it shows in the data sheet of 10kohms for load ,i will keep 10k at the output. but can i keep 2k ? since it cant take upto 6ma at the output.
The datasheet says the voltage gain is from 50 thousand to 200 thousand when the load is 15k or more. It has limits for the supply voltage and the output voltage swing. It does not say how much the voltage gain is reduced when the load resistance is less than 15k but I think your load of 2k will allow the gain to be fairly high, maybe from 6.7 thousand to 27 thousand.
 
LM339:


1) hmmmm...can u tell me an value example... if i am giving 1v to the non-inverting terminal,how much i should give the inverting terminal to make the output zero ?
-
2)Common-mode-voltage range : so i can give voltage ranges between 0v to -1.5v to the both input terminal to work properly .so i cant give more than 0v ?
 
Last edited:
1) hmmmm...can u tell me an value example... if i am giving 1v to the non-inverting terminal,how much i should give the inverting terminal to make the output zero ?
0.995V or less. 0.98V or less will ensure that noise pickup by the input will not affect the output.

2)Common-mode-voltage range : so i can give voltage ranges between 0v to -1.5v to the both input terminal to work properly .so i cant give more than 0v ?
No. You cannot read properly.
The allowed common-mode input voltage range is from 0V to THE POSITIVE SUPPLY VOLTAGE MINUS 1.5V. So if the supply is only 5V then the inputs work from 0V to +3.5V. If the inputs are negative then the IC will blow up.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top