Need help with simple op amp comparator

Thread Starter

caseih

Joined Nov 19, 2012
6
I'm trying to teach myself a little bit about op amps so I tried to build a simple comparator circuit to compare two pots and turn an LED on. I'm using a TS922 op amp I have lying around with a unipolar power supply. I've read about op amps on line and even have seen schematics, but I'm missing something.

Just as a starting point, if I clamp both - and + inputs to ground, I would expect that the output would be low (0). Is this correct? In my circuit, my LED shines merrily even with Vref and Vin grounded. My VCC is at 12V (my goal for the working voltages). Do I need to pull the output with a resistor? Put a bigger load on it?

My goal is to compare two pots. The specs on this op amp say the Vdiff between the inputs should be no more than 1V. So will I need to divide the input voltages further to limit them to 1V each at most?

I think I've reached the limit of my electronics knowledge, sadly. The op amp schematics for this sort of thing look so simple. In fact http://openbookproject.net/electricCircuits/Exper/EXP_6.html looks very similar to what I want to do, if my op amp is the right one for the job.

Any hints or pointers to better documentation and tutorials are greatly appreciated!

thanks,
Michael
 

Ron H

Joined Apr 14, 2005
7,063
A real comparator will switch faster than an op amp, but if you want to play with the TS922, do it as in the attachment.
An op amp with a low differential input limit is a poor choice to use as a comparator. I added Schottky diode clamps (and current limiting resistors for the diodes) to protect the inputs.
I also added a resistor to provide some hysteresis. Otherwise, when the inputs are very nearly equal, the output will chatter. Try it both ways.
The capacitor from vcc to ground should be mounted as close to the IC as possible, with short leads. This is to prevent possible oscillations.

If you want to play with a real comparator, look at LM393 and/or LM311. Be sure you read the datasheets carefully.
 

Attachments

Thread Starter

caseih

Joined Nov 19, 2012
6
Right now I only have a 5K pot and and a 10K pot in my assortment. What changes would I make to this circuit to deal with those two pots on the inputs?
 

Ron H

Joined Apr 14, 2005
7,063
Right now I only have a 5K pot and and a 10K pot in my assortment. What changes would I make to this circuit to deal with those two pots on the inputs?
Those pots are fine. They don't have to be the same value. You can dispense with the diodes if you change the series resistors to around 15 to 20k. Measure input voltages on the op amp input pins.
Real comparators don't have these restrictions. Most op amps don't either.
 

bountyhunter

Joined Sep 7, 2009
2,512
Just as a starting point, if I clamp both - and + inputs to ground, I would expect that the output would be low (0). Is this correct? In my circuit, my LED shines merrily even with Vref and Vin grounded. My VCC is at 12V
1) If you have a single supply, the op amp may not allow taking the inputs to ground, which is the negative rail in your application.

if I clamp both - and + inputs to ground, I would expect that the output would be low (0). Is this correct?
Not necessarily. If the op amp is running without feedback, the output may be either high or low depending on the input offset voltage.
 

crutschow

Joined Mar 14, 2008
34,469
Cheap and common comparators are the LM311 or LM339. The can operate from single supplies and work down to zero volts on the input.
 

#12

Joined Nov 30, 2010
18,224
I'm repeating other people but in different words.

A lot of opamps don't even recognize 0.0 volts as a valid input. They only care about the difference between their 2 input pins, and the voltage on each pin must be within the "common mode range". That means, "somewhere near the middle" between the positive supply voltage and the negative supply voltage (which is sometimes zero).

"The middle" can be very large if you're running an opamp with +/- 15 volts for its supplies but the middle gets pretty small if you're only giving the chip +5 volts and 0 volts. The amps that don't care are called, "rail to rail" inputs. Even then you have to read the datasheet closely because some of the alleged rail-to-rail amps don't go all the way to the rail. They miss by few tenths of a volt.

Opamps are analog devices. A digital kind of zero input voltage doesn't work with a lot of them.
 
Top