Comparator help ... what am I doing wrong?

Status
Not open for further replies.

Thread Starter

gte

Joined Sep 18, 2009
357
I can't figure out why my comparator is not working, so that probably means I'm doing something wrong :D . In the most simplistic of comparator circuits, I thought I could give my LM2903 a

VCC = 13.75vDC
VEE = battery -
inverting pin 1 = 6.92vDC
non inverting pin 1 = switched 13.75vDC

When I switch the non inverting pin to +13.75vDC, output pin 1 does not swing to near VCC, it stays at near VEE (around 0.5vDC) . What am I doing wrong? I read through this thread http://forum.allaboutcircuits.com/showthread.php?t=6760 and from reading that I'm doing things correctly? Any ideas?

Thanks for reading!

My circuit.




(This is what I have for the LM2903 pinout)

 

Attachments

beenthere

Joined Apr 20, 2004
15,819
When you look at the IC - http://www.national.com/mpf/LM/LM2903.html#Overview - you will notice a pullup resistor on the output pin. That means the output is open collector, and has to have some external voltage applied through a resistor to let the output swing positive.

Get the data sheet for more information. As good practice, it is necessary to tie the unused input pins high or low to prevent device oscillation.
 

Thread Starter

gte

Joined Sep 18, 2009
357
Thanks beenthere!

Does it have to be at VCC, or could it be a few volts (say 3)? If it's at VCC, how do I actually know the comparator is working when the non inverting is higher than the inverting? As the output is high with the pull up resistor connected whether the non inverting works or not?

It kind of defeats the purpose of using this comparator if I have to have a pull up or pull down resistor.




When you look at the IC - http://www.national.com/mpf/LM/LM2903.html#Overview - you will notice a pullup resistor on the output pin. That means the output is open collector, and has to have some external voltage applied through a resistor to let the output swing positive.

Get the data sheet for more information. As good practice, it is necessary to tie the unused input pins high or low to prevent device oscillation.
 

SgtWookie

Joined Jul 17, 2007
22,230
Why does it defeat the purpose of using a comparator?

Comparators are great. They are far faster than most opamps. If you need more current than they can source or sink, you can use a transistor to amplify their current.

Inexpensive opamps are relatively slow, and have a relatively limited input range.
 

Thread Starter

gte

Joined Sep 18, 2009
357
I just want something that outputs a 1 or a 0, having the pullup (when testing) means that it's basically at 1 all of the time as a default, and goes to a 0 under certain circumstances.

To be more clear, it may not make a difference in my application (the circuit we've been working on) but it makes it confusing for testing and learning.




Why does it defeat the purpose of using a comparator?

Comparators are great. They are far faster than most opamps. If you need more current than they can source or sink, you can use a transistor to amplify their current.

Inexpensive opamps are relatively slow, and have a relatively limited input range.
 

Thread Starter

gte

Joined Sep 18, 2009
357
I tried to change the circuit a little, so that when 1in- eclipse 1in+ (which is a reference), it inverts and goes to VEE.

My test LED which is connected to Vout and ground/battery - is always on no matter the state of the comparator, because of that 3k pull up that is required?


 

Attachments

hspalm

Joined Feb 17, 2010
201
I just want something that outputs a 1 or a 0, having the pullup (when testing) means that it's basically at 1 all of the time as a default, and goes to a 0 under certain circumstances.
Well, isn't this what you wanted initially? Without the pullup the readouts would be the same. If it had worked without one, that is.
 

hgmjr

Joined Jan 28, 2005
9,027
As others have stated, you must use a pullup on the output to be able to operate the comparator properly.

hgmjr
 

Thread Starter

gte

Joined Sep 18, 2009
357
Ok, resistor on the output it is :)

Is the manufacturer recommended 3k value something I can deviate from and if so, how far?
 

hgmjr

Joined Jan 28, 2005
9,027
Ok, resistor on the output it is :)

Is the manufacturer recommended 3k value something I can deviate from and if so, how far?
The Fairchild datasheet indicates that the output can sink a minimum of 6 milliamps with a typical value of 18 milliamps.

The value you use depends on the voltage you intend to connect the pullup resistor to.

For example, if you connect your pullup resistor to 5 volts then you could use a 250 ohm resistor. A 1K resistor would be a reasonable nomimal value.

Be sure to consider what you are connecting the output of the comparator to since if it is a resistor to ground, it could influence the maximum voltage to which the output would go.

hgmjr
 

Thread Starter

gte

Joined Sep 18, 2009
357
Hi hgmjr,

Thanks for the reply.

I'm hooking it up to an ecu that reads the high or low as a sensor, and most likely it is fed into a microchip which doesn't use much amperage at all. I guess I will limit current as much as possible to protect the ecu with a 2k resistor. The voltage is in between 12 and 14 volts so that should put me at between 6 and 7 milliamps.
 

hgmjr

Joined Jan 28, 2005
9,027
Hi hgmjr,

Thanks for the reply.

I'm hooking it up to an ecu that reads the high or low as a sensor, and most likely it is fed into a microchip which doesn't use much amperage at all. I guess I will limit current as much as possible to protect the ecu with a 2k resistor. The voltage is in between 12 and 14 volts so that should put me at between 6 and 7 milliamps.
2K is a reasonable value for the pullup connected to 14V.

hgmjr
 

Thread Starter

gte

Joined Sep 18, 2009
357
Ok thanks.

A comparator may not work for me then, as I need it to be at Vcc (13vDC) or Vee (DC ground) and with the output being tied to a resistor/Vcc it does not do that.

What are my other options?
 

kubeek

Joined Sep 20, 2005
5,793
Ok thanks.

A comparator may not work for me then, as I need it to be at Vcc (13vDC) or Vee (DC ground) and with the output being tied to a resistor/Vcc it does not do that.

What are my other options?
Your ONLY option is the pullup resistor tied to Vcc, which allows the comparator to do EXACTLY THAT.

Have you even read the <snip> datasheet? Or are you just randomly connecting parts and looking for the best colour of magic smoke?
 
Last edited by a moderator:

SgtWookie

Joined Jul 17, 2007
22,230
Give gte a break. He's really new at this.

Maybe it would be better to just continue in the other thread that was started months back:
http://forum.allaboutcircuits.com/showthread.php?t=32341

Anyway, you can get all the background you'd like in that thread. I came up with a proposed solution using an LM2903 dual comparator and associated components a few months back, but he's having some minor trouble with it.

We're working on figuring out what his current sink requirement is. I figure (just a SWAG) that it'll probably need to be somewhere in the 100mA to 200mA range. He's going to measure it in the next day or so. From there, it's just a matter of adding a suitable transistor stage on the output to handle that current.
 

Thread Starter

gte

Joined Sep 18, 2009
357
As Sgt said, I'm a newb and trying to learn, but not by trial and smoke if I can help it :)

I thought this was going to be a bit of a different topic about comparators in general, but he is correct it is ending up in the same direction of my long standing thread where he has been super patient in helping me.

If I'm back in Orlando this year or anytime soon, I'll be buying the Sgt multiple beers, cokes, milkshakes or whatever his preferred beverage is!

I'll post in the other thread from now on, thanks to all that helped and answered questions in this thread.




Your ONLY option is the pullup resistor tied to Vcc, which allows the comparator to do EXACTLY THAT.

Have you even read the <snip> datasheet? Or are you just randomly connecting parts and looking for the best colour of magic smoke?
 
Status
Not open for further replies.
Top