# Voltage comparator circuit not working properly

#### midnightblack

Joined Feb 29, 2012
31
I am working on a line follower robot project.

I am using light sensors and an op amp for the initial input stage of the complete circuit.

Ideally, the op amp should switch to Vcc+ (4*1.5V batteries=6V) when the sensor is on the track and Vcc- (0v) when the sensor is off the track.

In practice however this is not working and the op amp switches between ~1.2V and 1.6V .

This is the circuit I have set up;

The op amp I am using is the TL072CP op amp from Texas Instruments.

#### Ron H

Joined Apr 14, 2005
7,014
The 1.6V high level is because you don't have a base current limiting resistor. The Darlington input looks like two diodes in series, so 1.6V is reasonable. You need to add a resistor in series with the base. I can't tell you the value without knowing the collector current.
The low level should actually be around 180mV. See the VOL in the datasheet.
LM393 would be a much better choice for a comparator. Most op amps make lousy comparators.

#### midnightblack

Joined Feb 29, 2012
31
The 1.6V high level is because you don't have a base current limiting resistor. The Darlington input looks like two diodes in series, so 1.6V is reasonable. You need to add a resistor in series with the base. I can't tell you the value without knowing the collector current.
The low level should actually be around 180mV. See the VOL in the datasheet.
LM393 would be a much better choice for a comparator. Most op amps make lousy comparators.

I looked at the data sheet for the transistor and it says collector current- continuous: 500mA.

So if I understand correctly V=IR--> R=12ohms (V=6V and I=500mA)?

But I still don't fully understand why this is so. Is it something along the lines that there needs to be a load on the output for it to work?

EDIT: I also didn't understand why my low level is 1.2V rather than 180mV as you say.

#### jimkeith

Joined Oct 26, 2011
540
The 1.6V high level is because you don't have a base current limiting resistor. The Darlington input looks like two diodes in series, so 1.6V is reasonable. You need to add a resistor in series with the base. I can't tell you the value without knowing the collector current.
The low level should actually be around 180mV. See the VOL in the datasheet.

I also found this figure (Vol = 180mV) in the datasheet, but it does not agree with the graph of expected output voltage range--I wonder if it is in error because looking at the device schem, it looks like it would be hard put to pull the output much below 1V even with no load (PNP emitter follower driven by current source bias plus some common mode current to prevent crossover distortion).

The relay driver output transistor stage is a darlington configuration--hFE is probably in the order of 5000, so it takes very little base drive to make it work--try putting in a 10K resistor and see what happens--regardless, the op amp should be able to turn off the darlington OK.

#### midnightblack

Joined Feb 29, 2012
31
I also found this figure (Vol = 180mV) in the datasheet, but it does not agree with the graph of expected output voltage range--I wonder if it is in error because looking at the device schem, it looks like it would be hard put to pull the output much below 1V even with no load (PNP emitter follower driven by current source bias plus some common mode current to prevent crossover distortion).

The relay driver output transistor stage is a darlington configuration--hFE is probably in the order of 5000, so it takes very little base drive to make it work--try putting in a 10K resistor and see what happens--regardless, the op amp should be able to turn off the darlington OK.

1. Are you saying that the op amp will not output <1V?

2. What relay driver output are you talking about?

3. Are you suggesting that I should put the 10K resistor in series to the op amp output and the darlington pair? What exactly would this do? Drop the voltage to a more suitable one?

4. Would the voltage output from the op amp still be switching from 1.2V-1.6V?

EDIT: The opamp does switch the transistor ok (with some fiddling) but I am more interested in why this isn't switching from 0V to 6V because I may choose to use the op amp to input to a microcontroller which would need a digital input and also I want to know this simply as a matter of understanding.

Last edited:

#### Ron H

Joined Apr 14, 2005
7,014
I also found this figure (Vol = 180mV) in the datasheet, but it does not agree with the graph of expected output voltage range--I wonder if it is in error because looking at the device schem, it looks like it would be hard put to pull the output much below 1V even with no load (PNP emitter follower driven by current source bias plus some common mode current to prevent crossover distortion).

The relay driver output transistor stage is a darlington configuration--hFE is probably in the order of 5000, so it takes very little base drive to make it work--try putting in a 10K resistor and see what happens--regardless, the op amp should be able to turn off the darlington OK.
For some reason, I pulled up the TLC072, which is not the same as TL072. I don't see VOL=180mV on the TL072 datasheet. They don't have a single-supply spec, but I'll bet that if you connected a 10k resistor from output to GND on your circuit, the output would go down to near GND.
If that is an ammeter in the collector circuit - don't do that - you might burn out your transistor and/or your meter. You need a load of some sort, that is more than 12 ohms. I wouldn't push it to the limit, though. Derating by 50% is common practice. Keep in mind, though, that your Darlington saturation voltage will be around 0.8 - 1.2V, depending on collector current, so you really will only have around 5V across the load with a 6V supply.

#### Attachments

• 51.9 KB Views: 50

#### jimkeith

Joined Oct 26, 2011
540
For some reason, I pulled up the TLC072, which is not the same as TL072. I don't see VOL=180mV on the TL072 datasheet. They don't have a single-supply spec, but I'll bet that if you connected a 10k resistor from output to GND on your circuit, the output would go down to near GND.
If that is an ammeter in the collector circuit - don't do that - you might burn out your transistor and/or your meter. You need a load of some sort, that is more than 12 ohms. I wouldn't push it to the limit, though. Derating by 50% is common practice. Keep in mind, though, that your Darlington saturation voltage will be around 0.8 - 1.2V, depending on collector current, so you really will only have around 5V across the load with a 6V supply.
OK Ron, I think you have it pegged--I actually had both spec sheets up at the same time and thought that they were the same part--duh--honestly did not catch the difference between the CMOS and the JFET version part numbers.