LM 339 comparator questions

Baard ToerdalBaard Toerdal Posts: 8
edited 2005-02-05 - 21:54:14 in General Discussion
Hi!
I need to trigger an event when a voltage passes a certain limit between 6 and 9 volts. I would like to measure this voltage without connecting the Stamp ground to the circuit I want to monitor. Can I use the LM 339 comparator to do this job? And if its not a good choice; is there any other comparators or solutions you could recommend? Any help would help! Help!

Baard

Comments

  • nick bernardnick bernard Posts: 329
    edited 2005-02-01 - 14:06:22
    sure, a comparitor works like this
    if the voltage at V+ > V- then ouput = Vdd
    if the voltage at V- > V+ then ouput = Vss

    m'kay
    you can bias V- with a pot like this

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    League Bowling.... it's not a sport, it's a way of life
  • Baard ToerdalBaard Toerdal Posts: 8
    edited 2005-02-01 - 20:49:29
    Hi!
    Thanks for the answer and the schematics Nick!

    Ok, so just to see if I have got things right... Pin 5 on the LM339 is connected to the positive side of the voltage I need to measure. Pin four is connected through a potentiometer which has both ends connected to the voltage I need to measure. Pin three is 0 and +5V powering the LM339 and pin 2 is output to the Basic Stamp?

    If I have understood this right, then my next questions are:

    Pin 4 sets the reference value, right? I have a 5V power supply for the Basic Stamp and different chips on my board. The 6-9 volt signal I need to measure is just that; a six to nine volt signal which bounces up and down. The reference voltage pin : would I need to incorporate a steady 9V power supply for this pin? The signal I need to measure is everything but steady and I guess it would not be a good source for providing a reference voltage for the LM339?

    And what about hysteresis? I´m not sure I understand the concept of hysteresis, but I believe it has something to do with smoothing out the signal so the comparator doesn´t trigger at every little peak? I have seen circuits which add an 1 meg resistor between pin 2 and 5; has that got something to do with hysteresis? My signal is an audio signal which could need such a filter I guess...

    And finaly the question which proves I have very little knowledge about these things: Is an LM339 the same thing as an LM339N? There is a difference between NPN and PNP transistors and I´m just just wondering if this "N" means something...

    Thanks again, from a cold and muddy Oslo

    Baard T.
  • ufadedufaded Posts: 8
    edited 2005-02-01 - 23:50:12
    Pin 4 does set the reference voltage - it should be connected to a regulated supply (voltage regulator - LM7805, LM7808, etc). If you are just wanting the comparator to trigger off a peak in your input signal, then it should work fine. The "N" at the end of the part specifies the package it comes in (dip, surface mount , etc.). I believe hysterisis means that there is play in when something triggers on and off (on at 5V, off at 4.8V) or something like that - so that something wouldn't continually toggle at one set point. Hope this helps.
  • paysonbadboypaysonbadboy Posts: 81
    edited 2005-02-02 - 04:04:30
    I use comparitors fairly often. They come in HANDY.

    In my latest circuit I'm using one for a CHEAP voltage to digital converter if you will call it that. Need the Stamp to know if my feedback is above a certain level below a certain level, or within a certain level to adjust what it's controlling. Cheap interface for that kind of stuff and just feed the outputs into a few pins to give the logic to the stamp.

    020105_PartsOnBoard.jpg
    What a sorry quality pic that took, but the bottom IC is a LM339
    I just got done installing the components a few monutes before i logged into here.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.paysonarizona.net/
  • Baard ToerdalBaard Toerdal Posts: 8
    edited 2005-02-02 - 09:21:16
    Hi!
    Thanks for the help! I´ll try it out tonight and see if I can get my circuitry working. This shoud be pretty basic stuff I guess, I only hope that what my brain thinks it understands will work in real life.

    Baard
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-02-05 - 21:54:14
    Baard,

    ·· The one part of your question that wasn't addressed was the common ground.· If you use the LM339, you will need a common·ground with the stamp, as well as what your input voltage is coming from.· Also, if your reference voltage is 5V from the stamp, and your input voltage is 0-9V, you're always going to be reading a high output from the LM339 to the stamp whenever it's above 5V.

    ·· The LM339 has an operating voltage of +36V, or +/-18 Volts so you can handle negative and positive voltages.· However, I don't recall, but I don't think you can compare an input voltage higher than the supply voltage properly.

    ·· Back to the ground issue, if you build the LM339 circuitry around a fixed 9V supply, you will be able to accurately compare for your range, and then if you run the output of the LM339 into an opto-coupler you will not need a common ground.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --==<{Chris}>==--
Sign In or Register to comment.