Go Down

Topic: Comparator circuit help (Read 121 times) previous topic - next topic

Mark248

I am using LM339 quad comparator to compare two signals but it is not giving its output as it is suppose to be.

i am using voltage divider circuit to out 6v on + terminal of comparator and 3v to the - terminal of the comparator.

as it can be seen in the diagram too but instead of variable resistor i am using a fixed voltage out by voltage divider circuit.

what wrong am i doing which is not helping me achieve what i want to which is the comparator output to be high when + terminal voltage is higher then the - terminal.


MarkT

The input voltages must be between 0V and 4.5V if the chip is powered with 6V.  The input range goes from
the negative supply rail to 1.5V less than the positive supply rail.

It is not a rail-to-rail device.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

bastjan

I believe because your LEDs are in sinking mode,they need to be sourced from the comparator to work that way

Mark248

The input voltages must be between 0V and 4.5V if the chip is powered with 6V.  The input range goes from
the negative supply rail to 1.5V less than the positive supply rail.

It is not a rail-to-rail device.


This is the circuit, i am using 48V on the input but then using voltage divider too,
ignore the other blank resistors as i have to make 2 other circuits to compare too, but as you can see comparator is not showing anything

MarkT

I believe because your LEDs are in sinking mode,they need to be sourced from the comparator to work that way
Completely incorrect.  The LM339 cannot source any current at all.  It also cannot sink much current without a volt or so of headroom, so the green LED might not light very bright.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

MarkT



This is the circuit, i am using 48V on the input but then using voltage divider too,
ignore the other blank resistors as i have to make 2 other circuits to compare too, but as you can see comparator is not showing anything
They make sure the output of the divider is at least 1.5V below the LM339 supply voltage at all times.

You have forgotten the pull-up resistor to 5V on the output.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Mark248

They make sure the output of the divider is at least 1.5V below the LM339 supply voltage at all times.

You have forgotten the pull-up resistor to 5V on the output.
a pull-up is a must for every output ?
what do you mean by the output of the divider is below 1.5v?

wvmarle

a pull-up is a must for every output ?
If you use that output as an input for another device, yes. Not for your LEDs.

Quote
what do you mean by the output of the divider is below 1.5v?
Do read the rest of the sentence as well. Especially the "the LM339 supply voltage" part.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Mark248

If you use that output as an input for another device, yes. Not for your LEDs.

does that mean that it can essentially only output ground? and if you want it to provide HIGH voltage 5v etc then you always have to provide it with pull up resistor?

WattsThat

does that mean that it can essentially only output ground? and if you want it to provide HIGH voltage 5v etc then you always have to provide it with pull up resistor?
The output stage of the LM339 is an open collector transistor so it can only sink current, not source. Any situation where you need voltage to drive an input, based upon the output from the LM339, you must fit a pull-up resistor to provide the voltage.

Ten seconds reviewing the LM339 datasheet very clearly shows this fundamental information about the part.
Vacuum tube guy in a solid state world

MarkT

Nearly all comparators are like this, it means the comparator can be powered at 30V and yet talk to 5V or 3.3V logic without any problem.  Comparators are always interfacing between analog and digital so this is the commonest use-case.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

raschemmel

#11
Jul 15, 2019, 11:16 pm Last Edit: Today at 12:21 am by raschemmel
Quote
Ten seconds reviewing the LM339 datasheet very clearly shows this fundamental information about the part.
It's amazing how many people can't spare 10 seconds....



Based on your questions it appears you do not realize that your leds would only light if the Comparator
output was zero volts (NOT 5V) , which brings us to Marks comment that it cannot sink very much current.
It would be better to use a pullup resistor to get a 5V output to drive a transistor or mosfet.
LM139 SCHEMATIC
Also, it is not clear whether or not you understand how a comparator works.
Please post an simple explanation of the operation of a comparator so we can find out if your on the same
page:

Op Amp Equivilent: Vout=AOL*[(V+)āˆ’(Vāˆ’)]


Fill in the blanks

if V+>Vāˆ’ then Vout=___

if Vāˆ’>V+ then Vout=___


Also, your schematic is hard to follow .
Can you just post the V+ and V- input values for all four comparators and name the comparators after
their respective led color ?

ie:
Fill in the blanks:

RED
-----
V+ = ______Vdc
V- =  ______Vdc

YELLOW
---------
V+ = ______Vdc
V- =  ______Vdc

GREEN
--------
V+ = ______Vdc
V- =  ______Vdc

ORANGE
----------
V+ = ______Vdc
V- =  ______Vdc



Here's an example of how to use a comparator to drive a led:
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up