Comparator help ... what am I doing wrong?

Discussion in 'General Electronics Chat' started by gte, May 30, 2010.

Thread Status:
Not open for further replies.
  1. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    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.

    [​IMG]


    (This is what I have for the LM2903 pinout)

    [​IMG]
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    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.
     
  3. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    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.




     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
  5. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    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.




     
  6. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    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?


    [​IMG]
     
  7. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    ...........
     
  8. hspalm

    Active Member

    Feb 17, 2010
    201
    8
    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.
     
  9. hgmjr

    Moderator

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

    hgmjr
     
  10. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Ok, resistor on the output it is :)

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

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
  12. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    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.
     
  13. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    2K is a reasonable value for the pullup connected to 14V.

    hgmjr
     
  14. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Can I put the 2k or 3k resistor to dc ground as a pull down resistor?
     
  15. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    No. You definitely need to put the resistor from the output to the positive power source.

    hgmjr
     
  16. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    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?
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Why don't you just use the circuit I posted over a month ago to solve your problem?
     
  18. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    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: Jun 1, 2010
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
  20. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    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.




     
Loading...
Thread Status:
Not open for further replies.