simple comparator circuit help

Discussion in 'The Projects Forum' started by spitfire5454, May 14, 2007.

  1. spitfire5454

    Thread Starter New Member

    May 13, 2007
    ok im new to this circuitry stuff. this is becoming very frustrating to me. im making an led gear indicator for my motorcycle. 1 led lights up for first, 2 for 2nd, etc. i am tapping in the signal from the transmisson which puts out a different voltage for every gear ( so the bikes computer can know what gear its in). so this should be pretty simple: use 6 comparators with different refernce voltages for each gear using resistors. but i cant for the life of me understand my comparator. just building a simple circuit is killing me. for right now im just trying to get an led to turn on. im using a lm339AN comparator. i put 7.49v to the (-) and 3.74v to the (+) and i got no oput voltage. i reversed it, with 7.49v to the (+) and 3.74v to the (-) and i still got no oput voltage. even weirder, is if i wire it to get an output voltage, the other 3 outputs give voltage even though there is nothing attatched to thier inputs. am i missing something? any help would be appreciated. it seems so simple, but its just not working
  2. sharath_412

    Active Member

    May 7, 2007
    You can use operational amplifier as comparator. For this you have to learn some stuff about operational amplifiers. For an operational amplifier, if the inputs are left open( floating), The output will swing to either +Vcc or -Vcc. Also the open loop gain( no feedback) of this amplifier will be aroud 100000. To decrease the gain we can use feedback concept.
  3. hgmjr


    Jan 28, 2005
    Your basic concept for the circuit is correct 6 comparators each with their own reference voltage setting.

    Can you sketch your current circuit hook-up and post it here? The diagram can just be a hand sketch of the one of the comparator stages since they will all be the same except for the setting of the reference voltage.

    It sounds like you may have possibly damaged the LM339 when you connected the power supply up incorrectly.

    The Vcc pin of the comparator should be connected to a voltage more positive by several volts that the negative or ground power terminal. Reversing this voltage connection can damage the part.

  4. gootee

    Senior Member

    Apr 24, 2007
    Do you have a "pull up" resistor, from the comparator's output to the positive supply?

    The LM339 datasheet is at .

    The LM339 types of comparators have an "open collector" type of output. So it doesn't actually have much of an "output voltage" of its own.

    The output basically functions as a SPST switch to ground (or to the negative supply voltage if using a dual supply), which is opened whenever your reference voltage is exceeded (if you have the reference voltage connected to the - input and your signal connected to +).

    So if you have a resistor from the comparator output to the positive supply, the output will rise almost to the positive supply's voltage, whenever your signal at the + input exceeds the reference voltage at the - input (and your "output current" will almost all come through the resistor, from the positive supply).

    When the comparator's output's transistor "switch" is closed (input signal is below Vref), the resistor has current flowing through it from the V+ supply, and into the comparator's output pin, such that the voltage drop across the resistor equals the difference between the two supply pins, "using it all up" so you don't see much of a voltage on the end of the resistor that connects to the output, if you have a single positive supply. But when the comparator's "switch" is OPEN (input signal is above Vref), and its output pin ISN'T sucking current through the resistor, then the voltage ACROSS the resistor is probably very low (low current, Ohm's law, etc), which means that the voltages at each end of the resistor must be about the same, i.e. close to the + supply rail (if that's what you have the resistor connected to).

    I hope that that helps.

    - Tom Gootee

  5. Papabravo


    Feb 24, 2006
    Since you are new to this you might not understand the concept of an "open-collector" output. The idea is simple enough. An NPN tansistor with its emitter connected to GND and an external pullup resistor connected to the collector forms the complete output stage. When the transistor is turned on the collector is a few tenths of a volt above ground. The current comes from the pullup supply, through the pullup resistor, through the NPN tansistor to GND. When the transistor turns off, there is no place for the current to go. If there is no current across the pullup resistor then the voltage drop across the pullup resistor must be zero. If the voltage drop across the pullup resistor is zero then the voltage on the collector must be the same as the power supply voltage connected to the other side of the pullup resistor.

    Why do we care? Because the logic supply connected to the pullup resistor can be different from the comparator's analog supply. One other point, make sure the inputs stay within the common mode range. In the single supply configuration this is from GND to (Vdd-2.0V), where Vdd is the comparators analog supply voltage. For example if Vdd is 12V, make sure the inputs are in the range [0..10V].