op amp output

amplifyer

gives

Good morning. The LM319 is actually a dual comparator, which is optimized to operate as an on-off indicator of the diference between the voltages at the - and + inputs. This works kind of like an op amp would, except a comparator is made to switch fast and not spend a lot of time between "ON" and "OFF".

Another feature about most comparators including the LM319 is that they have open collector outputs. That means that, when the output is low, it sinks current. When the output is high, the comparator output transistor is off. If you have a pullup resistor, that gives you a high output.

Now, if you look at the datasheet

formatting link

you can get some clues about what's happening.

VCCVCC + + | | - C| VCC ^ C| + | C| | | | 5.6K.-. | | | | | | | | '--o |\\| '-' | -|-\\ | |/ | >----o----| -|+/ | |>

|/| .-. | | | | 1K | | =3D=3D=3D '-' GND | =3D=3D=3D GND created by Andy=B4s ASCII-Circuit v1.24.140803 Beta

formatting link

Under normal operation, when the comparator is off, you should see a voltage divider between the 5.6K and the 1K resistor. For a 13.8V battery voltage, that should give you around 2.1V at the output pin. When it's on, it's sinking the current from the 5.6K resistor, about

2mA. The data sheet on p.4 shows that the output vopltage should be pretty near zero.

You're getting pretty close to the full battery voltage when the comparator is off, and about 1.3V when on. Again, looking at the datasheet, you can see that the comparator transistor "on" voltage starts to rise pretty dramatically when it's trying to sink more than about 5mA.

That leads me to suspect that there's too much current going into that node, when the comparator is ON or OFF. First guess -- your transistor pinout is wrong. with the flat of the TO-92 plastic package facing toward you and the pins down, the pinout from left to right is E - C - B=2E As a first guess, I'd suggest you've got it wired up as E - B - C, like the 2N3904 and a lot of other small signal NPN transistors. You didn't mention what the battery voltage is (12 or 13.8) when you're running this, but this would explain what you're describing. Switching the collector and base will turn this into a forward-biased diode between the relay and the comparator. The current from the relay will swamp the voltage divider into a much higher voltage like you're seeing.

Try rewiring and see if it works. You may have smoked either the transistor or the comparator, so if it still doesn't work, replace the transistor first.

Good luck Chris

Reply to
Chris
Loading thread data ...

Soory -- my ASCII skills improve with a second cup of coffee. Let's try something like this:

` VCCVCC ` + + ` | | ` | | ` - C| ` | ^ C| ` .-. | C| ` 5.6K| | | | ` | | '--o ` |\| '-' | ` -|-\ | ___ |/ ` | >- o-|___|--| ` -|+/ 1K |>

` |/| | ` | ` === ` GND

created by Andy´s ASCII-Circuit v1.24.140803 Beta

formatting link

The above still applies, but you have to add about 0.7V for the Vbe drop when the comparator is off, bringing the comparator off/transistor on voltage at 2.8V instead of 2.1V.

Everything else above still holds. Check the transistor pinout first.

Chris

Reply to
Chris

Hello, I'm trying to make a thermostat circuit that uses an op amplifyer in voltage comparator mode. The circuit is here:

formatting link

The problem is, circuit doesn't work since when op outputs low it gives

1,35 V (it gives 11,93 V when high, powered from a car battery).. I understand that non-ideal op amps suppose to output high and low with slight offset.. but 1,35 V is just to much.. how can this be solved?

Thanks alot

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply to
frogfot

--- You don't need Q1 and, assuming that your thermistor has a resistance of around 1000 ohms at your setpoint, this should work:

+12V>-----+-------+---------+--------+----+-----+ | | | | | | | | | [10k] |K | O------C [4k7] [30k] | | [CR1] [COIL]- - -| | | +---|--[1M]--+ | | O--> |------+--+-----G 2N7000 [RTH] | [10k]--+---+---+---+-----+---+-----------+-------+

If it has a different resistance, post back with the spec's or a part number and over what temperature range you want to be able to vary your setpoint.

The 1 megohm resistor is in there for hysteresis and you may want to change it if the thermostat cycles too quickly.

-- John Fields Professional Circuit Designer

Reply to
John Fields

It does change.. I said in previous post that comparator gives 1,35 V when low and 11,93 V when high. The relay driving transistor doesn't want to turn on since voltage is to high.. I want the op to give ~0 V when low..

I even tested the op in a more simple circuit by connecting + input to a voltage devider: 10k/10k across the 12 V, so this gave about 6 V. To the - input I connected a pot so it could give 0-12 V. Turning the pot changed the output of op nicely.. but this gave same problem..

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply to
frogfot

If you've built correctly, I would disconnect the output of the op-amp from the relay driver. The junction of R7 & R8 should have about 9.5 volts WRT ground. This is from 12v-Vbe(sat)/R7+R8 = 11.4v/6600 ohms = 1.7mA so 5600 * 1.7=

9.52 volts at the R7 R8 junction and the relay should pull in.

BTW, if the relay coil is < 480 ohms, the LM319 can drive it directly though its operation would be reversed.

Grounding the R7 R8 junction should open the relay.

Having verified this operation, install a pull-up resistor to the LM317 output.

5600 ohms would be fine. Insure that the junction of the LM317 and the resistor can swing between 12 volts and very near ground.

My guess is that you will have a relay driver problem.

Reply to
Lord Garth

Change the opamp for one which gives rail-to-rail outputs. Or create your own rail-to-rail output using transistors.

Reply to
John Smith

Maybe you have soldered the transistor in with the E and C changed, or the comparator is oscillating. The whole design on this web page doesn't have any hysteresis, which should be there. Just solder a 1Meg resistor from pin12 OP to pin4 +IN. Actually the statements do not make sense, because the relais should be triggered when the comparator output is *high* or in the off state, which means the value on the +IN is smaller than on the -IN. Voltage on pin 12 should be around 1.9V and voltage on the relais coil below 0.3V.

When the comparator is low, the voltage on pin 12 should be less than 0.3V with the lowish current draw of the 5k6 pull-up resistor. Thr relais is then off. The output should be able to drive the relais directly, if the current is less than 25mA.

The guy descibed his design:

"The circuit this time isn't doing to the such circuit. However, I changed into the drive circuit which used a transistor because it was unstable that the relay works. It wasn't worked when it should work. When the output of the comparator is ON(It detects below the setting temperature), the base of the drive transistor becomes grounding voltage approximately. Therefore, the electric current doesn't flow through the base of the drive transistor and the transistor becomes OFF condition. The relay doesn't work. When the output of the comparator is OFF(It detects above the setting temperature), the electric current flows through R7 and R8 into the base of the drive transistor and the transistor becomes ON condition. The relay works."

So the transistor was put to invert the logic signal, he could have done that faster by just exchanging the +IN with the -IN inputs, good grief.

ciao Ban

Reply to
Ban

Use a comparator instead of an op amp. Op amps are designed to be analog, and so are likely to not be rail-to-rail. The output of a comparator is an open-collector transistor, with the emitter either grounded or connected to the negative supply (which is probably ground), so can pull the output down to Vcesat.

Cheers! Rich

Reply to
Rich Grise

One day frogfot got dressed and committed to text

So what thermistor are you using ?? Sounds like the comparator is not quite changing over.

-- Regards ..... Rheilly Phoull

Reply to
Rheilly Phoull

I've

than

than

I'll

resistance

you've

Hello again. I was under the impression you were working with a comparator and trying to get the circuit to work. Having switched over to an LM358 (which will get within a couple hundred mV of GND while sinking a couple of mils) should have handled your immediate problem of getting the relay transuistor to turn off.

However, you've got a couple of serious problems that don't have anything to do with that. First, the schematic transistor TR1 is a current-driven device whose gain will be very dependent on temperature. A small change in the ambient temperature around Q1 will cause a large change in voltage impressed across the 2K load resistor. Bad news if you want to maintain a steady setpoint.

Second, whether you use an op amp or a comparator to drive the relay transistor, you're going to have problems with transistor oscillation when the thermistor voltage gets close to the pot voltage. That can be hidden a bit by the fact that the relay coil will act to average the voltage impressed across it, and that relay coils have inherent hysteresis (you usually have to get them up above 50% of rated voltage for them to turn on, but once on, they will almost always stay on until coil voltage goes down below 25% of rated voltage).

In short, I think the author of the web page knew more about web page design (pretty good, actually) than electronics (inadequate, actually). It's a common problem. But there's a pretty good basic circuit on the web similar to yours that doesn't have the problems listed above:

formatting link

This circuit will also have the issue about the turnoff voltage of the op amp not being quite low enough to turn off the transistor. It also lacks consideration for using a remote thermistor.

But, considering you've got an LM358 dual op amp to solve the turn-off issue, you might want to try something like this (view in fixed font or M$ Notepad):

VCC + | | VCC =2E-. + | |47K | | | .---o '-' | | | VCC | C| | + - C| o--. | 220K ^ C| | | 1N914 | ___ ___ | | | | - .-|___|-. .--|___|--. | | =2E-. | ^ | 22K | | | | | | | | | | |\\ | | VCC | '---o | | | | '-|-\\ | ___ | |\\| | | '-' | 0.1uF | ___ | >--o-|___|-o--|-\\ | ___ |/ | '------------o---o-|___|-|+/ 10K | >---o-|___|-o-| '-----------. | | 22K |/ .--|+/ 2.2K | |>

Thermistor | --- | | |/| .-. |

Reply to
Chris

Sorry -- you'll have much better luck if you feed the 47K/thermistor divider with the reference voltage from the 7805. My bad.

` +5V ` | ` | VCC ` .-. + ` | |47K | ` | | .---o ` '-' | | ` | VCC | C| ` | + - C| ` o--. | 220K ^ C| ` | | 1N914 | ___ ___ | | ` | | - .-|___|-. .--|___|--. | | ` .-. | ^ | 22K | | | | | ` | | | | | |\ | | VCC | '---o ` | | | | '-|-\ | ___ | |\| | | ` '-' | 0.1uF | ___ | >--o-|___|-o--|-\ | ___ |/ ` | '------------o---o-|___|-|+/ 10K | >---o-|___|-o-| ` '-----------. | | 22K |/ .--|+/ 2.2K | |>

`Thermistor | --- | | |/| .-. | `

Reply to
Chris

How stupid of me to forget menti>The whole design on this web page doesn't have

But is 1M resistor really needed? I thoat it >You're getting pretty close to the full battery voltage when the

The high/low output doesn't change much if I remove all load from the >You don't need Q1 and, assuming that your thermistor has a resistance

Mine NTC is 10k at 25*C and 500 at 100*C. I don't understand why you've used an MOSFET (I'm more used to transistors :P ).. and what's the purpose of Z15V, is it a zener diode?

I was going to use this circuit to control temp in a water-bath at

0-100*C.

Thanks for your time again.

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply to
frogfot

How stupid of me to forget menti>The whole design on this web page doesn't have

But is 1M resistor really needed? I thoat it >You're getting pretty close to the full battery voltage when the

The high/low output doesn't change much if I remove all load from the >You don't need Q1 and, assuming that your thermistor has a resistance

Mine NTC is 10k at 25*C and 500 at 100*C. I don't understand why you've used an MOSFET (I'm more used to transistors :P ).. and what's the purpose of Z15V, is it a zener diode?

I was going to use this circuit to control temp in a water-bath at

0-100*C.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply to
frogfot

--- I used a MOSFET because the gate doesn't draw any current, so you don't have to worry about the comparator output going out of saturation when it's sinking the transistor's base current. If you used a transistor you'd want to force beta to about 10, which means that for a relay with a 100mA coil the base current would need to be

10mA, which could pull the LM319 output out of saturation. The Zener (15V) is to make sure that any spikes which appear on the MOSFET's gate will be clamped to 15V in order to keep the MOSFET from getting damaged.

---

--- If you mean from 25 to 100°C, then I suggest you do something like this:

+12V>-----+-------+---------+--------+----+-----+ | | | | | | |R1 |R2 | [10k] |K | O------C [10k] [10k] | | [CR1] [COIL]- - -| | | +---|--[1M]--+ | | O--> |------+--+-----G 2N7000 [RTH] | [10k]------+---+---+-----+---+-----------+-------+

Notice that I changed the comparator to an LM393, which is a better comparator for this application, I believe. (and cheaper,too) The value of R4 is going to depend on the the end point resistance of R3 and should be set so that with the pot (R3) rotated fully toward GND the voltage on the comparator - input is the same as the voltage on the + input with the water bath at 100°C. Probably close to 500 ohms, the 100°C resistance of the thermistor.

-- John Fields Professional Circuit Designer

Reply to
John Fields

How stupid of me to forget menti>The whole design on this web page doesn't have

But is 1M resistor really needed? I thoat it >You're getting pretty close to the full battery voltage when the

The high/low output doesn't change much if I remove all load from the >You don't need Q1 and, assuming that your thermistor has a resistance

Mine NTC is 10k at 25*C and 500 at 100*C. I don't understand why you've used an MOSFET (I'm more used to transistors :P ).. and what's the purpose of Z15V, is it a zener diode?

I was going to use this circuit to control temp in a water-bath at

0-100*C.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply to
frogfot

Nope. The voltage divider between the 47K resistor and the thermistor would be buffered without adding more than a couple of millivolts of offset by the LM358. The gain is 1, period, and the offset won't change more than a millivolt or two with reasonable changes in temperature. Whereas the initial circuit's NPN transistor buffer will change all over the place, for even a 15 degree change in ambient from

25C to 40C.

precision.

it

a

the

I'm assuming your op amp input is basically "floating in the breeze" with a remote thermistor. I don't like that, because a lot of things can go wrong there. The cap, diodes, and series resistor at the input of the op amp may help prevent any accidental excursions (like electrostatic discharge) above/below the supply rails from damaging the op amp input.

batteries

Either way, a 7805 5V post-regulator after your 7812 can't hurt. I'm making some assumptions about the susceptibility of the circuit to oscillate at switching point, and the 5V reference is one of those things that might not be necessary depending on what you do and how you construct your circuit, but it can't hurt and it just might pervent serious problems.

V.

me..

(I

Yup. I'm a little biased against FETs because of bad experiences in ancient history. In days of yore, they used to ship each early FET encircled by its own anti-static brass ringlet which you only removed after the device was safely on the circuit board, and needless to say, mortality rates were very high. You would look at these things wrong, or even just open the box, and they'd die in droves. Things are a lot better now for many reasons, but I still won't use a MOSFET if a transistor will do the job. I guess I just feel more comfortable with them, and transistors generally are cheaper, which is why you see many more of them as discretes in scavenged consumer electronics (although you seem to have the prices under control, as long as you don't cost your time).

window"

:P

Well, why don't you try 'em all, and see which one works best for you. Do Mr. Fields' circuit first -- his is a more elegant, lower parts count and lower cost solution. Read up on both of 'em, look at the datasheets, post questions, learn like heck. Who knows, your final circuit might be any one of them, a combination of all of them, or something you thunk up yourself. It's a wonderful world, isn't it? 8-)

Good luck Chris

Reply to
Chris

How stupid of me to forget menti>The whole design on this web page doesn't have

But is 1M resistor really needed? I thoat it >You're getting pretty close to the full battery voltage when the

The high/low output doesn't change much if I remove all load from the >You don't need Q1 and, assuming that your thermistor has a resistance

Mine NTC is 10k at 25*C and 500 at 100*C. I don't understand why you've used an MOSFET (I'm more used to transistors :P ).. and what's the purpose of Z15V, is it a zener diode?

I was going to use this circuit to control temp in a water-bath at

0-100*C.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply to
frogfot

How stupid of me to forget menti>The whole design on this web page doesn't have

But is 1M resistor really needed? I thoat it >You're getting pretty close to the full battery voltage when the

The high/low output doesn't change much if I remove all load from the >You don't need Q1 and, assuming that your thermistor has a resistance

Mine NTC is 10k at 25*C and 500 at 100*C. I don't understand why you've used an MOSFET (I'm more used to transistors :P ).. and what's the purpose of Z15V, is it a zener diode?

I was going to use this circuit to control temp in a water-bath at

0-100*C.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Reply to
frogfot

--
I like Chris's circuit better, but with these modifications:


 +5V
  |
  |                                                              VCC
 .-.                                                              +
 | |47K                                                           |
 | |                                                          .---o
 '-'                                                          |   |
  |                   5V                                      |   C|
  |                   +                                       -   C|
  o--.                |                          +----+       ^   C|
  |  |          1N914 |        ___          1M  _V_   |       |   |
  |  |                -     .-|___|-.       .--|___|--+       |   |
 .-. |                ^     |  22K  |       |         |       |   |
 | | |                |     | |\    |       |    5V   |       '---o
 | | |                |     '-|-\   |  ___  |  |\|    |           |
 '-' |          0.1uF |  ___  |  >--o-|___|-o--|+\    |  ___    |/
  |  '------------o---o-|___|-|+/      1k      |  >---o-|___|-o-|
  '-----------.   |   |  22K  |/            .--|-/       390    |>
Thermistor    |  ---  |                     |  |/|                |
Reply to
John Fields

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.