0
\$\begingroup\$

This circuit will (hopefully) send a signal to MCU if over-temperature is observed in any of the NTCs.

circuit

Using LM339 as comparator, and a reference voltage (from TL431), assuming high precision for NTC and resistors, does this circuit use the LM339 correctly? (It's my first time setting up comparator, mostly modifying datasheet example circuits.)

My doubts are about the 5.00 V supplied to LM339 (should it be higher?) The voltage divider which feeds IN- of LM339 is made of constant 3.3k resistor and NTC. [providing 1.24 V @25C and 3.11 V @75C (which is considered high-temp condition)]

Somewhere in the op-amp datasheet it states conditions for IN+, IN-, and the supply voltage (pins 3, 12) and different op-amp working modes, which I honestly couldn't understand fully. (Or I have, if the circuit is correctly working, at least on paper/simulation)

LM339 datasheet

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Change & to OR ( or NOR) or invert inputs \$\endgroup\$ May 19, 2021 at 11:20
  • \$\begingroup\$ Will there always be two NTCs, or may there be more? \$\endgroup\$
    – Reinderien
    May 19, 2021 at 11:39
  • \$\begingroup\$ Actually they are 4. These 4 op-amp outputs gonna be AND/ORed to a single output. \$\endgroup\$ May 19, 2021 at 12:43

4 Answers 4

3
\$\begingroup\$

As the LM339 has open-collector outputs, you can scrub the output gate and wire the comparator outputs together in a wired-OR fashion.

You will only need a single pull-up on the output node.

As Tony commented correctly, you should double check your threshold polarities. The wired-or demands that fault cases lead to (active-)low comparator outputs.

If any circuit detects an Over-temperature, the respective comparator will pull the whole output down. The output only pulls up, if none of the comparators are in the active-low state.

\$\endgroup\$
3
  • \$\begingroup\$ "The wired-or demands that fault cases lead to (active-)low comparator outputs" means if any NTC is in high-temp condition, its op-amp channel should output LOW? here "active" indicates overtemp situation? \$\endgroup\$ May 19, 2021 at 14:14
  • 1
    \$\begingroup\$ yes. The open-collector outputs of the comparator can only actively pull the output-down, but not up (high voltage is established passively via the pull-up resistor). therefore, overtemp must correspond to a low output. The low output resistance of the low output of the faulty channel then "overwrites" all the high resistance "no fault" signals of the other channels and the pull-up. \$\endgroup\$
    – tobalt
    May 19, 2021 at 14:22
  • \$\begingroup\$ Thanks. Got it. will adjust the circuit. I hope no one finds the circuit in OP through google image search and think it's an optimum usage for op-amp :) \$\endgroup\$ May 19, 2021 at 15:45
2
\$\begingroup\$

With an NTC high side sensor to inverting input the comparator is hi-Z to a shared pullup. Thus wired-NOR active low detects an over temp condition if any Vin- goes below the shared reference of 3.1V . A shunt cap reduces and hi-f ripple.

There is no hysteresis added. If you wanted to use hysteresis then you would have to use Vref on the Vin+ and sensor on Vin- (swap inputs) with active high alarm into a multi-input NOR or OR gate. Then add positive feedback of say 2% of (5-3.1V) or ~ 50x 3.3k/2 = 8k to 10k to create this offset for hysteresis and recompute your new trigger and normal recovery temps. Then the pullup R has to change to a lower level and you could use a spreadsheet to determine the analog Vref changes with the logic Vout changes, to select the optimum R values for hysteresis and pullup without needing anything else. Of course quad OpAmps could be used instead as temp. BW is very low. And there are CMOS rail to rail quad op amps.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
1
  • \$\begingroup\$ Ok now. ..... any ?? \$\endgroup\$ May 19, 2021 at 14:04
2
\$\begingroup\$

It's not clear if you intend on adding more thermistor channels. Wire-OR with a dedicated comparator open-collector channel for each thermistor would work.

The LM339 has four output channels. If you find you're exceeding this and don't want to add more chips, or if you want to scale down to e.g. an LM2903 with only two channels, you can move to a single comparator aggregating via diode array:

schematic

simulate this circuit – Schematic created using CircuitLab

sweep

In the above sweep, we see the first three thermistors staying partially on. The fourth goes from being fully off and not affecting the shared input to being fully on and affecting the shared input.

This approach will require diodes that have low forward voltage drop and low reverse leakage current. Your unstated error budget will determine what these have to be.

R9 is required to discharge the voltage on the noninverting input of U1 once the highest-voltage thermistor branch has decreased. This must be balanced: too high and it will be slow to discharge the input capacitance of U1; too low and it will load your thermistors and cause accuracy issues.

You indicate that this output is going to an MCU. As @Janka correctly points out, quite a few MCUs have integrated comparators and this circuit would allow you to use one of those with no exterior active components at all.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ It is worth adding some µCs have a build-in comparator, and this circuit can be used with their internal comparator as well, completely diminishing the need for any extra IC. \$\endgroup\$
    – Janka
    May 19, 2021 at 12:13
  • \$\begingroup\$ I like this one even more than my answer. I think a pull-down resistor on the + input is missing ? \$\endgroup\$
    – tobalt
    May 19, 2021 at 14:24
  • \$\begingroup\$ @tobalt why would you need a pulldown? There's adequate pulldown impedance on each thermistor branch \$\endgroup\$
    – Reinderien
    May 19, 2021 at 15:34
  • 1
    \$\begingroup\$ Assume one of the Thermistors went into an overtemp fault condition. The midpoint in its leg is now at - let's say 4 V- this drives the comparator input to ~3.8V via the schottky diode and it will output a overtemp fault indication. Now the overtemp goes away and the voltage divider will return to ~2 V. However, the comparator input will still sit at 3.8V and will still display an overtemp situation. In other words: Your IN+ node has no reasonable way to reduce its voltage other than diode reverse leakage (which could be overpowered by input bias current) \$\endgroup\$
    – tobalt
    May 19, 2021 at 16:09
  • 1
    \$\begingroup\$ @tobalt You're right - thank you - and a transient simulation confirmed as much. I've edited the answer to include this. \$\endgroup\$
    – Reinderien
    May 19, 2021 at 16:37
2
\$\begingroup\$

You can use the LM339 and wire-or the outputs as suggested, however keep in mind that the input voltage range of the LM339 is only guaranteed over the full die temperature range of 0°C to 70°C to be up to 3V with a 5V supply (and might be slightly worse again with the tolerance of the 5V supply).

The LM339 is, fortunately for this application, guaranteed to give the correct output state provided at least one of the inputs is within the input voltage range, however under overtemperature conditions with the present front end circuit it is possible that both would exceed 3V and thus be outside the common-mode input voltage range. Under those conditions, the output state is undefined. Since the input stage is very similar to the LM324/LM358 (except for the higher bias current) we can expect this:

If both inputs exceed the upper common mode range, the output is undefined; it could be either the VOL or VOH level and the result may vary part-to-part, lot-to-lot, over process, over temperature, etc.

enter image description here

I therefore suggest you use slightly lower reference (2.5V would be very safe and is the native output voltage of the LM431) and adjust the series 3.3K resistors downwards to compensate. When you use a 2.5V supply, you only need to make the resistor the same value as that of the thermistor at the threshold temperature (since 2.5 is half of 5V).

If you need the 3.1V elsewhere, adding a second LM431 + resistor is probably easiest.

Note: The output sink capability of the LM339 is rather limited so don't go too low on the pullup resistor. Even the 6mA limit is specified under very optimistic conditions (25°C only, 1.5V on the output (so barely low by CMOS Vol/Vih standards an zero noise margin) and with a -1V differential input! 1mA (or 0.5mA as suggested elsewhere) would be very safe.

Here is a complete circuit (minus bypass caps), with the NTC thermistors moved to the grounded side (which is usually preferable for various reasons such as accidental grounding of the sensor leads). R1..R4 represent the thermistors and 3K is a placeholder for the actual resistor value.

enter image description here

Depending on what happens as a result of an output you may wish to add hysteresis or a delay, but that's outside of the scope of this answer. You should also make sure that the self-heating of the thermistors is not an issue.

\$\endgroup\$
2
  • \$\begingroup\$ thanks. now I understand this part of datasheet too (that how VCC affects IN+/IN- range). but two questions come to my mind : 1. is it vital to stay in common-mode? (what happens if Vin+ or Vin- is outside the Vcc-2 range? as the last sentence says voltages up to 30 V are non-destructive. 2. simply raising Vsupply to 6.5v doesn't solve all my issues for staying in CM?) \$\endgroup\$ May 19, 2021 at 17:43
  • 1
    \$\begingroup\$ It is vital to stay within the common-mode range if you care about the correctness of the output state. As in the quote above, the chip won't be damaged but it may give incorrect results. Raising Vsupply to 6.5V will mean the common mode range extends to 4.5V to the 3.1V threshold is very safe. Since the output is open-collector you can still pull the output to whatever logic voltage you are using (5V, 3.3V etc.). Or 6.5V if that is desirable. \$\endgroup\$ May 19, 2021 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.