voltage Comparator question(s)

Thread Starter

caluctra

Joined Oct 27, 2010
11
Hello all,

from a -12vdc to +12vdc voltage signal, I would like to be able to detect only the positive signal. example I want an LED to light up when there input signal is +.
would a comparator LM339 be suitable for this application?
there is only one input signal and It would need to be referenced with ground. instead of two different voltages .

question(s):
--> for the supply voltage on the comparator do i need to have vcc and vdd +5v (for example) and -5V? or just +5v to ground?
-->does it matter if the input signal (the signal i need to analyse) is greater than the supply voltage?
--> i read on the datasheet that each of the 4 open colector transistors sink up to 15 ma, could i just drive the LED + limiting resistor right from vcc, instead of using an outside transistor to drive it.
i have an 2n2222a in case i do need an outside transistor.
--> i read here on other posts that a pullup resistor is nedded,
--> i believe i read on the data sheet that voltages less than -0.3V should not be applied, is this only for differential between two different voltages or it is also for what i want to do?
--> in multisim i tried to simulate the circuit and it worked, when i supply a + signal i would see the LED on, the utput current was possitive, and viceversa with the - voltage the output current was negative and the transistor wouldnt turn on.The only thing I found weird was the fact that as i would increase the supply voltage more positive the output sinking current would go up up to .1A, and as expected when i soldered and tested the circuit, i messed up the LM339
I had the input voltage as my Vcc and Vdd was ground reference.


ANy help will be super apreciated.
 

thatoneguy

Joined Feb 19, 2009
6,359
1st: Never apply an input to a comparator that is higher than the supply voltage of the comparator. e.g. Don't put 12V on an input pin when the comparator is powered by 5V

2nd: A diode will cut off any negative voltages, leaving the positive voltages, which can then be checked against a level. This is a half wave rectifier in our e-book here.

A ~12k - ~8k Voltage divider between the +12V and ground would give the divided value less than the supply voltage of 5V, using the the midpoint of the resistors to be the comparator input.

Since the input will be going through a diode first, the negative voltages will be removed, so no need to worry about the -0.3 limitation.

The power supply for the 339 can be +5V and ground, once the input signal is verified to never go over 5V. A 5V Zener may be added to the voltage divider to protect the comparator in the event of an input spike.


--ETA: After re-reading all of it, the 12V + Diode could be used to light up the LED when +12V was available. LED's don't always have great reverse breakdown characteristics, hence the extra diode. So 12V - Diode - 800 Ohm Resistor - LED - Ground would be enough to light the LED w/current limiting when the voltage was +12V
 
Last edited:

Thread Starter

caluctra

Joined Oct 27, 2010
11
thanks for answering "thatoneguy"
I will attach a drawing of the circuit. I added the diode as you sugested
Iam setting the Vcc=12v and using a power supply iam applying a voltage from 1.0v to 10 (just to be safe and whitin the limits of the comparator)
when I apply the Vcc (step before applying the signal to compare (0-10v)) the output inmediatly starts sinking some current, enough to light the LED, (this is is the PS is off and up to 1.5v) after that the LED turns off, and there is not more current through Vo.
i know the problem is rather simple since the simplicity of the circuit, but i unfortunatly havent been able to make the LED from 0+ v to 10V.

Again, any help will be aprecuated.
 

Jaguarjoe

Joined Apr 7, 2010
767
The LM339's pull up resistor is way too high to turn the output transistor on.

For a normal 20ma LED and a 2N2222, Hfe = 10, Ic = 20ma, Ib = 2ma, Rpullup = (12v-.7v)/2ma = 6.2k, the nearest standard value.
 
Last edited:

Thread Starter

caluctra

Joined Oct 27, 2010
11
thanks again for the replays.

This circuitry Iam trying to design here is a second step of a test process.

Iam using an AD698SQ (Linear Variable Diferential Transformer (LVDT) signal conditioner) it will output a -10 to +10 Vdc in corrilation with position (in inch); -10 all the way retracted, +10 all the way extended.
Now comes the second part of the test procedure; I need to be able to distinguish between extention and retraction of the unit.

Scenaio#1 Vo(AD698SQ) = +value means signal ref (AD698SQ) = 0 potential.
so the LM339 will sink curent and turn the led on.
Scenario#2 Vo(AD698SQ) = -value sig ref (AD698SQ) will be at the higher potential l -value l but if I connect the Vin-(LM339) pin to ground is going to cause problems right?

shouldnt the Vin+ pin the only pin with the diode needed, will sig reference swing to -Voltage potencial?
please advice me.
Iam a bit confused, maybe Iam overanalysing the problem.

here i send a picture of the the circuit updated.

thanks one more time for the help.
 

Attachments

thatoneguy

Joined Feb 19, 2009
6,359
Will the reference signal ever be negative? If not, you only need to prevent a negative potential from entering the + input of the comparator.

The way it is drawn now, the - comparator input will be a diode drop above ground. The + input will be +Vin - Diode Drop (~0.6V)

My question was only from the image above where the - side of the battery (which could vary from -12V to +12V) was connected to GND, instead of the signal ground. Since you already have +/- 15V Supplies, why not give the comparator the same dual rail supply voltage? It would still only light up for positive voltages if the - input was held at 0V. The LM339 is rated for up to 36V supply voltage, or +/- 15V dual rail. If running the LM339 with the dual rail supply, you'd only need the diode on the + input to let only positive voltages going to it, which will also help that input be a little bit below the supply voltage.
 
Last edited:

Thread Starter

caluctra

Joined Oct 27, 2010
11
I just recieved the last components and put the circuit together, Iam also using dual supply like you adviced me, since the reference voltage will never be negative i did not use the diode, i also used two pnp transistors insted of the npn (as before) this being 2n2904 since looking at the sckematic of each comparator, the ground will be on the most negative potential, and i believe it will develop a negative current.
I used two lm339, one the first 1 i make ground reference and the output i put it on the negative of a second lm339 so that when one drains, the uther wont.
i was able to simulate it using multisim 11 and it worked fine, i even did DC operating point analisys. when i give power to the circuit both led light up, regardless if the comparing voltage of the is grater or less than reference, the open colector transistor is draning all the time.
here is place a pic with the circuit.

thanks.
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
Did you notice that the input transistors in the LM339 are PNP type?
Then without a resistor to ground at the input, the input will float up to nearly the positive supply voltage. And it will not work as a comparator.
 

Thread Starter

caluctra

Joined Oct 27, 2010
11
Audioguru, is this what you sugested?

question:
lets say (in this application) the voltage on the +leg of the 1rst comparator will never reach Vcc lets say it will go to +- 10v dc max, would i still need the resistor to ground?

Software vs real meassure?
On the software I see the output of the frst comparator swinging from roughly (Vcc-1.2) when +Vin > Vref and (Vdd+1 to Vdd) when +Vin < Vref. this observation I was able to measure it on the circuit with a meter. now what I see different is on the 2nd comparator, on the software it does pretty much the same as the output of the 1rst comparator, now on the circuit it gous from (Vdd+1 to Vdd+8) it never goes positive.
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
Audioguru, is this what you suggested?
No.
Before the (+) input of the comparator was connected to a reverse-biased diode that did absolutely nothing so the input floated high. Now you have a pot giving a firm voltage to the input so the resistor to ground is not needed.

Your two 1500 ohms resistors R3 and R4 have values so low that the resistors will be fairly hot. Increase them to 100k ohms each.

Your PNP transistors are connected upside down. Their collectors should connect to the negative supply.

Your negative battery V3 is shown backwards.
 

Thread Starter

caluctra

Joined Oct 27, 2010
11
thanks for the quick reply audio guru.

i put a pic with the given changes.
please advice me if you see any other change.

i was reading on other posts related to comparator about adding hysterisis to the comparator, but it is used if the voltage to compare changes very slow, and this will not be my case.
 

Attachments

Top