Connect with us

LM393 Comparator

Discussion in 'General Electronics Discussion' started by Ben Parker, Sep 21, 2015.

  1. Ben Parker

    Ben Parker

    3
    0
    Sep 21, 2015
    Hi all,

    Im trying to use the LM393 Comparator chip. I am using 12vDC on Vcc. However when the circuit switches due to the change in voltages on INV- and INV+ it goes from 0v to 0.5v on the OUT pin? I thought i would get the Vcc voltage out? Is this correct or is there something wrong?

    Thanks
     
  2. Old Steve

    Old Steve

    734
    169
    Jul 23, 2015
    Do you have a pullup resistor from the output pin to +V? The LM393, and in fact most other comparators, has an 'open-collector' output.

    https://www.fairchildsemi.com/datasheets/LM/LM393.pdf

    Edit: See the schematic diagram in the datasheet linked above. Q8 is the output transistor.
     
  3. AnalogKid

    AnalogKid

    2,299
    647
    Jun 10, 2015
    The 393 has an open collector output, not a totem pole output. It can pull a load down (sink current), but not up (source current). If you look at the application circuits in the datasheet, you'll see that most of them have a pull up resistor from the output to Vcc. This resistor is path for any output source current needed.

    If you do need a true push-pull output stage, change to a LM358 and see if that works for you.

    ak
     
    davenn likes this.
  4. eetech00

    eetech00

    95
    8
    Nov 17, 2014
    Hi

    Here's an example:
     

    Attached Files:

  5. Old Steve

    Old Steve

    734
    169
    Jul 23, 2015
    Perhaps a sine wave input might have been better.
     
  6. eetech00

    eetech00

    95
    8
    Nov 17, 2014
    OK..
     

    Attached Files:

  7. Old Steve

    Old Steve

    734
    169
    Jul 23, 2015
    That's better - now some hysteresis?

    ..... Just kidding about the hysteresis, and I wasn't having a shot at you earlier, it just looked pointless having a square wave input for a virtually identical output.
    LTSpice is a handy tool, isn't it?
     
  8. eetech00

    eetech00

    95
    8
    Nov 17, 2014
    :D No worries.

    LTspice is awesome!
     
  9. wingnut

    wingnut

    233
    8
    Aug 9, 2012
    Hi Ben and all

    First of all welcome to the forum Ben. I think AK's advice to use a LM358 should do what you expect - output a positive voltage. The LM393's output is just like a closed switch to ground or an open switch to ground and that is why a voltmeter reading taken from the output shows negligible change in output voltage. The LM358 will on the other hand give two distinct output voltages, one state positive, and one of 0V. Reminder to self to get some of these babies next time I order.

    If you have any more questions please ask. I am a reader of Louis L'Amour not data sheets so that is why I am very grateful to be on a forum where folks who do read data sheets around the breakfast table, are kind enough to explain the minutia of electronics to me.
     
  10. Old Steve

    Old Steve

    734
    169
    Jul 23, 2015
    Ben, before you go off and buy some LM358s, possibly for no good reason, what are you connecting to the output of the comparator?
    Chances are the LM393 is fine, if you add a pullup resistor to the output pin. That's how they're intended to be used.
    That will give you a positive voltage when the +ve input pin is higher than the -ve input pin.
     
  11. Ben Parker

    Ben Parker

    3
    0
    Sep 21, 2015
    Hi, thanks for all the replies! I am using the LM393 to compare 2 voltages to then switch on an air compressor (240vAC, 500w). After the initial reply I studied "open collectives" which are new to me. So now I have used a transistor on the output to power a relay. It works, but is this the best way of doing it?
     
  12. Old Steve

    Old Steve

    734
    169
    Jul 23, 2015
    The best way, with your circuit, is like this:-

    Comparator.JPG
     
  13. Old Steve

    Old Steve

    734
    169
    Jul 23, 2015
    Ignore the fact that I used an LM311, pretend it's a 393. (I just copied/pasted it 'as-is' from my components file.) The diode should be a 1N4002 or similar, and the transistor should be chosen for the current needed to power the relay coil. the resistor could be as high as 10K.

    Alternatively, if your relay draws less than 50mA, you could invert the polarity of your op-amp, so it goes low rather than high when active, and drive the relay directly from it. (Still put a diode across the relay though.) Forget this, I was thinking of an LM311 - an LM393 is only rated at 16mA. :oops:

    If your relay uses comfortably under 100mA, you could use a BC548 transistor.

    Edit: I forgot to add, the diode is to protect the transistor from the high voltage spike that's generated when the relay switches off. It could easily damage a transistor.
     
    Last edited: Sep 22, 2015
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-