Help with a simple comparator circuit

I'm trying to build a simple temperature controller by using a thermistor and a potentiometer attached to a Schmidt trigger to control a relay.

I realize that I have some serious design flaws in this circuit:

  1. The power dissipated through the thermistor is to large (discovered after nicking my finger).
  2. The op-amp's output hits almost no resistance, leading to a short.

Iv'e tried solving this by adding more resistors, but I'm not sure how to proceed while keeping the op-amp's inputs away from the (one-sided) supply's limits.

Any help apreciated. Help with a simple comparator circuit


  • Main problem is 20r is far far far too low for thermistor value. Use of a 20k when cold thermistor is about right. Why use a 20r? (eg may be a special part etc).
  • For temperature measurement thermistor self heating must be small - say 1 mW in a small package. You would need Vthermistor << 1V if thermistor = 20r.
  • Use a "single supply" opamp whose input common mode includes ground. Vout going to ~= ground is also useful. Cheap and available LM324 (quad) of LM358 (dual) is OK for this circuit.
  • You could make a Vsupply/2 reference point to allow input to not be ground referenced but this is not needed if Rtherm higher and single supply opamp used.

Use a rail to rail op amp OR at least one that ncludes ground in its cmmon mode range. The very available common and cheap LM358 (dual) and LM324 (quas) include ground in input common mode range and can be run as "single supply" amplifiers on a 9V (or 5V or ...) single supply system.

You do not say what IC is used for the amplifier or why.

If this is going to work as a temperature controller then self heating of the thermistor MUST be < to << the heating from heat sources. So a design target of say 1 mW self heating to start gives SOME idea.
Power thermistor = V^2/R = 0.001 Watt.
So V therm = sqrt(Ptherm x Ttherm) = sqrt (0.001 x 20) ~~~= 0.04 Volt.
The problem is that the thermistor is vastly too low in resistance for 9V operation - how did you choose it?
Is it really 20 ohms?
If it is 20k then Vtherm = sqrt(20k x 0.001) =~ 4.5V = much better.

If you MUST use a 20 Ohm thermistor ad if you MUST use a non single supply IC then you can make an eg half supply reference point.
You can take eg 1k+1k in series from 9V to ground and use centre point as 4.5V dummy-grounjd.
Return thermistor chain and opamp + input chain to there.
BUT the dummy ground divider must be "stiff" so it is not altered by changes in inputs from thermistor and opamp output. Opamp drive is via 100k so that is OK with a 2 x 1k divider.
BUT Op amp + in ref chain of 220R + 500R pot + 312R? resistor is very low. Why?
You would need a

Increase thermistor drive to a level that meets thermistor max dissipation at very very worst. BUT you really need a stiffer reference point and a regulator (LDO 3 terminal or TL431 or ...) can be used for ref. BUT a single supply op amp makes more sense.

Olin and Russell already explained that your thermistor value is too low: it will dissipate 820mW and make any temperature measurement impossible. I found a nice 50k\$\Omega\$ NTC thermistor, which may be better suited; it dissipates 1.6mW at 25°C. If you don't like it, don't worry, I'll go through the necessary calculations, and you can follow them with your own NTC.

Help with a simple comparator circuit

I'm assuming you want to set the thermostat between 20°C and 30°C, with thermistor values of 63k\$\Omega\$ and 40k\$\Omega\$ resp. (I found those on p.12 of the datasheet). If we choose 50k\$\Omega\$ for R8 we have an input range for the opamp of 4V at 30°C to 5V at 20°C. We're nicely in the middle of the power supply range, and we won't need a Rail-to-Rail Opamp.

Let's follow Russell and pick the LM324 for the opamp. Not just to please Russell, it's also one of the cheapest, and we'll use the other three opamps in it as well.
The LM324 from Fairchild's input common range goes to \$V_{CC} - 1.5V\$ at 5V supply, so that's OK. Also the lower limit is OK; the LM324 accepts voltages down to 0V.

Let's look at that other voltage divider with the potmeter. If we want to control between 4V and 5V we can easily see that 40k\$\Omega\$ + 10k\$\Omega\$ potmeter + 40k\$\Omega\$ gives us the right range. Let's use 39k\$\Omega\$ for that.

Then there's the feedback resistor for the hysteresis. We have an input voltage variation of about 1V/10°C, so if we want a 0.5°C hysteresis, we have to move our setpoint 25mV up or down. I'll cut some corners and assume \$V_{OUT}\$ of the opamp goes from 0V to 9V. We set our potmeter in the middle. Then for the high threshold we can use KCL:

\$ \dfrac{9V - (4.5V + 25mV)}{44k\Omega} + \dfrac{9V - (4.5V + 25mV)}{R_{FB}} = \dfrac{4.5V + 25mV}{44k\Omega} \$

and solve for \$R_{FB}\$ we find a value of 3.94M\$\Omega\$.
So now we have a thermostat we can control between 20°C and 30°C with a 0.5°C hysteresis.

Now the relay. Olin says the opamp can't drive that. He's right for most relays, but I found this one which only needs 11mA in the high-sensitivity 9V version. The LM324 datasheet says it can sink at least 10mA, so that's still not enough. But we have 3 unused opamps in the package, let's use them in parallel. The \$4.7\Omega\$ resistors make that the current is nicely distributed over the three opamp.

It's possible that this has only academic value. We saved a transistor, but we needed two extra resistors (still cheaper). But the relay may be much more expensive than one with a higher current rating, and then Olin's solution with the transistor is better.

You apparently have two problems:

  1. Too much current thru the thermistor, which causes self-heating. Several solutions:
    1. Use a higher resistance thermistor. There are many available with substantially higher value than 50 Ω.
    2. Use a lower supply voltage. There are plenty of opamps with nearly rail to rail common mode range that run from 5 V or less. The Microchip MCP603x, for example, is specified for 1.8-5.5 V supply. This one also has quite low offset voltage.
    3. Add resistors in series. This will reduce the voltage variation as a function of temperature, so you have to be careful. Look at the offset voltage of the opamp and see what your temperature error is. Also consider drift of the additional resistors. Still, this might be useful for reducing the current by 2x or maybe a bit more.
  2. Driving the relay.

    It's no surprise the opamp can't drive the relay directly. A simple low side NPN switch would to fine here:

    Help with a simple comparator circuit

    This is assuming the relay coil is meant to be driven from 9 V as in your original circuit.

    R1 depends on the relay coil current required and the gain of Q1. It must not load the opamp more than it can handle. Let's say the relay needs 50 mA at 9 V and the transistor can be counted on to have a gain of 50. That means you need at least 1 mA base current. Let's say the opamp is running from 3.3 V and it can drive the output close to that when high and sourcing up to a few mA. Figure 700 mV for the B-E drop of Q1, which leaves 2.6 V accross R1. 2.6V / 1mA = 2.6 kΩ. That is the maximum allowed. I'd use 2 kΩ in this example to allow for some margin. That means the opamp has to source 1.3 mA, which most can do.

Category: power Time: 2012-06-09 Views: 2

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.218 (s). 12 q(s)