LM339 as Comparator: Help on Understanding

Thread Starter

DragonClawz

Joined Sep 19, 2018
3
Good day,
I have a project with the use of LM339 comparators to operate a seven segment display (flash adc and encoder) and I am having problems with understanding it specifically the comparator part.

I made a Voltage Divider Reference Source Comparator circuit as reference.
(See attached File)

comparator.PNG

As seen from the figure, the opamp operates on a 5V battery (Vcc=5V).
It has two analog signals (Vin = 5Vrms and Vref=3Vrms).
I read that no matter what input signal there is, as long as it compares either the positive or negative input as a higher amplitude, the output could be around +Vcc or -Vcc. But as seen from the simulation, the output is at 2.248uV at the 1ohm load. What is the reason for this? Did I miss something? Is my understanding only for ideal situations? But even if it isn't ideal, should the output voltage be that low? Thank you for listening and please tell me if you are confused, I will clarify as best as I can.


Moderators note : shown image full size
 
Last edited by a moderator:

dl324

Joined Mar 30, 2015
16,918
Welcome to AAC!
But as seen from the simulation, the output is at 2.248uV at the 1ohm load. What is the reason for this? Did I miss something?
You missed something. The answer is in the datasheet.

Since this is homework, can you post your instructions for this project? I was tempted to explain why you're getting the results you're seeing, but guidelines state we should only offer guidance for homework questions.
 

crutschow

Joined Mar 14, 2008
34,432
The LM339 has a open-collector output (see data sheet).
It requires a pull-up resistor to V1 (try 1kΩ).

You should not apply a negative voltage with respect to the minus supply (in this case ground) to the LM339's inputs, so each AC source must have a +DC offset equal to the peak of the AC voltage.
 

wayneh

Joined Sep 9, 2010
17,498
Good day,
I have a project with the use of LM339 comparators to operate a seven segment display (flash adc and encoder) and I am having problems with understanding it specifically the comparator part.

I made a Voltage Divider Reference Source Comparator circuit as reference.
(See attached File)

As seen from the figure, the opamp operates on a 5V battery (Vcc=5V).
It has two analog signals (Vin = 5Vrms and Vref=3Vrms).
I read that no matter what input signal there is, as long as it compares either the positive or negative input as a higher amplitude, the output could be around +Vcc or -Vcc. But as seen from the simulation, the output is at 2.248uV at the 1ohm load. What is the reason for this? Did I miss something? Is my understanding only for ideal situations? But even if it isn't ideal, should the output voltage be that low? Thank you for listening and please tell me if you are confused, I will clarify as best as I can.
The comparator cannot source current, only sink it. So you need a pull-up resistor on the output to get the high state voltage. I think the data sheet shows 3300 ohms. The sink current can be about 5mA, enough for an LED.
 

bertus

Joined Apr 5, 2008
22,277
Hello,

You will need a pull up resistor as the others told you.
When you look at the internal schematic, you will see why:

LM339_internal schematic.png

Also remove R3 as it will short the output.

Bertus
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
The datasheet for the LM339 says that the absolute maximum negative input voltage is -0.3V. It is because more voltage will forward bias the collector-base of the input transistor which will blow it up!
Your 5V RMS input has a +7.07V peak and a -7.07V peak. The 3V RMS at the other input will also blow the input transistor.

Your circuit tries to bias the (-) input of the comparator at half the supply voltage but the signal source V2 probably shorts the DC to 0V without a coupling capacitor. The (+) input is not biased and also might have its DC at 0V.
 

Thread Starter

DragonClawz

Joined Sep 19, 2018
3
Thank you so much for the responses!

My updated diagram shows a 3k pull-up resistor (as recommended by the datasheet), took out the 1 ohm, and updated Vrms of the non-inverting input to 3Vrms which is around 4.24V.
So I have other questions regarding this. I removed V2 because I just checked about Flash ADCs. V3 changes for that is the analog sensor.


Comparator_noinvanalog.PNG

I will explain much of my project before we go forward. So this comparator is to be connected to a cascaded 8-to-3-line priority encoder 74LS148, which will be connected to a 74LS08, which will be then connected to a seven segment driver 74LS47, then finally light up a seven segment display. I get confused at the comparator part first that's why I set up the thread. I made a veeery messy circuit simulation that doesn't work but for illustration sake, I will show you where I am currently in understanding this project.
(See Project.pdf)

For the connections of the cascaded 74LS148, I based it off the datasheet here:
Datasheet_Cascade.PNG
Again, thank you for answering the questions.
 

Attachments

Thread Starter

DragonClawz

Joined Sep 19, 2018
3
Oh no I forgot to say it and the schematic was wrong in the pdf it was supposed to be like this. I'm sorry I posted it so hastily that I forgot.
Project.PNG

My questions:
1) For the non-inverting input of the comparator, is it okay to go beyond 5 volts? The highest voltage we got from the analog sensor was 9V and it concerns me if it will destroy the comparator.
2) What best safety features should I put? In the datasheet, I saw some capacitors on the output however it lowers the output voltage.
 

dl324

Joined Mar 30, 2015
16,918
For the non-inverting input of the comparator, is it okay to go beyond 5 volts? The highest voltage we got from the analog sensor was 9V and it concerns me if it will destroy the comparator.
Most of what you need to know about the device is in the datasheet. Learn to read it.

The absolute maximum common mode input range is Vee-0.3V to Vcc. Vee is usually ground, but may be a negative voltage for split supply operation.
upload_2018-10-6_8-5-7.png
The device isn't guaranteed to survive being subjected to absolute max ratings.

The recommended range is Vee to Vcc-1.5V:
upload_2018-10-6_8-7-18.png
upload_2018-10-6_8-7-37.png
 

wayneh

Joined Sep 9, 2010
17,498
1) For the non-inverting input of the comparator, is it okay to go beyond 5 volts?
The voltage of both inputs should fall within the power rails of the comparator, plus a tiny amount detailed in the earlier posts.
The highest voltage we got from the analog sensor was 9V and it concerns me if it will destroy the comparator.
It would be best to divide that down, say cut it in half, so that it stays safely in range. Or you could cap it by using a 5V zener diode.
2) What best safety features should I put? In the datasheet, I saw some capacitors on the output however it lowers the output voltage.
I don't understand this question. Are you talking about the comparator?
 

Audioguru

Joined Dec 20, 2007
11,248
Don't you understand that the 3V RMS swings to +4.2V and to, -4.2V? The datasheet of the LM339 warns that its absolute max negative input voltage is only -0.3V so you will be blowing it up. if you add a coupling capacitor between the 1V signal and the voltage divider then the inverting input of the comparator will have a safe voltage swing. It must not be higher than 1.76V VMS.
The comparator has no hysteresis so it will probably oscillate at a high frequency when the input voltages are almost the same.

Do you understand that the output will not be a DC high or a DC low but instead will be a 2kHz rectangular waveform most of the time?
 
Top