# OpAmp/comparator using voltage?

#### Emil Skovgaard

Joined Jun 6, 2015
37
Hi,

I'm testing a OpAmp with a comparator to show that when my Vin gets a higher voltage than Vref it will let my Vcc+ pass through to my Vout. I'm using a LED LG2640, and the minimum voltage for it to lit is 1.7V at 20mA. But when i set my Vcc+ to 1.7V it won't lit the LED. I need to turn my Vcc+ to 3.5V, and at that moment it lights up, and i can measure a voltage at 2.0V running through the LED.

But why do i need it to be 3.5V for letting 2.0V through? I'm using a LM324 OpAmp with a comparator - It seems like (from the data sheet) it can run from as low as 3V. But why do i need to turn it up to 3.5V for it to let 2.0V pass through?
Hope you understand!

Let me know if there is something that need explanation.

#### Attachments

• 413.1 KB Views: 7

#### DickCappels

Joined Aug 21, 2008
10,246
This is just a guess based on your written description but if you post a schematic diagram, that will help a lot.

Your LED requires 1.8 volts (if it is red) or more before it will light, so you need a power supply with a higher voltage than that.

If you are trying to drive the LED with an LM324, there is a single positive power supply and the LED cathode is grounded, you will need the positive power supply of the LM324 to be about 1.5 volts more than the LED voltage. 1.8V + 1.5V =3.3 volts; about what you found that you need.

#### Emil Skovgaard

Joined Jun 6, 2015
37
I'm not quite sure.. Why do i need the LM324 to be about 1.5 volts more than the LED voltage? Does the LM324 consume voltage?

#### DickCappels

Joined Aug 21, 2008
10,246
Below is the output stage of an LM324. The collectors of Q5 and Q6 are connected to the positive power supply.

In order to supply positive voltage to a grounded load, both Q5 and Q6 (a Darlington emitter follower) will have to conduct. In order for the both to conduct, there must be about 0.7 volts across the base and emitter of each transistor. In addition, the 100 uA current source will drop 100 millivolts or more. 0.7 + 0.7 + 0.1 =1.4 (or 1.5)

Also check the "Output Voltage Swing" specification on the datasheet.

#### Emil Skovgaard

Joined Jun 6, 2015
37
I have attached a picture of the circuit below.

The red wire is connected to Vcc+ and to ground. On the Vcc+ i have attached the 3.5 Volts
The blue wire is the Vin, which have to be higher than Vref to let Vcc+ pass through.
The yellow wire is Vref, which is set to 2.5 volts (doesn't matter, just a value)

The LED is the LG2460, and the OpAmp in the middle, LM324.

I'm having a little struggling understanding the above. I'm somewhat newbie on the field. I only having one LED which needs around 1.7V to activate. It's not like i'm having two LEDs so it needs more voltage, and there needs to run more volt in, and split. But does a OpAmp consume, or need volt to run?

I asked a professor, and mentioned that because the LED is connected to ground, therefore all the voltage the LED doesn't need would just go to ground. But in this case i'm letting 1.7V pass through from the comparator, it limits the voltage to around half. That i dont understand, because it's getting exactly what it needs.

Schematic is coming...

#### Attachments

• 375.9 KB Views: 8

#### OBW0549

Joined Mar 2, 2015
3,566
But does a OpAmp consume, or need volt to run?
In a word, yes.

As DickCappels explained, in order for the opamp to output a particular voltage (e.g., the voltage your LED needs to start glowing), its power supply voltage must be at least a volt and a half higher than that value or the output transistors won't have enough voltage across them to operate.

Your circuit is doing exactly what I would expect it to do.

#### Emil Skovgaard

Joined Jun 6, 2015
37
Ah okay, i get it now!

Is there any particularly reason why it must be 1.5 volt higher, or is that something i can find in the data sheet?

#### atferrari

Joined Jan 6, 2004
4,798
Ah okay, i get it now!

Is there any particularly reason why it must be 1.5 volt higher, or is that something i can find in the data sheet?
Querido Emilio,

That is exactly what Dick was explaining to you in his post. Re read (and re read again) his explanation until you understand.

#### OBW0549

Joined Mar 2, 2015
3,566
Is there any particularly reason why it must be 1.5 volt higher, or is that something i can find in the data sheet?
Dick Cappels gave a good explanation of the "why" (although you will need to learn a bit about how transistors operate in order to completely understand it), and as he pointed out, you can find this information from the datasheet under "Output Voltage Swing." Also, on the TI datasheet for the LM324, Figure 10, Output Characteristics Current Sourcing, shows the details of the relation between output current and the minimum required differential between V+ and Vout the opamp needs in order to source that amount of current. (NOTE: the 1.5V figure we've been using is only approximate; it varies from unit to unit depending on semiconductor characteristics and processing, and could be anything from roughly 1.1 volts up to 1.8 volts or even more.)

Generally, unless an opamp is identified as having a "rail-to-rail output," you can count on having to supply it with at least a couple of volts more than the maximum voltage you need it to put out. I no longer use LM324s for just that reason and prefer the LMC6482 instead as my "favorite jelly-bean opamp" because both its inputs and its outputs go all the way to the supply rails, making them a lot easier to use.

Last edited:

#### MikeML

Joined Oct 2, 2009
5,444
Since the LM324/LM358 opamps can drive their output pin very close to whatever voltage the Vss pin is tied to (usually 0V), then turn your circuit "upside down" and place the LED and its resistor between Vdd and the output pin such that the opamp sinks current instead of sourcing it...

#### Alec_t

Joined Sep 17, 2013
14,411
Whenever you are driving a LED, always have a current-limiting resistor in series with it; otherwise you risk frying the LED or its driver due to excess current flow. In your case you have been lucky because of the low voltage used.

#### PeterCoxSmith

Joined Feb 23, 2015
148
Ah okay, i get it now!

Is there any particularly reason why it must be 1.5 volt higher, or is that something i can find in the data sheet?
yes it is in the datasheet:-

#### Emil Skovgaard

Joined Jun 6, 2015
37
Thanks a lot to all of you for your fast and constructive replies. Gave me a really good understanding for what causes this. Im rather fresh in this field, sp bare in mind. And as my native ain't english it requires some understanding from my side

The purpose of the setup wasn't to incorporate it in some other circuit. It was just to show how the OpAmp with a comparator works, and thanks to you i have a better understanding now.

Wasn't sure for what to look for in the data sheet as there is a lot(!) of numbers and values i'm not all that familiar with, but hopefully it will come

#### wayneh

Joined Sep 9, 2010
17,505
There is such a thing as a rail-to-rail op-amp (I'm playing with the TLV272 at the moment). These can sense input voltages near the power rails, and can also produce outputs close to either rail. You don't need this capability to light an LED, but it's good to know such a thing is available.

You might contrast this to the very old 741 op-amp you see everywhere in old circuit diagrams. That op-amp cannot get close to either power rail, either at its inputs or its outputs. This trips up many beginners that have just learned about op-amps, since they tend to learn about ideal behavior but immediately are faced with reality, which is not the same!

Most op-amps are in between, and you need to look at the data sheet to know how close to either rail it can operate reliably.